Tasmota supports Domoticz MQTT 'out of the box' for both relays and sensors.
Find below the procedure to configure Domoticz and Tasmota.
The following servers should be made available:
- You have installed/access to a MQTT broker server and made contact with your Tasmota device
- You have installed Domoticz
If not already done configure Domoticz MQTT and Virtual Sensor hardware.
- On the hardware page add Type
MQTT Client Gateway with LAN interface
- Give it a name
- Configure the interface with access to your MQTT server (
Remote Address
,Port
,Username
andPassword
) - Set the
Public Topic
to flat (which seems to relate toout
in the select field)
- On the hardware page add Type
Dummy (used for virtual switches)
- Give it a name
Make a new virtual switch and remeber its Idx number.
- Make a new virtual switch to be used with Sonoff by clicking
Create Virtual Sensors
- Give it a name
- Select
Sensor Type Switch
- On the Devices page find the new switch by it's name
- Remember it's Idx number
Tasmota provides different ways to configure Domoticz parameters. Choose the method you prefer:
[The sections below don't look like they are needed any longer. The in topic and out topic entry areas don't appear to be in the Domoticz configure section - at least they are not there in mine and mine is working 17/03/2018]
- Use the webinterface and select Configuration - Configure Domoticz:
- Set
In topic
todomoticz/in
as hardcoded in Domoticz - Set
Out topic
todomoticz/out
as hardcoded in Domoticz - Configure
Idx 1
to the value read in step 2.i
- Set
- Use MQTT and execute commands (if necessary, replace
tasmota
with unique topic you configured in Initital Configuration, see point 5 there):cmnd/tasmota/DomoticzInTopic
with payloaddomoticz/in
as hardcoded in Domoticzcmnd/tasmota/DomoticzOutTopic
with payloaddomoticz/out
as hardcoded in Domoticzcmnd/tasmota/DomoticzIdx1
with payload value read in step 2.i
- Use the serial interface and execute commands:
DomoticzInTopic
withdomoticz/in
as hardcoded in DomoticzDomoticzOutTopic
withdomoticz/out
as hardcoded in DomoticzDomoticzIdx1
with the value read in step 2.i
That's it! You can now control your device from the Domoticz user interface.
- On the Switches page scroll down and find your Switch as configured in step 1
- Toggle the light bulb; Tasmota should respond
Tasmota supports automatic discovery by Domoticz through the Domoticz MQTT Discovery plugin.
The following services should be made available:
- You have installed/access to a MQTT broker server and made contact with your sonoff
- You have installed Domoticz
- You have installed the Domoticz MQTT Discovery plugin
Configure Domoticz MQTT Discovery plugin.
- On the hardware page add Type
MQTT Discovery
- Give it a name, e.g.
Tasmota
- Configure the interface with access to your MQTT server (
MQTT Server Address
,Port
,Username
andPassword
) - Set the
Discovery topic
tohomeassistant
unless it has been changed in a custom Tasmota build - Set the
Ignored device topic
to/tasmota/
to avoid unconfigured Tasmota devices from being discoved
- Give it a name, e.g.
- Each Tasmota device must have it's own topic, the easiest way is to set topic to
tasmota_%06X
(%06X will be replaced by MAC address). See here for how to set the topic. - Use MQTT or Serial or Web console and execute commands (replace
<tasmota_xxx>
with the device's unique topic)cmnd/<tasmota_xxxx>/SetOption19
with payload1
to enable MQTT discovery
- The above settings can be defined in user_config_override.h (TBD)
That's it! You will now find your Sonoff in the Domoticz user interface.
- On the Switches page scroll down and find your Switch as configured in step 1
- Toggle the light bulb; Sonoff should respond