Connect Sonoff running Tasmota

  • Tasmota is a popular open firmware for the Sonoff switches. It features a MQTT interface and I thought it would be good to connect it to Mycontroller.
    I couldn't configure Tasmota to publish in a Mysensors compatible format.
    Topic is configurable, but the last part and paypload are fixed and would have to be changed in the sourcecode.

    Messages of Tasmota look like this:

    00:00:08 MQT: mygateway-in/25/1/1/0/2/RESULT = {"POWER2":"OFF"}
    00:00:08 MQT: mygateway-in/25/1/1/0/2/POWER2 = OFF
    00:00:09 MQT: mygateway-in/25/1/1/0/2/RESULT = {"POWER1":"OFF"}
    00:00:09 MQT: mygateway-in/25/1/1/0/2/POWER1 = OFF
    12:00:22 MQT: mygateway-in/25/1/1/0/2/STATE = {"Time":"2018.05.09 12:00:22","Uptime":"0 00:00:15","Vcc":3.499,"POWER1":"OFF","POWER2":"OFF","Wifi":{"AP":1,"SSId":"2.4GHz","RSSI":78,"APMac":"46:..."}}
    12:02:00 MQT: mygateway-in/25/1/1/0/2/UPTIME = {"Time":"2018.05.09 12:02:00","Uptime":"0 00:01:53"}
    12:05:22 MQT: mygateway-in/25/1/1/0/2/STATE = {"Time":"2018.05.09 12:05:22","Uptime":"0 00:05:15","Vcc":3.499,"POWER1":"OFF","POWER2":"OFF","Wifi":{"AP":1,"SSId":"2.4GHz","RSSI":82,"APMac":"46:..."}}

    Any idea what would be the quickest way to make these devices compatible?

    Communication of Tasmota:


    @ragflyer topic last character and payload should be parsed with a custom provider. Kindly create a feature request on GitHub Page.

    On the ticket add supporting documents for this ticket. I will work on this when I have time.

    Thank you!

  • Found a workaround using Node-Red, for newbies like me this might be helpful:

    Flash Tasmota to your Sonoff,
    set MQTT topic to e.g. sonoff-1234,
    full topic to e.g. /smarthome/%prefix%/%topic%/

    Install Node-Red, add node-red-dashboard.
    Drag a MQTT input, set topic to /smarthome/stat/sonoff-1234/POWER
    Add a switch, uncheck "If msg arrives on input, pass through to output:", let it show state of the input, set on payload to String "ON", off payload to "OFF"
    Add a MQTT output, set topic to /smarthome/cmnd/sonoff-1234/power

    Now you should have a working switch on the Node-Red dashboard, it should always show the state of the sonoff.

    To show the state of the switch in Mycontroller, add a Function and connect it to MQTT input:
    if (msg.payload == "ON") {
    msg.payload = 1;
    } else if(msg.payload == "OFF") {
    msg.payload = 0;
    return msg;

    There is a replace function for message payloads, you could use that instead.
    Connect a MQTT output to the function, set topic to

    This will post the converted on/off message to mysensors format to be read by the mycontroller mqtt gateway.






Looks like your connection to MYCONTROLLER.ORG was lost, please wait while we try to reconnect.