How to run an automation that run on night

Hi all,
sorry for my stupid question.

I currently have a door sensor and a roller shutter

my first automation was : move the roller down at night => very easy as i used the sunset event :slight_smile:

my second automation was : move the roller down at night if the bay window isn’t open => still very easy as i simply added a condition that checks the door status

but now it came to my mind :
if i’m outside(the bay window is open), night begin and i’m still out, then i go in minutes or hours after sunset (i don’t know in advance this time)

how can i do automate that the roller should move down once the bay window is closed if outside is already night ?

or is the sunset still valid in middle of the night ?

I’m rather new at this myself, but I think you want the sensor for sun above horizon or below horizon. This would be true after the moment of sunset has passed.

Hope that helps.

for this you need 1 automation with 2 triggers and 2 conditions.
triggers: sunset and closing window
conditions: sun = below_horizon and window is closed.
I don’t want to steal the learning curve from you :wink: but do let me know if you need help

2 Likes

thanks that sound perfect, i’m going to try this :wink:

edit : for the door sensor it asks me to fill 3 fields

from
to
for

from : open
to close
for ?

to: 'off' (or whatever value means closed)
you don’t have to provide the other 2 , you need at least one
That’s for the trigger of course

ok thanks for the answer.

currently i have done following automation

sunset + bay window close => put down

door closed + after sunset => put down

week day at specific hour => put up
door opened + roller is down => put up

If i merge both first automation in one, wouldn’t it generate an issue

i mean if conditions are OR and trigger point are OR logic then
it would mean that I also allow

sunset trigger + after sunset condition => put down (and this is not something i want)

or is it possible to say condition 1 should only apply on trigger 1 and condition 2 on trigger 2

The sky’s the limit.
Conditions are AND by default, so as long as you want only AND conditions, simply list them one after the other.
check the docs for examples:

1 Like