Node red alternative to using input_boolean?

Theres a button in my childs room. I had it setup that when the button is pressed, it toggles 3 things in her room. Problem is sometimes there’s a hiccup and maybe only 2 things toggle. So now 2 are ON, 1 is OFF. She presses it again, now 2 are OFF, 1 is ON. Now I have the manually change state of the 1 thing in order to get it all back in sync again.

So I changed the flow and added an input boolean that is turned OFF or ON. And the devices are all then set to turn OFF or ON based on the state of the boolean. So even if above issue happened, she just now needs to press the button 2 more times (1 time to turn them ON again, then one more time to try turning them off).

My question is, is there a built in node red device that can take the place of this boolean logic? So I dont need to create a bunch of helpers in HA?

[{"id":"95ed3ce4125c5d63","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"5e30d3f8c638f026","type":"server-state-changed","z":"95ed3ce4125c5d63","name":"Button pressed","server":"ab3e2c53.e3491","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.button_em_s_room_action","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":410,"y":360,"wires":[["dc71e6003b4eec2d"]]},{"id":"dc71e6003b4eec2d","type":"switch","z":"95ed3ce4125c5d63","name":"One, two or hold","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"single","vt":"str"},{"t":"eq","v":"double","vt":"str"},{"t":"eq","v":"hold","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":605,"y":360,"wires":[["9b26038042660bb6"],[],[]]},{"id":"57984b4e43fddbd9","type":"api-call-service","z":"95ed3ce4125c5d63","name":"Turn off star projector","server":"ab3e2c53.e3491","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.outlet_ems_room_star_projector"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1420,"y":240,"wires":[[]]},{"id":"9f5123e13487a026","type":"api-call-service","z":"95ed3ce4125c5d63","name":"Turn off outlet for Ems lights under bed","server":"ab3e2c53.e3491","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.outlet_ems_room_lights_under_bed"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1475,"y":285,"wires":[[]]},{"id":"b6640e70d20b82fb","type":"api-call-service","z":"95ed3ce4125c5d63","name":"Turn off hatch","server":"ab3e2c53.e3491","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.ems_hatch_light"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1405,"y":330,"wires":[[]]},{"id":"9b26038042660bb6","type":"delay","z":"95ed3ce4125c5d63","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":800,"y":360,"wires":[["e9213497b551bc2d"]]},{"id":"e9213497b551bc2d","type":"api-current-state","z":"95ed3ce4125c5d63","name":"Boolean on?","server":"ab3e2c53.e3491","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.ems_room_devices_off","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":985,"y":360,"wires":[["967a435c42307b52"],["bb041a73f9642a13"]]},{"id":"af532a3f7da5f18f","type":"api-call-service","z":"95ed3ce4125c5d63","name":"Turn on star projector","server":"ab3e2c53.e3491","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.outlet_ems_room_star_projector"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1425,"y":405,"wires":[[]]},{"id":"acfe494ccbc806c6","type":"api-call-service","z":"95ed3ce4125c5d63","name":"Turn on outlet for Ems lights under bed","server":"ab3e2c53.e3491","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.outlet_ems_room_lights_under_bed"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1470,"y":450,"wires":[[]]},{"id":"a1dc640b1c9214bf","type":"api-call-service","z":"95ed3ce4125c5d63","name":"Turn on hatch","server":"ab3e2c53.e3491","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.ems_hatch_light"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1410,"y":495,"wires":[[]]},{"id":"967a435c42307b52","type":"api-call-service","z":"95ed3ce4125c5d63","name":"Turn off boolean","server":"ab3e2c53.e3491","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.ems_room_devices_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1160,"y":330,"wires":[["57984b4e43fddbd9","9f5123e13487a026","b6640e70d20b82fb"]]},{"id":"bb041a73f9642a13","type":"api-call-service","z":"95ed3ce4125c5d63","name":"Turn on boolean","server":"ab3e2c53.e3491","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.ems_room_devices_off"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1160,"y":375,"wires":[["af532a3f7da5f18f","acfe494ccbc806c6","a1dc640b1c9214bf"]]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHome","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

Flow variable is one way.
You could also use trigger node (I believe it is) to repeat the same message again to the switches.
That way it’s likely that it will turn on on the second attempt.

That would have to be after “turn boolean on” node. Or if you prefer “turn flow variable on”.

I try to avoid call service → call service nodes, I’ve had trouble with that in the past. I’d break off the end of the flow. Use an event state from the input boolean to turn on/off the lights in a separate flow.

The button press, I would just go to toggle the boolean rather than the logic to determine state.

Worth mentioning is that are you sure one of the switches is not going unavailable when switching? I have one switch that gives me trouble and I use a current state node to create a loop that will continue until the switch is on.

This isn’t exactly what you’re asking, but you could also use groups in home assistant to manage all the devices. Create something like switch.daughtersroomstuff and you can call just the one entity.

Seems kind of odd to need a boolean here.

I also see that your example shows you were using toggle before, where the flow I imported is using turn_on/turn_off. That was going to be my suggestion until I opened the flow. Have you tested without the boolean using the specific commands? In that case you could use a current state node to be the switch.

See my example flow:

[{"id":"5e30d3f8c638f026","type":"server-state-changed","z":"95ed3ce4125c5d63","name":"Button pressed","server":"","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.button_em_s_room_action","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":410,"y":360,"wires":[["dc71e6003b4eec2d"]]},{"id":"dc71e6003b4eec2d","type":"switch","z":"95ed3ce4125c5d63","name":"One, two or hold","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"single","vt":"str"},{"t":"eq","v":"double","vt":"str"},{"t":"eq","v":"hold","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":605,"y":360,"wires":[["9b26038042660bb6"],[],[]]},{"id":"9b26038042660bb6","type":"delay","z":"95ed3ce4125c5d63","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":800,"y":360,"wires":[["0b31d761b0b3647c"]]},{"id":"0b31d761b0b3647c","type":"api-current-state","z":"95ed3ce4125c5d63","name":"","server":"","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.daughtersroomstuff","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1080,"y":360,"wires":[["84bc3c0401971f98"],["2de628c67503409e"]]},{"id":"84bc3c0401971f98","type":"api-call-service","z":"95ed3ce4125c5d63","name":"turn off switch.daughtersroomstuff","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1440,"y":300,"wires":[[]]},{"id":"2de628c67503409e","type":"api-call-service","z":"95ed3ce4125c5d63","name":"turn on switch.daughtersroomstuff","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1440,"y":420,"wires":[[]]}]
1 Like