"condition" with 3 input_selects

I don’t think that’s needed. It works fine without the current state nodes.

Check example in Node-RED at “Import > Examples > boolean logic”

EDIT: It looks like it keeps the last state change of each node connected to its input.

If you have 2 persons on “away” and one on “home” and you restart or just press deploy in node red
the “AND node” wont go to TRUE when person nr 3 goes to “away” (not untill all 3 inputs have made a change to either away or extended away, if i dont use the “current state” to read the state from all 3 whenever any input select is triggered.

So as long as you dont press deploy or restart it might work without the “current state”.
But im always tinkering on my main system so i will most likely have it “out of sync” from restarts or deploys.

Try changing the Deploy option to “Modified Nodes”. :wink:

There’s no need to include anything new this can currently be achieved by a single trigger-state node.

[{"id":"a99f307d.77a96","type":"trigger-state","z":"6edf92e.d52b66c","name":"","server":"351c96ee.9dc3aa","entityid":"^input_boolean\\.(homer|marge|bart|lisa|maggie)$","entityidfiltertype":"regex","debugenabled":false,"constraints":[{"id":"kksy5j7avig","targetType":"entity_id","targetValue":"input_boolean.homer","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"re","comparatorValue":"Extended Away|Away"},{"id":"5f6sm4vao6","targetType":"entity_id","targetValue":"input_boolean.marge","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"re","comparatorValue":"Extended Away|Away"},{"id":"7v9lrb0o8w3","targetType":"entity_id","targetValue":"input_boolean.bart","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"re","comparatorValue":"Extended Away|Away"},{"id":"073l6ura0eel","targetType":"entity_id","targetValue":"input_boolean.lisa","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"re","comparatorValue":"Extended Away|Away"},{"id":"q2dp64285u","targetType":"entity_id","targetValue":"input_boolean.maggie","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"re","comparatorValue":"Extended Away|Away"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":422,"y":336,"wires":[[],[]]}]

Yea, so you say, but i cant get your examples to work, i might have to do some heavy reading up and do some trile and error…

Whoops might be the fact that I accidently used input_boolean instead of input_select.

Nope, i saw that and corrected my setup.
I now have homer, marge and bart setup as input_select with the 5 diffrent states.
But using your example dosent work for homer.
When i have all on “away” and set homer to “home” / “just arrived” or “just left” it wount react and come out of sync when i change him again.
(if i put marge on top of the “add constrain” marge starts to bug like homer, but homer and bart works).
Could it be a bug, or am i the only one having this problem?

Node-red code https://hastebin.com/fimidazaru.json
Yaml code https://hastebin.com/uzakocabud.coffeescript

You are correct. Looks to be a bug or something else weird going on. I’ll have to dig into it when I get a chance.


As a temporary fix you can add a dummy constraint, that will always return true, in the top position and it seems to work in my testing, until I can get a fixed released.

edit: This is now fixed and will be in the next release.

1 Like

Thanks, @Kermit. This is way more powerful than using node-red-contrib-bool-gate as I suggested. Looking forward to the next release.

BTW, it would be great if we also had autocomplete in ‘Add Constraints’. :slight_smile:

@mcfrojd the regex would be more elegantly written like this: ^(Extended\s)?Away$

1 Like

How is the “Output Initially / On Deploy” suppose to work?
If i have my 3 persons set to away (this now trigger an input_boolean to be “on”)
If i then manually set that input_boolean to “off” and re deploy my flow, is the “Output Initially / On Deploy” (if checked) suppose to turn my input_boolean to “on”, without none of my 3 input_selects have changed?

Yes, that’s how it’s supposed to work but the same bug that was affecting the first issue is sort of causing this one. Both are fixed in the latest release which I just pushed out.

1 Like

Hey @Kermit.
I am using v0.5.1 and the “Output Initially/On Deploy” does not work for me neither for events:state nor trigger:state nodes.
I only have a debug node attached to the two nodes and when i press deploy, there is no output on either nodes. The state of an entity has to change in HA in order to produce an output…

If I understand correctly, both nodes should output current entity_id state on deploy?

Should be working correctly, make sure you have a valid entity_id property and that those particular nodes are being deployed. Maybe try changing the deploy type to full.

You’re right, if I change the deploy type to Full, it’s working. If I deploy only Modified Flows, it does not.
But, that is good enough for me, I’m just trying to make sure the flow gets executed in case my server restarts.

What are these nodes with the arrow pointing up right? Don’t seem to have them.


Those are current state nodes, they looked like that in previous versions.

@Kermit Out of interest what conditions were set to achieve this result?

Entity ID input_boolean.maggie current state is Extended Away|Away (re)

The (re) part?

regular expression

Thanks, @Kermit … Could not see it due to this…

Is there any fundamental difference between using “IS + Regex” and vs “Includes + String List”