-
Notifications
You must be signed in to change notification settings - Fork 181
/
lights.yaml
164 lines (144 loc) · 4.41 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
---
alias: "Hall Lights"
description: >-
Controls the hall lights.
They mainly respond on motion; but also when the alarm arms.
id: "dae7c422-03ff-4ae6-a06d-65e4907872c1"
mode: queued
max_exceeded: silent
trace:
stored_traces: 25
trigger:
- platform: homeassistant
event: start
- platform: event
event_type:
- automation_reloaded
- scene_reloaded
- platform: state
entity_id:
- input_boolean.house_mode_away
- input_boolean.house_mode_cleaning
- input_boolean.house_mode_eco
- input_boolean.house_mode_sleep
- input_boolean.house_mode_guest
- sensor.hall_illuminance
- sensor.outside_illuminance
- binary_sensor.hall_motion
from: ~
variables:
anchors:
- &scene
service: scene.turn_on
data:
transition: 2.5
- &turn_off
alias: "Turn off all the hall lights"
service: light.turn_off
target:
area_id: hall
data:
transition: 5
- &condition_low_light
alias: "When light conditions are low"
or:
- alias: "When light from outside is low"
condition: numeric_state
entity_id: sensor.outside_illuminance
below: 500
- alias: "When light condition in the hall are low"
condition: numeric_state
entity_id: sensor.hall_illuminance
below: 50
- &choose_scene
choose:
- alias: "Activate hall sleep scene when in sleep mode"
conditions:
- alias: "When house is in sleep mode"
condition: state
entity_id: input_boolean.house_mode_sleep
state: "on"
sequence:
- alias: "Activate hall sleep scene"
<<: *scene
target:
entity_id: scene.hall_sleep
- alias: "Activate hall night scene when it's pitch-dark outside"
conditions:
- alias: "When it is pitch-dark outside"
condition: numeric_state
entity_id: sensor.outside_luminosity
below: 100
sequence:
- alias: "Activate hall night scene"
<<: *scene
target:
entity_id: scene.hall_night
- alias: "Activate hall sunrise/sunset scene otherwise"
conditions:
- *condition_low_light
sequence:
- if:
- alias: "Activate sunrise scene until the late aternoon"
condition: time
before: "15:00:00"
then:
- alias: "Activate hall sunrise scene"
<<: *scene
target:
entity_id: scene.hall_sunrise
else:
- alias: "Activate hall sunset scene"
<<: *scene
target:
entity_id: scene.hall_sunset
action:
- choose:
- alias: "Activate cleaning mode"
conditions:
- alias: "When cleaning mode is on"
condition: state
entity_id: input_boolean.house_mode_cleaning
state: "on"
sequence:
- alias: "Activate hall cleaning scene"
<<: *scene
target:
entity_id: scene.hall_cleaning
- alias: "Turn off when sleep or away mode is active"
conditions:
- condition: state
entity_id:
- input_boolean.house_mode_away
- input_boolean.house_mode_sleep
match: any
state: "on"
sequence:
- *turn_off
- alias: "Activate scene when motion is detected"
conditions:
- *condition_low_light
- alias: "When motion detector is on"
condition: state
entity_id: binary_sensor.hall_motion
state: "on"
sequence:
- *choose_scene
- alias: "When guest mode is active, keep lights on"
conditions:
- alias: "When house is in guest mode"
condition: state
entity_id: input_boolean.house_mode_guest
state: "on"
sequence:
- *choose_scene
- alias: "When house not in eco mode, keep lights on"
conditions:
- alias: "When house is not in "
condition: state
entity_id: input_boolean.house_mode_eco
state: "off"
sequence:
- *choose_scene
default:
- *turn_off