I’m trying to combine a couple of automations that are based on hardcoded times:
- id: sonos_door_and_windows_triggers_autodisable
alias: Sonos Door and Window Triggers AutoDisable
initial_state: true
trigger:
- platform: time
at: '06:51:00'
- platform: time
at: '07:30:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
action:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.event.data.state == '06:51:00' }}"
sequence:
- service: automation.turn_off
entity_id: automation.sonos_alert_on_door_triggers, automation.sonos_alert_on_window_triggers, automation.sonos_alert_on_exterior_doors_stuck_open
- service: climate.turn_off
entity_id: climate.hallway
- conditions:
- condition: template
value_template: "{{ trigger.event.data.state == '07:30:00' }}"
sequence:
- service: automation.turn_on
entity_id: automation.sonos_alert_on_door_triggers, automation.sonos_alert_on_window_triggers, automation.sonos_alert_on_exterior_doors_stuck_open
default:
- service: notify.vapid
data:
message: "Sonos autodisable is on but landed in default anyway. {{ states('sensor.time') }}"
title: Sonos Autodisable
data:
tag: sonos_autodisable
Every time it runs, I end up in the default
clause. I tried to put the trigger.event.data.state
into the default message that gets sent to me but it errored out saying that the trigger object was undefined
in the log files when the automation triggered.
When I ran it like it is defined, the message I got on my phone said 06:50! I might have expected a time after the trigger but before??
I also tried using value_templates without seconds and I still landed on the default clause:
value_template: "{{ trigger.event.data.state == '07:30' }}"
Is there a way to use the new automation choose with a time trigger?