I’m new to Home Assistant (just started with 7.4 onward) and unsure about NodeRed “If State”
(google search gave no result, people seem having various version where they can specifically say State = msg.payload etc.)
So just to clarify, with Home Assistant, is State hardcoded to the msg.payload ?
i.e. If State means If msg.payload in the below pic?
If it is hard-coded, is there a way to change it to some other property for condition?
(An alternate will be adding a Switch node after it to do conditioning)
Look just below what you’re mentioning… At - the box that says output properties…
THOSE are what the node sends. if state is TRUE - out of the top output. So in your case:
pseudocode: if sensor.garage <> “none” then Send “All that stuff in the output properties” to the top node output
(Also - get in the habit of using all lowercase - a lot of stuff is case-sensitive here and you will pull hair out trying to find out where you mis-cased a name…)
Now if it’s NOT true - it dumps everything down the bottom output.
SO in that config you can count on every message coming out (if you’re only connected to the top node) to be a true matching response.
What if you want True AND false coming out of the same output? Just clear your if state condition. It will automatically merge the true/false nodes back together because there’s no condition - and every output gets sent down the node (everything in the output properties) In which case you would then use a switch node to respond accordingly and send it to the next stop in the chain.
Which do you use? Depends… What do you want to do? In my flows I generally avoid setting filters inside the device state nodes because I use a LOT of templates and reusable constructs so I can copy-paste an entire room’s logic at once then just pop down the 2-5 door, window, motion nodes I need for a room. If I have to open each device state node and then edit conditions too it slows me down.
What is sensor.garage state? That is what the if state is.
When sensor.garage has the state none the node becomes true and it “activates” and the automation starts.