Hi there,
I would like to integrate several window sensors into an automation, but have little knowledge of programming.
The following goal:
If a window is open for longer than 5 minutes, a voice output should indicate this. I will include every window as a trigger. The speech output should be general (i.e. the window does not have to be named precisely).
The voice output should then take place every 3 minutes (at most 4x) until there is no longer a window that has been open for more than 5 minutes.
I created the following automation (initially I only included two windows).
Here is my previous draft:
alias: Fensterwarnung
description: ''
trigger:
- type: opened
platform: device
device_id: a3b660743a3ade9f221523df6512bbe7
entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_19330507_on_off
domain: binary_sensor
for:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
- type: opened
platform: device
device_id: d8e8f30f98adcd2234289e599c98affc
entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_0005ff06_on_off
domain: binary_sensor
for:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
condition: []
action:
- repeat:
count: '4'
sequence:
- service: media_player.play_media
data:
media_content_id: amzn_sfx_doorbell_chime_01
media_content_type: sound
target:
entity_id:
- media_player.arbeitszimmer
- media_player.eva_s_bose_smart_soundbar_300
- media_player.bad
- media_player.terrasse
- media_player.workstatt
- service: notify.alexa_media
data:
message: >-
Eine oder mehrer Fenster sind schon länger geöffnet. Bitte wieder
schließen
target:
- media_player.workstatt
- media_player.terrasse
- media_player.moritz
- media_player.bad
- media_player.arbeitszimmer
- media_player.eva_s_bose_smart_soundbar_300
data:
type: tts
- delay:
hours: 0
minutes: 3
seconds: 0
milliseconds: 0
mode: single
My questions:
- How can I ensure that the automation ends when no more windows meet the condition (opened for at least 5 minutes)?
- How can I set the automation to only run from October to March?
Thank you very much, Werner