-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguirlande-a-bouboules.yaml
315 lines (301 loc) · 8.44 KB
/
guirlande-a-bouboules.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
---
# Branchements
# ------------
#
# GPIO27 : prise 1 - rouge et orange
# GPIO26 : prise 1 - vert et bleu
# GPIO25 : prise 2 - rouge et orange
# GPIO33 : prise 2 - vert et bleu
#
# GPIO32 : led sur interrupteur
# GPIO14 : interrupteur
substitutions:
devicename: guirlande-a-bouboules
upper_devicename: Guirlande a bouboules
packages:
device_base: !include common/device_base.yaml
device_esp32: !include common/device_esp32.yaml
esphome:
name_add_mac_suffix: false
on_boot:
priority: 600
then:
- light.turn_on:
id: button_led
brightness: 100%
- light.turn_on:
id: guirlande1
effect: &effet_par_defaut_ch1 "Bip bip 1"
- light.turn_on:
id: guirlande2
effect: &effet_par_defaut_ch2 "Arc-en-ciel"
esp32:
board: az-delivery-devkit-v4
framework:
type: esp-idf
logger:
level: INFO
#level: DEBUG
#level: VERBOSE
#level: VERY_VERBOSE
#logs:
# scheduler: INFO
wifi:
manual_ip:
# pour une connection rapide, et pour que le conteneur docker esphome puisse trouver l'ESP sans mDNS
static_ip: 192.168.1.186
gateway: 192.168.1.1
subnet: 255.255.255.0
## Device-specific
preferences:
flash_write_interval: 10min
interval:
- interval: 1s
then:
- if:
condition:
or:
- light.is_on: guirlande1
- light.is_on: guirlande2
then:
- if:
condition:
light.is_off: button_led
then:
- logger.log: "button is OFF, turning ON"
- light.turn_on:
id: button_led
transition_length: 0.1s
brightness: 100%
else:
- if:
condition:
light.is_on: button_led
then:
- logger.log: "button is ON, turning OFF"
- light.turn_off:
id: button_led
# doit etre inférieur a l'intervalle de cette séquence, sinon light.is_on toujours vrai
transition_length: 0.1s
# inspiration : https://github.com/esphome/feature-requests/issues/2501
output:
- platform: ledc
id: channel1_pin1
pin:
number: 27
channel: 0
max_power: 50%
phase_angle: 180
- platform: ledc
id: channel1_pin2
pin: 26
channel: 1
max_power: 50%
- platform: ledc
id: channel2_pin1
pin:
number: 25
channel: 4
max_power: 50%
phase_angle: 180
- platform: ledc
id: channel2_pin2
pin: 33
channel: 5
max_power: 50%
- platform: ledc
id: push_button_led
pin: 32
channel: 2
light:
- platform: status_led
internal: true
id: status_led_shared
output: push_button_led
- platform: monochromatic
name: "LED sur interrupteur"
id: button_led
output: push_button_led
- platform: cwww
name: "Guirlande 1"
id: guirlande1
cold_white: channel1_pin1
warm_white: channel1_pin2
cold_white_color_temperature: &cold 0 Mireds
warm_white_color_temperature: &warm 500 Mireds
effects: &effects
- strobe:
name: "Arc-en-ciel"
colors:
- duration: 10s
transition_length: 2s
cold_white: 100%
warm_white: 100%
- duration: 1s
transition_length: 0.2s
cold_white: 100%
warm_white: 20%
- duration: 10s
transition_length: 2s
cold_white: 100%
warm_white: 100%
- duration: 1s
transition_length: 0.2s
cold_white: 20%
warm_white: 100%
- flicker:
name: "Scintillement profond"
alpha: 50%
intensity: 50%
- flicker:
name: "Scintillement léger"
alpha: 80%
intensity: 10%
- random:
name: "Aléatoire lent"
transition_length: 1s
update_interval: 2s
- random:
name: "Aléatoire moyen"
transition_length: 0.4s
update_interval: 0.4s
- random:
name: "Aléatoire rapide"
transition_length: 0.1s
update_interval: 0.1s
- random:
name: "Aléatoire énervé"
transition_length: 0.02s
update_interval: 0.02s
- strobe:
name: "Alternance lente"
colors:
- duration: 7s
transition_length: 5s
warm_white: 100%
cold_white: 20%
- duration: 7s
transition_length: 5s
warm_white: 20%
cold_white: 100%
- strobe:
name: "Alternance rapide"
colors:
- duration: 3s
transition_length: 0.5s
warm_white: 100%
cold_white: 20%
- duration: 3s
transition_length: 0.5s
warm_white: 20%
cold_white: 100%
- strobe:
name: "Alternance très rapide"
colors:
- duration: 0.5s
transition_length: 0.1s
warm_white: 100%
cold_white: 20%
- duration: 0.5s
transition_length: 0.1s
warm_white: 20%
cold_white: 100%
- automation:
name: "Bip bip 1"
sequence:
- repeat:
count: 5
then:
- light.turn_on:
id: guirlande1
transition_length: 0.1s
warm_white: 100%
cold_white: 20%
- delay: 1s
- light.turn_on:
id: guirlande1
transition_length: 0.1s
warm_white: 20%
cold_white: 100%
- delay: 1s
- repeat:
count: 20
then:
- light.turn_on:
id: guirlande1
transition_length: 0.2s
warm_white: 100%
cold_white: 20%
- delay: 0.3s
- light.turn_on:
id: guirlande1
transition_length: 0.2s
warm_white: 20%
cold_white: 100%
- delay: 0.3s
- repeat:
count: 50
then:
- light.turn_on:
id: guirlande1
transition_length: 0.1s
warm_white: 100%
cold_white: 20%
- delay: 0.1s
- light.turn_on:
id: guirlande1
transition_length: 0.1s
warm_white: 100%
cold_white: 100%
- delay: 0.1s
- light.turn_on:
id: guirlande1
transition_length: 0.1s
warm_white: 20%
cold_white: 100%
- delay: 0.1s
- light.turn_on:
id: guirlande1
transition_length: 0.1s
warm_white: 100%
cold_white: 100%
- delay: 0.1s
- platform: cwww
name: "Guirlande 2"
id: guirlande2
cold_white: channel2_pin1
warm_white: channel2_pin2
cold_white_color_temperature: *cold
warm_white_color_temperature: *warm
effects: *effects
binary_sensor:
- platform: gpio
pin:
number: 14
inverted: true # interrupteur NC
mode:
input: true
pulldown: true # l'interrupteur apporte le +3.3V en NC
# et flottant quand appuyé, donc besoin
# d'un pull-down pour amener à 0V
name: "Interrupteur"
filters:
- delayed_off: 10ms
on_press:
then:
- if:
condition:
light.is_off: button_led
then:
- light.turn_on:
id: guirlande1
effect: *effet_par_defaut_ch1
- light.turn_on:
id: guirlande2
effect: *effet_par_defaut_ch2
else:
- light.turn_off:
id: guirlande1
- light.turn_off:
id: guirlande2
- light.toggle: button_led