@ochstobi wrote:
Hello,
I have an automation to remind me to close my window. At the moment I have a switch and a timer, which I turn on and after some minutes the app is sending me a notification to close my window.
Now I have ordered some window contacts and I want to make this automation dynamic. Lets say I have multiple window contacts. And if one changes their states the app should send me a notification with the window friendly name or something like that.I think the scenario above is inly working for one contact. So I thought about something like “threading” because if a second contact would trigger the automation the timer would reset, i think.
Do someone has a clue how to do this?
This is my config, I have placed an yaml file under packages:
# Timer for open windows (900 sec = 15 min) timer: window_open: name: Time remaining (Window) duration: 900 # Switch for open window switch: - platform: mqtt name: "Window open" state_topic: "zigbee2mqtt/bridge/config/open_window" command_topic: "zigbee2mqtt/bridge/config/open_window" payload_on: "true" payload_off: "false" automation: # Automation to start timer when window is open - id: window_open alias: Window open trigger: platform: state entity_id: switch.window_open to: "on" action: service: timer.start entity_id: timer.window_open # Automation to stop timer when timer finished - id: close_window_nofitication alias: Notification for open window trigger: - platform: event event_type: timer.finished event_data: entity_id: timer.window_open action: - service: timer.cancel data: entity_id: timer.window_open - service: switch.turn_off entity_id: switch.window_open - service: notify.notify data: message: "Fenster schliessen" title: "Fenster schliessen"
Posts: 4
Participants: 3