-
Notifications
You must be signed in to change notification settings - Fork 185
/
Copy pathleaving.yaml
99 lines (94 loc) · 2.56 KB
/
leaving.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
#-
# _ _
# | | ___ __ ___ _(_)_ __ __ _
# | |/ _ \/ _` \ \ / / | '_ \ / _` |
# | | __/ (_| |\ V /| | | | | (_| |
# |_|\___|\__,_| \_/ |_|_| |_|\__, |
# |___/
#
#- from github.com/basnijholt/home-assistant-config
- alias: "Leaving: automatically turn off everything"
initial_state: "on"
trigger:
- platform: state
entity_id: binary_sensor.someone_in_the_house_in_last_hour
from: "on"
to: "off"
for: "00:01:00"
- platform: time_pattern
hours: "/1"
condition:
- condition: state
entity_id:
- binary_sensor.no_one_home
- binary_sensor.anything_on
state: "on"
- condition: state
entity_id:
- binary_sensor.someone_in_the_house_in_last_hour
- input_boolean.guest_mode
state: "off"
action:
- service: script.leaving
- service: notify.all_iphones
data:
title: "Leaving"
message: "Everything automatically turned off!"
- alias: "Leaving: ask to turn off everything"
initial_state: "on"
trigger:
- platform: state
entity_id: person.bas
from: "home"
- platform: state
entity_id: person.marcella
from: "home"
condition:
- condition: state
entity_id:
- binary_sensor.no_one_home
- binary_sensor.anything_on
state: "on"
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
action:
- delay: "00:05:00" # something still needs to be on in 5 min
- condition: state
entity_id: binary_sensor.no_one_home
state: "on"
- service: notify.all_iphones
data:
message: "No one is home, turn off everything?"
data:
push:
category: turn_off_everything
- alias: "Leaving: turn off everything after notification"
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: TURN_OFF_EVERYTHING
action:
service: script.leaving
- alias: "Leaving: downstairs Aqara Wireless Mini Switch"
trigger:
platform: event
event_type: deconz_event
event_data:
id: smart_switch_downstairs
event: 1002 # single click
action:
- wait_for_trigger: # when the door closes, turn off everything
platform: state
entity_id: binary_sensor.openclose_front_door
from: "on"
to: "off"
timeout: "00:01:00"
continue_on_timeout: false
- service: script.turn_off_everything
- service: notify.all_iphones
data:
title: "Bye 👋"
message: "See you soon!"