Since a few weeks i am spending more and more time in HA and setting it up with automations. Slowly getting a hang of it and really liking it!
A few days back i made an automation that basicly does this:
When we leave the house it starts prescense Simulation lights. As soon as we get back it turns off. This will only be done when it’s dark out.
Now i sat thinking. i have triggered this automation with A status atribute basicly saying when ‘home’ changes to 0.
But what happens when we are out for a week and the status of ‘home’ is already 0 for the second night?
You will understand we want this automation to run every nighttime when we are not in. Maybe some tweaks and little tips? If this is already the way to go and this works like i want please let me know!
This is the automation in YAML:
description: ""
triggers:
- trigger: state
entity_id:
- zone.home
to:
- "0"
id: Everybody Left Home
- trigger: numeric_state
entity_id:
- zone.home
above: 0
conditions: []
actions:
- if:
- condition: trigger
id:
- Everybody Left Home
- condition: time
after: sensor.sun_next_dusk
before: sensor.sun_next_rising
then:
- action: switch.turn_on
target:
entity_id: switch.choose_a_unique_name
data: {}
else:
- action: switch.turn_off
target:
entity_id: switch.choose_a_unique_name
data: {}
mode: single
type or paste code here
but now i am thinking. what if it is already dark and i am leaving. i want the automation to pick it up from there.
for example;
now my automation triggers as soon as it gets dark out. but let’s say tomorrow it gets dark at 18:00 so my automation triggers at 18:00. but i am home at that time so the presence lightning is not turned on. 1 hour later i leave for a few hours. autmation won’t trigger again because it is triggered at 18:00 and won’t trigger again.
how can i make my automation to include everything i have in my changed automation but also covers me leaving after the start trigger already is done.