Input Selector Triggers When Away

I am currently using an input select in HA to put my house into various modes. (morning, home, away, etc.) I have corresponding flows setup in Node-RED that carry out the appropriate automations. All of that is working well. I am now trying to figure out how to have Node-RED choose the appropriate mode based on mine and my wife’s presence (we are using the HA app).

Ideally I would like “away” to trigger if both mine and my wife’s phones leave, unless the current mode is “guest”. Then when either of our phones return, go to “home” mode. I would also like the “night” mode to automatically trigger at midnight.

Attached is my current flow. If anyone could at least point me in the right direction, I would be most appreciative!

I would start with something like this.

1 Like

Thanks for the reply! I currently have this. My mode entity is an input selector in HA. From my home dashboard, I can tap mode and select the mode I want from a dropdown list. Any idea how I can combine what I have and what you suggested?

You can leave the event state state blank with the input select, then send that to a switch. To switch to away mode use the zone.home sensor in the provided trigger node.

I assume you have a boolean to turn guest mode on/off, if not you’ll need one. Change the input boolean name to your entity’s name in the conditions of the trigger node. If guest mode is on, the trigger node will not fire if you leave the home zone.

[{"id":"0608a6e03d9fb5fe","type":"server-state-changed","z":"0a325c35fc29f44e","name":"","server":"","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"input_select.test","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":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":210,"y":1360,"wires":[["a4ba8fda71461b04"]]},{"id":"a4ba8fda71461b04","type":"switch","z":"0a325c35fc29f44e","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"home","vt":"str"},{"t":"eq","v":"away","vt":"str"},{"t":"eq","v":"morning","vt":"str"},{"t":"eq","v":"night","vt":"str"},{"t":"eq","v":"bedtime","vt":"str"},{"t":"eq","v":"guest","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":510,"y":1360,"wires":[["75ede5c2dff83b60"],["7be5de02c2bc7a1e"],["d1af37e21074fbd8"],["a9548ed312046e47"],["c2155e68ed5167ac"],["2456a6670b6fb5a4"]]},{"id":"22e44f0fec8c179c","type":"trigger-state","z":"0a325c35fc29f44e","name":"zone.home","server":"","version":4,"inputs":0,"outputs":2,"exposeAsEntityConfig":"","entityId":"zone.home","entityIdType":"exact","debugEnabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"<","comparatorValueDatatype":"num","comparatorValue":"1"},{"targetType":"entity_id","targetValue":"input_boolean.guest_mode","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"}],"customOutputs":[],"outputInitially":false,"stateType":"str","enableInput":false,"x":140,"y":1460,"wires":[["cf6658345c3f7f5a"],[]]},{"id":"cf6658345c3f7f5a","type":"api-call-service","z":"0a325c35fc29f44e","name":"set select to away","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":390,"y":1460,"wires":[[]]},{"id":"75ede5c2dff83b60","type":"api-call-service","z":"0a325c35fc29f44e","name":"home","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":710,"y":1200,"wires":[[]]},{"id":"7be5de02c2bc7a1e","type":"api-call-service","z":"0a325c35fc29f44e","name":"away","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":710,"y":1260,"wires":[[]]},{"id":"2456a6670b6fb5a4","type":"api-call-service","z":"0a325c35fc29f44e","name":"guest","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":710,"y":1500,"wires":[[]]},{"id":"c2155e68ed5167ac","type":"api-call-service","z":"0a325c35fc29f44e","name":"bedtime","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":720,"y":1440,"wires":[[]]},{"id":"a9548ed312046e47","type":"api-call-service","z":"0a325c35fc29f44e","name":"night","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":710,"y":1380,"wires":[[]]},{"id":"d1af37e21074fbd8","type":"api-call-service","z":"0a325c35fc29f44e","name":"morning","server":"","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":720,"y":1320,"wires":[[]]}]

Edit I realized that the select will dictate if guest mode is active. You can use that in the trigger rather than creating an input boolean. Use is not for it’s state

and the State Type should be set to number as well

1 Like