I have an automation that is triggered with an contact sensor at my bath window.
It fires a tts message to my media devices if the window is open for 20min and if the temperature outside is below 15°C to rember me to close the window.
Now I’m struggeling with this because I want to loop this automation every 20min until I have closed the window.
I tried with the “repeat” condition.
But this worked only partly. It gets fired of again after 20min but then is ist consistantly messageing me and not waiting for another 20min.
alias: Fenster Bad test
description: ''
trigger:
- platform: state
entity_id: binary_sensor.homematic_ip_accesspoint_fensterkontakt_bad
to: 'on'
for:
hours: 0
minutes: 20
seconds: 0
condition:
- condition: numeric_state
entity_id: sensor.homematic_ip_accesspoint_temperatur_und_luftfeuchtigkeitssensor_balkon_temperature
below: 15
action:
- repeat:
while:
- condition: numeric_state
entity_id: sensor.homematic_ip_accesspoint_temperatur_und_luftfeuchtigkeitssensor_balkon_temperature
below: 15
- condition: state
entity_id: binary_sensor.homematic_ip_accesspoint_fensterkontakt_bad
state: 'on'
sequence:
- service: notify.alexa_media_uberall
data:
message: Das Fenster im Bad ist offen.
data:
type: announce
method: speak
- delay:
minutes: 20
mode: single
This will announce every 20 minutes while the window is open and the temperature is below 15. If either of those states change (window closed, or temperature becomes 15 or more) the announcements will stop.
Thank you!
I knew I couldn’t be far away from the solution
If the announcements are stopped according to state change of temperatur (above 15, window is still open), they will start again when temperature is again below 15 (if window was not closed of course).
Right?
Thats what I was looking for.
Hmm. No. There is only one trigger, and that’s the window. To do that you would have to add another trigger and condition:
alias: Fenster Bad test
description: ''
trigger:
- platform: state
entity_id: binary_sensor.homematic_ip_accesspoint_fensterkontakt_bad
to: 'on'
for:
hours: 0
minutes: 20
seconds: 0
- platform: numeric_state
entity_id: sensor.homematic_ip_accesspoint_temperatur_und_luftfeuchtigkeitssensor_balkon_temperature
below: '15'
for:
hours: 0
minutes: 20
seconds: 0
condition:
- condition: state
entity_id: binary_sensor.homematic_ip_accesspoint_fensterkontakt_bad
state: 'on'
- condition: numeric_state
entity_id: sensor.homematic_ip_accesspoint_temperatur_und_luftfeuchtigkeitssensor_balkon_temperature
below: '15'
action:
- repeat:
while:
- condition: numeric_state
entity_id: sensor.homematic_ip_accesspoint_temperatur_und_luftfeuchtigkeitssensor_balkon_temperature
below: 15
- condition: state
entity_id: binary_sensor.homematic_ip_accesspoint_fensterkontakt_bad
state: 'on'
sequence:
- service: notify.alexa_media_uberall
data:
message: Das Fenster im Bad ist offen.
data:
type: announce
method: speak
- delay:
minutes: 20
mode: single
I’ve made the temperature trigger be below 15 for 20 minutes to prevent multiple announcements more often than every 20 minutes if the temperature is fluctuating around 15 degrees. You can reduce this time if you want to be notified more promptly.