I am looking into automation of the windows if all users leave home.
The idea is:
Users leave home (works)
Notification with text “windows will close in 5 minues” and action “prevent windows from clsoing” (works)
if mobile event was fired → prevent windows from closing
I am struggling with the last step.
If it is pressed I can run something like open windows but how can I do it so the windows will close after 5 minutes only if the notification action was not pressed?
I would probably use a boolean.
This automation sets a boolean to off first, then sends the notification.
Delay 5 minutes.
The notification command sets the boolean to on.
Add a condition after the delay to check the boolean
Close window
after that I can do an action but the problem is if I set to continue on timeout it will always do the next action.
I dont understand how I can attach an action only to the wait for trigger /fire event and continue without doing thhat attached action
I would do it like this.
Two automations, one that triggers when family leaves and one on the mobile event.
alias: Question_CloseWindows
description: ""
trigger:
- platform: state
entity_id:
- group.groupfamily
to: not_home
for:
hours: 0
minutes: 0
seconds: 3
condition:
- condition: or
conditions:
- condition: state
entity_id: cover.velux_window_roof_window_2
state: open
- condition: state
entity_id: cover.velux_window_roof_window_4
state: open
- condition: state
entity_id: cover.velux_window_roof_window
state: open
- condition: state
entity_id: cover.velux_window_roof_window_3
state: open
- condition: state
entity_id: cover.velux_window_roof_window_6
state: open
- condition: state
entity_id: cover.velux_window_roof_window_5
state: open
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.bwindows_open
- service: notify.notify
data:
message: Windos will close in 5 Minutes.
data:
actions:
- action: DoNotClose_Windows
title: Do not close Windows
title: Windows are still open
- delay: "00:05:00"
- condition: state
entity_id: input_boolean.bwindows_open
state: "on"
- parallel:
- if:
- condition: and
conditions:
- condition: state
entity_id: cover.velux_window_roof_window_2
state: closed
- condition: state
entity_id: cover.velux_window_roof_window_4
state: closed
- condition: state
entity_id: cover.velux_window_roof_window
state: closed
- condition: state
entity_id: cover.velux_window_roof_window_3
state: closed
- condition: state
entity_id: cover.velux_window_roof_window_6
state: closed
- condition: state
entity_id: cover.velux_window_roof_window_5
state: closed
then:
- service: notify.notify
data:
title: Windows Closed
message: All Windows were Closed
else:
- service: notify.notify
data:
title: Windows Closed
message: All Windows were Closed
- service: cover.open_cover
data: {}
target:
entity_id:
- cover.velux_window_roof_window_2
- cover.velux_window_roof_window_4
- cover.velux_window_roof_window
- cover.velux_window_roof_window_3
- cover.velux_window_roof_window_5
- cover.velux_window_roof_window_6
mode: single