Tsar
(Christian)
January 18, 2022, 9:22am
1
I want my shutters up by sunrize, but not before a certain time but also at least at this certain time.
So I did this :
alias: Rolluiken 's morgens op
description: ''
trigger:
- platform: sun
event: sunrise
offset: '0'
- platform: time
at: input_datetime.tijdstip_rolluik_morgen
condition:
- condition: time
after: input_datetime.tijdstip_rolluik_morgen
action:
- service: script.rolluiken_automatisch_op
mode: single
But this means that in summer this willl cause a problem, cause when it goes off on the time of the helper the condition will never be ok (will be equal and not ‘after’).
So I have to create a template as condition, where the time of the trigger must be greater that the helper minus 1 second…but how do I do this ?
Hellis81
(Hellis81)
January 18, 2022, 10:17am
2
Have the condition as a template with:
{{ now() >= today_at(states('input_datetime.tijdstip_rolluik_morgen')) - timedelta(seconds=1) }}
Tsar
(Christian)
January 18, 2022, 10:27am
3
So simple…tried all other complicated things used in other topics…
We will see this summer if it works
Thanks !
alias: Rolluiken 's morgens op
description: ''
trigger:
- platform: sun
event: sunrise
- platform: time
at: input_datetime.tijdstip_rolluik_morgen
condition:
- condition: template
value_template: >-
{{ now() >= today_at(states('input_datetime.tijdstip_rolluik_morgen')) -
timedelta(seconds=1) }}
action:
- service: script.rolluiken_automatisch_op
mode: single
m0wlheld
(Christoph Dahlen)
January 18, 2022, 10:32am
4
So you want the covers to open upon sunrise, but not before a given time (let’s say 06:00h) and at latest at another given time (let’s say 08:00h)?
alias: Rolluiken 's morgens op
description: ''
trigger:
- platform: sun
event: sunrise
- platform: time
at: '08:00:00'
condition:
- condition: time
after: '06:00:00'
action:
- service: script.rolluiken_automatisch_op
mode: single
So,
if sunrise is before 06:00h, the condition will prevent the covers from being opened
if sunrise is after 08:00h, the time trigger will hit
if sunrise is anytime between 06:01h and 07:59h, the even will trigger opening
Recommendation: Add another condition, checking that the (or any) cover is still closed, to prevent opening requests to already opened covers.
Tsar
(Christian)
January 18, 2022, 10:37am
5
Thanks for your reaction, but I only have one time : at 08:00 or later (sunrise).
Hellis81
(Hellis81)
January 18, 2022, 10:42am
6
I was also confused about it at first.
But read it like this:
trigger:
- platform: time
at: input_datetime.tijdstip_rolluik_morgen
condition:
- condition: time
after: input_datetime.tijdstip_rolluik_morgen
So at datetime but condition says after datetime thus it won’t fire.
So the condition has to be one second before datetime (I would probably set it to one minute)
Tsar
(Christian)
January 19, 2022, 7:48am
7
I will have to add something… My covers went up at the time of the helper (08:15), but sun was not yet up (it was still dark).
So I now have added an extra condition :
alias: Rolluiken 's morgens op
description: ''
trigger:
- platform: sun
event: sunrise
- platform: time
at: input_datetime.tijdstip_rolluik_morgen
condition:
- condition: template
value_template: >-
{{ now() >= today_at(states('input_datetime.tijdstip_rolluik_morgen')) -
timedelta(seconds=1) }}
**- condition: sun**
** after: sunrise**
action:
- service: script.rolluiken_automatisch_op
mode: single
But will this not be a problem when this is triggered by sunrise : AT sunrize the trigger goes off, but condition is AFTER sunrize ?