-
Notifications
You must be signed in to change notification settings - Fork 1
/
lights.yaml
executable file
·174 lines (151 loc) · 4.2 KB
/
lights.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
---
alias: areas_livingroom_lights
description: Turns the livingroom lights on when motion has been detected
mode: queued
id: c2c13dd9-a81c-4b44-a20e-990c460f9347
trace:
stored_traces: 25
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: state
entity_id:
- input_boolean.setting_manual_lights
- binary_sensor.livingroom_is_dark
from: ~
for:
seconds: 2
- platform: state
entity_id:
- binary_sensor.livingroom_is_media_playing
for:
seconds: 10
- platform: state
entity_id:
- media_player.living_room_android
to: "off"
- platform: state
entity_id:
- binary_sensor.presence_livingroom
to: "on"
- platform: state
entity_id:
- binary_sensor.presence_livingroom
to: "off"
for:
minutes: 10
- platform: device
device_id: 063e0720e7172ed87824f117033874a5
domain: hue
type: short_release
subtype: 1
unique_id: a9f5c750-a2cb-4924-b041-022f32291224
id: "hue_dimmer_on_press"
- platform: device
device_id: 063e0720e7172ed87824f117033874a5
domain: hue
type: short_release
subtype: 4
unique_id: fd5ce233-c55e-449a-9c81-d55fc8078f03
id: "hue_dimmer_off_press"
- platform: time
at: "00:03:00"
id: "reset"
variables:
anchors:
- &condition_is_presence_detected
alias: "Is there presence in the room?"
condition: not
conditions:
- condition: state
entity_id: binary_sensor.presence_livingroom
state: "off"
for:
minutes: 10
- &condition_is_dark
alias: "Is it dark in the living room?"
condition: state
entity_id: binary_sensor.livingroom_is_dark
state: "on"
- &condition_is_remote_quickly_pressed
alias: "Did we manually press the button?"
condition: trigger
id:
- "hue_dimmer_on_press"
- "hue_dimmer_off_press"
- &condition_is_current_scene
alias: "Check the current light scene"
condition: state
entity_id: input_select.livingroom_current_lights_scene
- &condition_watching_tv
alias: "Check if we are watching a movie or series"
condition: state
entity_id: binary_sensor.livingroom_is_media_playing
state: "on"
- &turn_off
alias: "Turn the lights off"
service: light.turn_off
target:
entity_id:
- light.livingroom
- light.kitchen
data:
transition: 5
- &turn_on
alias: "Turn on the lights"
service: scene.turn_on
data:
transition: 5
condition:
- condition: state
entity_id: input_boolean.setting_manual_lights
state: "off"
action:
- choose:
- alias: "Reset active scene to 'normal' during reset"
conditions:
- condition: trigger
id: "reset"
sequence:
- service: input_select.select_option
entity_id: input_select.livingroom_current_lights_scene
data:
option: normal
- alias: "Capture manual scene control via Hue remote"
conditions:
- *condition_is_remote_quickly_pressed
- *condition_is_dark
sequence:
- if:
- <<: *condition_is_current_scene
state: "movie"
then:
- <<: *turn_on
target:
entity_id: scene.livingroom_lights_natuurlijklicht
else:
- <<: *turn_on
target:
entity_id: scene.livingroom_lights_movie
- alias: >
"Toggle movie scene on single button press or when somethings starts playing"
conditions:
- *condition_is_dark
- *condition_is_presence_detected
- *condition_watching_tv
sequence:
- <<: *turn_on
target:
entity_id: scene.livingroom_lights_movie
- alias: "Just turn on the lights."
conditions:
- *condition_is_dark
- *condition_is_presence_detected
sequence:
- <<: *turn_on
target:
entity_id: scene.livingroom_lights_natuurlijklicht
default:
- *turn_off