Im a newbie in MQTT and Node Red and I am doing some home automation with sonoff devices and MQTT.
Everything works fine when I turn the lamp on and off using a switch on de node red dashboard. But when I press the sonoff physical button, the dashboard switch is not being updated (when I turn off a lamp using the physical button, the dashboard switch still shows that the lamp is on).
I dindt find anything about this "problem" on internet. I know that I have to develop this kind of function (presuming that I can set a specific topic to the physical button press), but I have no idea how to start.
Could you help me?
Assuming the Sonoff sends a MQTT message when you press the physical button, you just need to subscribe to that message and then if needed transform it so for on msg.payload
= true and for off msg.payload
= false.
You then feed this message into the left hand end of the Dashboard UI button node (and make sure you untick the checkbox about passing incoming messages through)