When there is a power outage and the power resumes after the start time and within the event duration, the automation does not work. How can i modify the code, very new to YAML. Thanks in advance.
alias: gate light
description: ""
triggers:
- trigger: calendar
event: start
entity_id: calendar.lighting_calendar - trigger: calendar
event: end
entity_id: calendar.lighting_calendar
conditions: - condition: template
value_template: "{{ 'Gate Lights' in trigger.calendar_event.summary }}"
actions: - if:
- condition: template
value_template: "{{ trigger.event == 'start' }}"
then: - action: switch.turn_on
target:
entity_id: switch.outdoor_lights_2_switch_2
data: {} - action: persistent_notification.create
data:
title: gate lights
message: switched on
notification_id: "10"
else: - action: switch.turn_off
target:
entity_id: switch.outdoor_lights_2_switch_2
data: {}
mode: single
- condition: template