Just wondering if anyone knows the answer to this question. If I want to automate turning on my outside lights after sunset but only if someone is away.
Currently I have 2 automations.
triggers at sunset - condition checks to see if anyone is not_home. If someone is not_home then it turns on the lights. This happens when the wife is at work, she goes in before dark but is out till after sunset.
if someone leaves after sunset the lights turn on.
So the question is do i need the first rule. Will home assistant regularly retrigger the “away” state of a person when their location is updated? Or is having the 2 automations a good way to go about it.
group:
my_people:
name: "My people"
all: true
entities:
- person.one
- person.two
automation:
- alias: "Turn the lights on if somebody is away at sunset"
trigger:
- platform: state
entity_id: group.my_people
to: 'not_home'
- platform: state
entity_id: sun.sun
to: 'below_horizon'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: state
entity_id: group.my_people
state: 'not_home'
ok cool. so I did have the concept right with that the change has to happen after sunset.
I am going to play with the automation today and make adjustments per your suggestions. I would rather not have more automations the necessary so streamlining will be ideal.
Be aware that this will also trigger every time any of those three entities have a change of attribute, which means that every few minutes the light will be being turned on, or off
This is what I love about HA, no matter how simple something is you can always make it more complicated
group:
my_people:
name: "My people"
all: true
entities:
- person.one
- person.two
automation:
- alias: "Turn the lights on if somebody is away at sunset"
trigger:
- platform: state
entity_id: group.my_people
to: 'not_home'
- platform: state
entity_id: sun.sun
to: 'below_horizon'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: state
entity_id: group.my_people
state: 'not_home'
- condition: state
entity_id: light.your_light
state: 'off'
action:
- service: light.turn_on
target:
entity_id: light.your_light
That will turn on the light if somebody is away at sunset, or leaves after sunset. If the light is already on nothing will happen. It also won’t turn off the light the moment somebody arrives.
Your approach has merits, but in this case they don’t necessarily help here.
Don’t want it to turn off right when someone gets home. May do something with X minutes later, but for now, just more interested in making sure the light is on when someone is arriving. Where I live, somewhat out in the country, there are no lights, so it’s weirdly dark. Nice to have some lights on.
Now i have to play with all these suggestions, not just to see what works best for me, but to see how the different ideas work