I have Node-RED installed on my Home Assistant instance and I am trying to do the following. (Note that this is my first attempt at a bit of logic here, so my knowledge of all the nodes is certainly not complete.)
When a Tasmota device is long pressed (and produces a specific MQTT message), I would like to check the state of 2 switches, then...
- If both are on, then turn off.
- If both are off, then turn on.
- Else turn off.
This is what I have come up with, and it works so far, but if I have to expand this, it is going to be a nightmare.
I have tried the OR / AND node to try and get the MQTT status by pasting in the cmnd/switch_name/POWER
command, but not too sure if that is the intent of these nodes.
I have also tried this, with the current state node...
But it ends up sending 2 messages at the end; one false and one true. I suspect since there is a lag in getting the MQTT states back and produces 2 output flows.
msg : Object
object
topic: null
payload: "off"
bool: false
_msgid: "688f91a1.5fe65"
msg : Object
object
topic: null
payload: "off"
bool: true
_msgid: "57953389.fabcdc"