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.

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
mygateway-out/<id>/<child-id>/1/0/2

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