I have the following automation:
- id: '12'
alias: Simulate Presence Living Room
initial_state: True
trigger:
- platform: event
event_type: 'event_sp_main'
condition:
condition: and
conditions:
- condition: sun
after: sunset
- condition: time
after: '15:00:00'
before: '21:00:00'
- condition: state
entity_id: 'sensor.someone_home'
state: 'no'
action:
- delay: '00:{{ (range(15, 45) | random) }}:00'
- service: notify.telegram
data:
message: "Turning light on"
- service: light.turn_on
data:
entity_id: light.fibaro_system_fgd212_dimmer_2_level_5
brightness: 128
- wait_template: "{{ is_state('sensor.time', '22:00') }}"
- delay: '00:0{{ (range(5, 9) | random) }}:00'
- service: notify.telegram
data:
message: "Turning light off"
- service: light.turn_off
data:
entity_id: light.fibaro_system_fgd212_dimmer_2_level_5
I trigger event event_sp_main at different particular times and situations when we are not at home. One is on sunset and other one at different times.
I can see that at just after it triggers again much earlier than 22:00, the automation is in the wait_template step I receive the message on my phone that the lights are going to be turned off and when I arrive home they certainly are.
I cannot find anything in the documentation of what happens to an automation that triggers multiple times while it is running.
May someone help me understand if this is a bug or something I’m doing wrong?
Thank you in advance.