So my wife picks up the kid from daycare around 4:00PM everyday.
I am usually not home.
I want to setup automation so that when she is sensed home, lights come on, etc.
I already have trackers setup, etc. Just wondering if the below flow would be the best blueprint to do it or is there a better way?
If it works, then it’s a great way!
I do something similar in which I add people to a group called group.all_people
, then use a trigger:state
node to check that the group’s state changes from not_home
to home
. Then, if it’s dark, I turn on the kitchen lights. By using a group, it takes the state of any person in the group. This means it’d turn on for you as well if you return home, but your wife is not home. Works like a charm and hasn’t failed me in 2 years.
Here’s the code you can import to node-red. Note that you’ll want to tune the Is dark?
check. I have it start at sunsetStart
and stop at 10pm.
[{"id":"b9ee15aa.832658","type":"trigger-state","z":"83deaef7.d3424","name":"Home","server":"74d5538b.e0092c","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"group.all_people","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"z9fwzvc90xn","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"home"},{"id":"9dpg7jwjla9","targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"not_home"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":210,"y":1440,"wires":[["3669ce.66caf632"],[]]},{"id":"3669ce.66caf632","type":"time-range-switch","z":"83deaef7.d3424","name":"Is dark?","lat":"","lon":"","startTime":"sunsetStart","endTime":"22:00","startOffset":0,"endOffset":0,"x":380,"y":1440,"wires":[["4f3dc5ee.7c8cfc"],[]],"outputLabels":["yes","no"]},{"id":"4f3dc5ee.7c8cfc","type":"api-call-service","z":"83deaef7.d3424","name":"Kitchen lights","server":"74d5538b.e0092c","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.lightswitch_kitchen_cans","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":580,"y":1440,"wires":[[]]},{"id":"74d5538b.e0092c","type":"server","name":"Home Assistant","legacy":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
You need to edit your configuration, then restart HA https://www.home-assistant.io/integrations/group/