I am a total noob with Node-Red and am struggling to connect Tasmota plus an ESP-Easy and getting them all to pub & sub.
I am trying to implement the following:
1x ESP32 with a toggle switch. (controller)
3x Sonoff 1ch flashed with Tasmota. (receivers)
1x Raspberry Pi 3B with Pi OS and the latest install of node-red.
What I want to do is publish the ESP32 switch toggle state change, subscribe to that state change on the 3x Tasmotas and toggle the relays .
I hope that makes sense, and is this possible? Any guidance for this application would be greatly appreciated.
Well, yes, it is possible. However, it seems you are missing a quite important part of the MQTT setup, the broker.
Have you installed something like that? Typically mosquitto on your rpi would be the obvious choice.
GV
So, the idea is to use the "mqtt in" in node red to listen to the "pub" made by the controller and when the message is received to publish "mqtt out" what the sonoff will need to turn on.
Your flows in NodeRed will kind of translating what the ESP32 will publish into something the Sonoff can understand.
You need to know what message the ESP32 will publish and the message the Sonoff are subscribed to, in order to receive the order.
How far have you got? Are you able to subscribe to the state on the Tasmota devices? That should be the easiest part.
Personally I recommend Mosquitto as the broker unless you have a reason to go with another. I have no experience with Aedes but provided it works then whichever you use it should not matter.
I've looked at Aedes in the past and decided that it is only worth using if you need its integration features such as MongoDB and REDIS integration. Otherwise Mosquitto is reliable, small and fast. But I doubt this is the issue here anyway as you say.
I would start by setting up the controller and a simple NR flow to dump the controllers changes to debug. That should indeed be the easy bit.
Then I would connect the Sonoff's to the broker and make sure that manual button presses are resulting in expected output at the broker.
If you are not already familiar with the concepts of MQTT then I recommend this set of tutorials. Work through those and you will know pretty much everything you need to know about MQTT. https://www.hivemq.com/mqtt-essentials/
Ok, and I have added an MQTT-out node, configured it to pub to fan1/relay/POWER and connected "on" and "off" inject nodes, and it seems to be working ok (relay clicking and tasmota console updating).