This is my automation, that’ll trigger some events after a door has been left open.
alias: Melding - Deuren te lang open
description: ''
trigger:
- platform: state
to: 'on'
for:
hours: 0
minutes: 0
seconds: 0
milliseconds: 0
from: 'off'
entity_id:
- binary_sensor.koelkast_vriezer_deur_contact
- binary_sensor.voordeur_deur_contact
- binary_sensor.achterdeur_deur_contact
condition: []
action:
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.koelkast_vriezer_deur_contact
state: 'on'
sequence:
- repeat:
while:
- condition: state
entity_id: binary_sensor.koelkast_vriezer_deur_contact
state: 'on'
sequence:
- service: notify.telegram
data:
title: WAARSCHUWING!!!
message: >-
Waarschuwing! De {{trigger.to_state.name}} staat al enige
tijd open.
- service: tts.cloud_say
data:
entity_id: media_player.woonkamer
message: >-
Waarschuwing! De {{trigger.to_state.name}} staat al enige
tijd open.
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- conditions:
- condition: state
entity_id: binary_sensor.voordeur_deur_contact
state: 'on'
sequence:
- repeat:
while:
- condition: state
entity_id: binary_sensor.voordeur_deur_contact
state: 'on'
sequence:
- service: notify.telegram
data:
title: WAARSCHUWING!!!
message: >-
Waarschuwing! De {{trigger.to_state.name}} staat al enige
tijd open.
- service: tts.cloud_say
data:
entity_id: media_player.woonkamer
message: >-
Waarschuwing! De {{trigger.to_state.name}} staat al enige
tijd open.
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- conditions:
- condition: state
entity_id: binary_sensor.achterdeur_deur_contact
state: 'on'
sequence:
- repeat:
while:
- condition: state
entity_id: binary_sensor.achterdeur_deur_contact
state: 'on'
sequence:
- service: notify.telegram
data:
title: WAARSCHUWING!!!
message: >-
Waarschuwing! De {{trigger.to_state.name}} staat al enige
tijd open.
- service: tts.cloud_say
data:
entity_id: media_player.woonkamer
message: >-
Waarschuwing! De {{trigger.to_state.name}} staat al enige
tijd open.
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
default: []
mode: single
But when I add:
- condition: template
value_template: '{{ repeat.index <= 5 }}'
or:
- condition: template
value_template: "{{ repeat.index <= 5 }}"
after:
- condition: state
entity_id: binary_sensor.koelkast_vriezer_deur_contact
state: 'on'
It won’t run the vriezer-path when I open the freezer to log, but it’ll run the default-path.
I think I’ve followed the example on Script Syntax documentation. The trace-functionality has provided me with enough help in dealing with other issues, but this I could not solve and any help would be appreciated.