forked from basnijholt/home-assistant-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaving_and_arriving.yaml
131 lines (126 loc) · 3.63 KB
/
leaving_and_arriving.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---
- 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"
- platform: time_pattern
hours: "/1"
condition:
- condition: state
entity_id: binary_sensor.someone_in_the_house_in_last_hour
state: "off"
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
- condition: state
entity_id: binary_sensor.anything_on
state: "on"
action:
- service: script.turn_off_everything
- service: notify.mobile_app_basnijholt_iphone
data:
title: "Leaving"
message: "Everything automatically turned off!"
- alias: "Leaving: ask to turn off everything"
initial_state: "on"
trigger:
- platform: state
entity_id: persons.bas
from: "home"
- platform: state
entity_id: persons.marcella
from: "home"
condition:
- condition: template
value_template: >
{{ not is_state("person.bas", "home")
and not is_state("person.marcella", "home") }}
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
- condition: state
entity_id: binary_sensor.anything_on
state: "on"
action:
service: notify.mobile_app_basnijholt_iphone
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.turn_off_everything
- alias: "Leaving: single click to turn off everything"
initial_state: "on"
trigger:
platform: event
event_type: deconz_event
event_data:
id: smart_switch_downstairs
event: 1002
action:
- service: light.turn_on
data:
flash: "short"
entity_id: light.stairs_down
- service: script.turn_off_everything_non_automatic
- service: notify.mobile_app_basnijholt_iphone
data:
title: "Leaving"
message: "Everything turned off, see you soon! ❤️"
- alias: "Arriving: double click to turn on music and cozy lights"
initial_state: "on"
trigger:
- platform: event
event_type: deconz_event
event_data:
id: smart_switch_downstairs
event: 1004
action:
- service: light.turn_on
entity_id: light.living_room_lights
data:
brightness: 100
- service: script.cozy_lights_living_room
- service: script.start_spotify
data_template:
source: LS50 Wireless
playlist: '{{ states("sensor.favorite_playlist_of_nearest_person") }}'
volume: 0.25
- alias: "Arriving: switch music from iPhone to speakers if no one is home"
trigger:
platform: state
entity_id: binary_sensor.openclose_front_door
from: "off"
to: "on"
condition:
- condition: state
entity_id: persons.marcella
state: not_home
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
- condition: template
value_template: >
{{ is_state_attr("media_player.spotify", "source", "basnijholt-iphone")
and is_state("media_player.spotify", "playing") }}
action:
- service: media_player.turn_on
entity_id: media_player.kef_ls50
- service: media_player.select_source
entity_id: media_player.kef_ls50
data:
source: Wifi
- service: media_player.select_source
entity_id: media_player.spotify
data:
source: LS50 Wireless