I might be duplicating another post somewhere, but I’m trying to create an automation I can’t quite wrap my head around…Here is what I have so far, so you can see what I’m currently working with.
- alias: "Lights Homecoming Dark"
condition:
condition: and
conditions:
- condition: numeric_state
entity_id: sensor.living_room_light_sensor
below: 300
- condition: or
conditions:
- condition: template
value_template: "{% if is_state('input_boolean.person1_home', 'on') %}true{% endif %}"
- condition: template
value_template: "{% if is_state('input_boolean.person2_home', 'on') %}true{% endif %}"
trigger:
- platform: state
entity_id: binary_sensor.front_door
to: 'on'
action:
service: switch.turn_on
entity_id: group.Homecoming
I would like to be able to sense if someone recently arrived home, then only trigger when the door opens…and only if it’s a certain brightness. Then, after the lights in the group “homecoming” have been on for 2 minutes, turn off the lights. I’ve been tinkering with this a lot today and I can’t quite figure out how to do this…I’ve been changing the code because the lights keep turning on at night when one of our phones registers as “away” in the middle of the night for some stupid reason. So, this way, it only triggers if the door also opens…But I don’t want them to turn on if I take out the garbage or something.
I also can’t figure out the final part…turn off the lights after a certain amount of time. Essentially, I need a timer for after the action is triggered. Any ideas?
So this simplifies the input booleans, but it doesn’t really do much about my problem, unfortunately. The system I have does what it’s supposed to, just not what I want it to do, lol. So what I need to do yet is:
detect if person 1 or 2 has recently returned home (if possible), then trigger when the door opens
turn off lights 2 minutes after automation triggers
Thanks phillprice! I think this is pretty much what I’m looking for. PS, since both of the switches in the group “homecoming” are mqtt switches, home_assistant.turn_off doesn’t work as expected. I’ll post my code a bit later when I’ve had some time to tinker with it a bit more.
On a side note … I had some issues with presence detection and the iOS app so to help each person is in their own group with the iOS tracker and my asuswrt tracker so it only lists the group away if both say not home… this eliminated the false aways I was getting in the middle of the night from iOS devices alone
I have something similar. The group people is actually two binary sensors that sense whether either of us is home or not. I can post the code if you would like, but it sounds like you already have something set up.
I wouldn’t mind seeing it myself… mine is simply a group I like to see other people’s methods as there are often multiple ways to accomplish the same tasks… some are often much better than others.