Mqtt broker and Sonoff Tasmota

Ok, so I have made this flow that based on various inputs sends an on/off signal that I would like to use for turning on/off a ventilation system.
I have flashed a Sonoff with tasmota, and through the sonoffs own web interface, I can turn it on or off.
So my missing link is to use the RasPi running my node-red flow to turn it on/off.

To avoid to much complexity, I set out planning on running the MQTT broker within node-red, by using: "node-red-contrib-mqtt-broker".

Further, I was thinking to use "node-red-contrib-sonoff-tasmota" to control the sonoff.

However, I don't know anything about mqtt, and my trials and errors have not shown any progress.

My tasmota is set up like this, the host ip being my RasPi.

In the simple flow below it shows how I tried to do this.... Anybody who knows of a "best" way to link node-red and tasmota sonoff's??

[{"id":"690e0ad2.a7a794","type":"tab","label":"MQTT","disabled":false,"info":""},{"id":"69fa4ac6.14cf14","type":"mosca in","z":"690e0ad2.a7a794","mqtt_port":1883,"mqtt_ws_port":8080,"name":"MQTT-Broker","username":"","password":"","dburl":"","x":281,"y":495,"wires":[[]]},{"id":"700f7371.29108c","type":"Sonoff device","z":"690e0ad2.a7a794","mode":"0","broker":"f2ef30e2.c3d8c","device":"Basement_Vent","name":"","onValue":"ON","offValue":"OFF","cmdPrefix":"cmnd","statPrefix":"stat","telePrefix":"tele","x":295,"y":422,"wires":[["1232582d.b87278"]]},{"id":"ed784a59.633a18","type":"inject","z":"690e0ad2.a7a794","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":91,"y":196,"wires":[["700f7371.29108c"]]},{"id":"516f37d.e1c6248","type":"inject","z":"690e0ad2.a7a794","name":"","topic":"Basement_Vent","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":142,"y":239,"wires":[["700f7371.29108c"]]},{"id":"1232582d.b87278","type":"debug","z":"690e0ad2.a7a794","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":515,"y":423,"wires":[]},{"id":"f2ef30e2.c3d8c","type":"mqtt-broker","z":"","name":"MQTT_tonsgaard","broker":"192.168.1.45","port":"1883","clientid":"MQTT-broker","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]

Any help much appreciated - THANKS :wink:

This is probably the best introduction to MQTT
https://www.hivemq.com/mqtt-essentials/

You can also run mosquitto broker on your Pi.

Thanks for the link ghayne. I'll have a read once time permits.

I would think, though, that someone other than me have had the need to link node-red to tasmota sonoff as simple as possible, and that som simple example flows could be found somewhere. You guys know of any?

While I may need to become more knowledgeable on MQTT to get it to work, I acknowledge that I may not be able to reach expert level anyway, and that I may not need to for such a limited use.
( hoping to not come across as too lazy )

So tips to simple connections Node-red on RasPi <-> Sonoff tasmota are appreciated.

It really is trivial to do, but if you want to use MQTT you do need to understand the basics of what it is about. Hence the link to the guide that was posted earlier.
To achieve it all you need to do is to install mosquitto, probably on the node-red machine, point the tasmota device at that mqtt server, and use an MQTT In node in node-red to pick up the data.
To install mosquitto on a Pi:
sudo apt install mosquitto

..in addition to what already has been pointed out, you only need mqtt to control a tasmota device.

examine the tasmota device console output and issue some commands (refer to the tasmota wiki regarding commands) and try to figure out how the topics are arranged and represented as json objects.

Here*s an example flow, for a switch including dashboard and Info on VCC/RSSI/LinkCount that I use for a small tasmota based Lamp/Lightbulb sitting in the attic.

[{"id":"8dbe9219.52c24","type":"mqtt in","z":"222e7574.34b79a","name":"SONOFF-197- STATE","topic":"tele/sonoff197/STATE","qos":"0","broker":"bddb336e.6dda","x":180,"y":160,"wires":[["26bcecf5.698244"]]},{"id":"26bcecf5.698244","type":"json","z":"222e7574.34b79a","name":"","property":"payload","action":"obj","pretty":false,"x":390,"y":220,"wires":[["e6a07102.e7daf"]]},{"id":"1c19f143.73206f","type":"ui_gauge","z":"222e7574.34b79a","name":"VCC","group":"4aab6a5d.0611c4","order":2,"width":"3","height":"3","gtype":"gage","title":"VCC","label":"V","format":"{{value}}","min":"3","max":"3.5","colors":["#e6e600","#00df00","#ca3838"],"seg1":"3.1","seg2":"3.4","x":850,"y":80,"wires":[]},{"id":"86e4d758.f9b648","type":"switch","z":"222e7574.34b79a","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"Vcc","vt":"str"},{"t":"eq","v":"POWER","vt":"str"},{"t":"eq","v":"Wifi","vt":"str"},{"t":"eq","v":"RSSI","vt":"str"},{"t":"eq","v":"LinkCount","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":550,"y":320,"wires":[["1c19f143.73206f"],["b8e6236a.5e0a1"],["e6a07102.e7daf"],["91943177.9ea57"],["356648a5.47f238"]]},{"id":"e6a07102.e7daf","type":"split","z":"222e7574.34b79a","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":550,"y":220,"wires":[["86e4d758.f9b648"]]},{"id":"91943177.9ea57","type":"ui_gauge","z":"222e7574.34b79a","name":"RSSI","group":"4aab6a5d.0611c4","order":3,"width":"3","height":"3","gtype":"gage","title":"RSSI","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#cc6600","#e6e600","#00e800"],"seg1":"20","seg2":"50","x":850,"y":267,"wires":[]},{"id":"b8e6236a.5e0a1","type":"ui_switch","z":"222e7574.34b79a","name":"Lampe Ein / Aus","label":"Lampe Ein / Aus","tooltip":"","group":"4aab6a5d.0611c4","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"POWER","style":"","onvalue":"ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"OFF","offvalueType":"str","officon":"","offcolor":"","x":868,"y":185,"wires":[["70cb8e6f.afe7e"]]},{"id":"70cb8e6f.afe7e","type":"mqtt out","z":"222e7574.34b79a","name":"Relais","topic":"cmnd/sonoff197/POWER","qos":"0","retain":"","broker":"bddb336e.6dda","x":1114,"y":187,"wires":[]},{"id":"d92a71d1.9e824","type":"mqtt in","z":"222e7574.34b79a","name":"RESULT","topic":"stat/sonoff197/RESULT","qos":"0","broker":"bddb336e.6dda","x":170,"y":300,"wires":[["26bcecf5.698244"]]},{"id":"356648a5.47f238","type":"ui_text","z":"222e7574.34b79a","group":"4aab6a5d.0611c4","order":3,"width":0,"height":0,"name":"LinkCount","label":"LinkCount","format":"{{msg.payload}}","layout":"row-spread","x":859,"y":338,"wires":[]},{"id":"bddb336e.6dda","type":"mqtt-broker","z":"","name":"mqtt on alarm","broker":"192.168.10.22","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"4aab6a5d.0611c4","type":"ui_group","z":"","name":"Lampe OG","tab":"d99f55e9.d71f48","order":1,"disp":true,"width":"6","collapse":false},{"id":"d99f55e9.d71f48","type":"ui_tab","z":"","name":"Sensors","icon":"dashboard","order":1,"disabled":false,"hidden":false}]