I did see the examples and i know how to use it, my problem is more how to fullfill the requirement Open the covers at sunrise but no earlier than 6:15, i know how to make it open at sunrise but not together with the time in the way described.
thank you for the reply so here is what i think it may solve the req. please correct :
- alias: Open cover on sunrise
trigger:
- platform: sun
event: sunrise
- platform: time
at: '06:15:00'
condition:
- condition: time
after: '06:15:00'
action:
- service: cover.open_cover
entity_id: cover.kkken_rullegardiner
I have removed the condition on the state since the cover i have i can’t get the state so i am doing this blindly, if they are open already it’s fine, if not they will open. I am not sure why you set the time in the condition 1min later, is it because you think it may cause problems when it’s triggered at 6:15 then if the condition is the same it may fail ?
for the close i do the reverse :
- alias: Close cover on sunset
trigger:
- platform: sun
event: sunset
- platform: time
at: '21:00:00'
condition:
- condition: time
after: '21:01:00'
action:
- service: cover.close_cover
entity_id: cover.kkken_rullegardiner
I guess the added minute here is required otherwise the condition would be false. Correct ?
I believe you’ll want this (which is similar to what I do in some of my automations):
- alias: Open cover on sunrise, or at 6:15, whichever comes last
trigger:
- platform: sun
event: sunrise
- platform: time
at: '06:15:00'
condition:
- condition: sun
after: sunrise
- condition: time
after: '06:15:00'
action:
- service: cover.open_cover
entity_id: cover.kkken_rullegardiner
I think you want it to open at sunrise or 6:15, whichever comes last. Is that right? The automation above will trigger at both sunrise and 6:15, but the action will only run if, at that time, it’s both after sunrise and after 6:15. (Don’t worry, a condition that requires it to be “after” a particular time or event will be true when triggered by that exact time or event. At least, that has been my experience.) So the action will only run once, at sunrise or at 6:15, whichever comes last.
For closing, it’s similar, but I think you want sunset or 21:00, whichever comes first. Is that right? If so, it’s even simpler (you don’t need a condition, as long as calling the close service when the cover is already closed isn’t an issue):
- alias: Close cover on sunset, or at 21:00, whichever comes first
trigger:
- platform: sun
event: sunset
- platform: time
at: '21:00:00'
action:
- service: cover.close_cover
entity_id: cover.kkken_rullegardiner
Yeah, that’s a better way to handle it. My only concern is the trigger to condition delay. If it’s under half a second delay does it resolve to <=? what’s the resolution on time? I don’t use traditional automation in HA so you could probably answer that.
If you look at how the “after” sun and time conditions are processed in this code, you’ll see that if the time when the condition is processed is greater than or equal to the value specified in the condition, the condition will evaluate to True. So it doesn’t require any delay. As soon as the trigger occurs, the corresponding condition will be true.