Hi,
I am trying to get the below to work. The first part works (holiday mode sequence Boolean - on) but it doesn’t turn off at 23:45:00 nor does the sunrise command work after.
Any ideas?
Thanks.
alias: Holiday Mode
description: ''
trigger:
- platform: sun
event: sunset
offset: '-1:00:00'
condition: []
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.holiday_mode_sequence
- wait_for_trigger:
- platform: time
at: '23:45'
- service: input_boolean.turn_off
target:
entity_id: input_boolean.holiday_mode_sequence
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- service: script.all_lighting_off
- wait_for_trigger:
- platform: sun
event: sunrise
offset: '-00:30:00'
- service: cover.open_cover
target:
entity_id:
- cover.kt_roller_blind
- cover.lr_curtains
- cover.mb_roller_blind
mode: single
Are there any errors in your log? Maybe insert some notifications between steps to be sure which steps you’re reaching.
I don’t immediately see a problem with the first wait_for_trigger
, but the second one won’t work, because I think you’re assuming this will be for the next sunrise, but it won’t. The sun integration gives values for the same day. You would need to use the sun2 integration. Personally, I wouldn’t have such a long-running automation, but make it a separate automation instead (which, for one, will survive possible restarts of your system).
2 Likes
I would use a Choose
action with multiple triggers. It helps prevent issues with restarts/reloads that your original would have due to the waits
, solves the sun.sun issue Pieter brought up, and keeps all the functions in one automation.
alias: Holiday Mode
description: ''
trigger:
- platform: sun
event: sunset
offset: '-1:00:00'
id: Sequence On
- platform: time
at: '23:45'
id: Sequence Off
- platform: sun
event: sunrise
offset: '-00:30:00'
id: Sunrise
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: Sequence On
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.holiday_mode_sequence
- conditions:
- condition: trigger
id: Sequence Off
sequence:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.holiday_mode_sequence
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- service: script.all_lighting_off
- conditions:
- condition: trigger
id: Sunrise
sequence:
- service: cover.open_cover
target:
entity_id:
- cover.kt_roller_blind
- cover.lr_curtains
- cover.mb_roller_blind
default: []
mode: single
2 Likes