Hello, I have an automation to notify me when my windows are open for too long.
It works pretty good but I’d like to do some improvements.
My automation so far:
alias: Close window notification (automatic)
description: ""
triggers:
- entity_id:
- binary_sensor.window_office_garden_left_contact
- binary_sensor.window_office_garden_right_contact
- binary_sensor.window_office_street_contact
- binary_sensor.window_bathroom_upstairs_contact
from: "off"
to: "on"
for: 0:{{ states('input_select.duration')|int }}:00
trigger: state
conditions: []
actions:
- data:
message: Fenster {{ trigger.from_state.name }} schliessen
title: Fenster schliessen
action: notify.notify
mode: single
I want to archieve failsafeness and I think I can get that with Timers.
But how can I dynamically spawn a Timer for each of the triggers? If I have to define a Timer manually then the automation would be quite complex I think because I need to check which entity triggers which Timer. Or I need to do an automation each window which is also not what I want. Is it possible to create timers during automation and destroy them when they served their purpose?
Thanks for you help