forked from soffes/hue
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.yml
409 lines (397 loc) · 14.6 KB
/
config.yml
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
<%-
def color_step(steps); ((((90.0 / 360.0) * 65536) * steps) % 65536).round; end
def random_color(steps); Random.rand(65536); end
base_hue = 50_000
hue_spread = 2_000
min_hue = base_hue - hue_spread
max_hue = base_hue + hue_spread
shared_sweep_transition = 0.0
shared_sweep_wait = 2.0
-%>
---
# The username for the Philips Hue Bridge(s). You can either create one and
# set it here, or obtain generated ones and set them below.
common_username: &common_username "1234567890"
# The `max_connects` variable controls request concurrency when talking to each bridge. This is
# an important number in light of rate limits!
max_connects: 3
bridges:
# List all of your Philips Hue Bridge(s) here. We do this instead of dynamic discovery to
# facilitate quick startup and not getting hung up if discovery gets flaky.
#
# To find bridges, use bin/sm-discover-bridges, or as a fallback, nmap your LAN's subnet.
#
# Groups: The name is used further down but need not actually match the name as the bridge knows
# it. The number is a group ID on the bridge.
"Bridge-01":
id: "0017881226f3"
ip: "192.168.2.6"
username: *common_username
debug_hue: <%= color_step(0) %>
groups:
Accent: 2
AccentMain: 5 # All lights from Accent and Main
Dance: 4
Main: 1
White: 3
"Bridge-02":
id: "001788105eda"
ip: "192.168.2.8"
username: *common_username
debug_hue: <%= color_step(1) %>
groups:
Accent: 2
AccentMain: 5 # All lights from Accent and Main
Dance: 4
Main: 1
White: 3
"Bridge-03":
id: "0017881853d0"
ip: "192.168.2.3"
username: *common_username
debug_hue: <%= color_step(2) %>
groups:
Accent: 3
AccentMain: 4 # All lights from Accent and Main
Dance: 1
Main: 2
"Bridge-04":
id: "0017881a1d5c"
ip: "192.168.2.4"
username: *common_username
debug_hue: <%= color_step(3) %>
groups:
Accent: 3
AccentMain: 4 # All lights from Accent and Main
Dance: 2
Main: 1
light_groups:
# Groups of lights for different purposes. The groups are, at present, magical and special!
# * `bin/sm-mark-lights` will create a progression of brightness across lights in a group, and
# will run over all groups.
# * `bin/sm-simulate` will use groups as follows:
# * `main_lights`: Simulation.
# * `food_lights`: Separate group-addressed brightness control.
#
# The numeric portion is the ID as *assigned by the Philips Hue Bridge*.
#
# Main Lights is the group for which the main simulation will be applied. It can be any number of
# lights from any number of bridges but you'll need to plan groups out for saturation controls.
main_lights:
- ["Bridge-01", 26, color] # 0 --\
- ["Bridge-01", 37, color] # 1 |
- ["Bridge-01", 36, color] # 2 |
- ["Bridge-01", 38, color] # 3 +-- Strand 1, Group 2
- ["Bridge-01", 39, color] # 4 |
- ["Bridge-01", 40, color] # 5 |
- ["Bridge-01", 35, color] # 6 --/
- ["Bridge-02", 12, color] # 7 --\
- ["Bridge-02", 21, color] # 8 |
- ["Bridge-02", 20, color] # 9 |
- ["Bridge-02", 19, color] # 10 +-- Strand 1, Group 2
- ["Bridge-02", 15, color] # 11 |
- ["Bridge-02", 18, color] # 12 |
- ["Bridge-02", 11, color] # 13 --/
- ["Bridge-03", 7, color] # 14 --\
- ["Bridge-03", 2, color] # 15 |
- ["Bridge-03", 3, color] # 16 |
- ["Bridge-03", 8, color] # 17 +-- Strand 2, Group 1
- ["Bridge-03", 10, color] # 18 |
- ["Bridge-03", 9, color] # 19 |
- ["Bridge-03", 6, color] # 20 --/
- ["Bridge-04", 7, color] # 21 --\
- ["Bridge-04", 11, color] # 22 |
- ["Bridge-04", 12, color] # 23 |
- ["Bridge-04", 1, color] # 24 +-- Strand 2, Group 2
- ["Bridge-04", 9, color] # 25 |
- ["Bridge-04", 8, color] # 26 |
- ["Bridge-04", 5, color] # 27 --/
- ["Bridge-01", 41, color] # 28 --\
- ["Bridge-01", 42, color] # 29 |
- ["Bridge-02", 22, color] # 30 |
- ["Bridge-02", 23, color] # 31 +-- Dance Floor
- ["Bridge-03", 11, color] # 32 |
- ["Bridge-03", 12, color] # 33 |
- ["Bridge-04", 13, color] # 34 |
- ["Bridge-04", 14, color] # 35 --/
# Accent lights are just... other lights in the system. Not part of any simulation, they get
# their base color and that's it. They *are* affected by sweepers and saturation as we refer to
# the `AccentMain` groups in the relevant config blocks.
accent_lights:
- ["Bridge-01", 9, color]
- ["Bridge-01", 10, color]
- ["Bridge-01", 11, color]
- ["Bridge-01", 12, color]
# - ["Bridge-01", 13, color]
# - ["Bridge-01", 33, color]
# - ["Bridge-01", 34, color]
- ["Bridge-02", 7, color]
- ["Bridge-02", 8, color]
- ["Bridge-02", 24, color]
- ["Bridge-03", 13, color]
- ["Bridge-04", 15, color]
food_lights:
# TODO: Allow specifying both a group ID and individual light IDs. While we're at it, break
# TODO: this out into a separate file, and use it as a cache -- with a way to regenerate from
# TODO: the lights, and/or apply it to the lights.
- ["Bridge-01", 3, white]
- ["Bridge-01", 4, white]
- ["Bridge-01", 5, white]
- ["Bridge-01", 16, white]
- ["Bridge-01", 24, white]
- ["Bridge-01", 25, white]
- ["Bridge-02", 4, white]
- ["Bridge-02", 5, white]
- ["Bridge-02", 6, white]
initial_state:
# This defines what state the lights will be set to when running `bin/sm-on`.
# It's important you run `bin/sm-on` *before* running `sparkle-motion`, as the
# latter makes no attempt to actually switch lights on, or bring them into
# a desired baseline state -- it merely assumes that they're in decent shape.
hue: <%= base_hue %>
# Also, the values here are the values that the accent lights will hold for the whole evening,
# with the exception that saturation can be overridden of course.
sat: 255
bri: 63
# These are meta-configuration defining the color-swirl effects, per group. They exist solely to
# be referenced in the `sweepers` section.
color_configs:
strand1_1:
wedding: &strand1_1_wedding
- <%= base_hue %>
- <%= min_hue %>
- <%= base_hue %>
- <%= max_hue %>
debug: &strand1_1_debug
- <%= random_color(0) %>
- <%= random_color(1) %>
- <%= random_color(2) %>
- <%= random_color(3) %>
- <%= random_color(4) %>
- <%= random_color(5) %>
- <%= random_color(6) %>
- <%= random_color(7) %>
strand1_2:
wedding: &strand1_2_wedding
- <%= min_hue %>
- <%= base_hue %>
- <%= max_hue %>
- <%= base_hue %>
debug: &strand1_2_debug
- <%= random_color(1) %>
- <%= random_color(2) %>
- <%= random_color(3) %>
- <%= random_color(4) %>
- <%= random_color(5) %>
- <%= random_color(6) %>
- <%= random_color(7) %>
- <%= random_color(8) %>
strand2_1:
wedding: &strand2_1_wedding
- <%= base_hue %>
- <%= max_hue %>
- <%= base_hue %>
- <%= min_hue %>
debug: &strand2_1_debug
- <%= random_color(2) %>
- <%= random_color(3) %>
- <%= random_color(4) %>
- <%= random_color(5) %>
- <%= random_color(6) %>
- <%= random_color(7) %>
- <%= random_color(8) %>
- <%= random_color(9) %>
strand2_2:
wedding: &strand2_2_wedding
- <%= max_hue %>
- <%= base_hue %>
- <%= min_hue %>
- <%= base_hue %>
debug: &strand2_2_debug
- <%= random_color(3) %>
- <%= random_color(4) %>
- <%= random_color(5) %>
- <%= random_color(6) %>
- <%= random_color(7) %>
- <%= random_color(8) %>
- <%= random_color(9) %>
- <%= random_color(10) %>
dance:
wedding: &dance_wedding
- <%= max_hue %>
- <%= min_hue %>
- <%= base_hue %>
- <%= min_hue %>
debug: &dance_debug
- <%= random_color(4) %>
- <%= random_color(5) %>
- <%= random_color(6) %>
- <%= random_color(7) %>
- <%= random_color(8) %>
- <%= random_color(9) %>
- <%= random_color(10) %>
- <%= random_color(11) %>
# This defines individual sweepers. Each is comprised of a list of colors, the time taken (in
# seconds) LERPing from color to color, and the time to wait between steps.
# WARNING: Don't set wait much below 1.0! ZigBee spec only allows 1 group update/sec, but Hue
# Bridge/lights seem to be *mostly* OK with about 1 every 0.75 sec. Further, I don't do any
# gating / scheduling to prevent you from going too fast so you can easily overwhelm the bridge!
# If you see a lot of failed requests, you're hitting rate limits and need to throttle things a
# bit!
sweepers:
- name: "Strand1Group1"
targets:
- [Bridge-01, AccentMain]
transition: <%= shared_sweep_transition %>
wait: <%= shared_sweep_wait %>
values: *strand1_1_wedding
- name: "Strand1Group2"
targets:
- [Bridge-02, AccentMain]
transition: <%= shared_sweep_transition %>
wait: <%= shared_sweep_wait %>
values: *strand1_2_wedding
- name: "Strand2Group1"
targets:
- [Bridge-03, AccentMain]
transition: <%= shared_sweep_transition %>
wait: <%= shared_sweep_wait %>
values: *strand2_1_wedding
- name: "Strand2Group2"
targets:
- [Bridge-04, AccentMain]
transition: <%= shared_sweep_transition %>
wait: <%= shared_sweep_wait %>
values: *strand2_2_wedding
- name: "Dance"
targets:
- [Bridge-01, Dance]
- [Bridge-02, Dance]
- [Bridge-03, Dance]
- [Bridge-04, Dance]
# Note that dance lights get their own separate schedule!
transition: 0.1
wait: 1.0
values: *dance_wedding
controls:
food_area:
transition: 0.5
position: [7, 2]
groups:
- [Bridge-01, White]
- [Bridge-02, White]
values:
- 0.0
- 0.2
- 0.4
- 0.6
- 0.8
- 1.0
exit:
# Position is which of the control buttons to use for the kick-in-the-head function.
position: mixer
intensity:
# Brightness (intensity) controls. The size of the `values` array defines the height of the
# widgets, so leave room for one button per value when you compute your `y` coordinates!
positions:
- [0, 2]
- [1, 2]
- [2, 2]
- [3, 2]
- [5, 2]
lights:
# These are LOGICAL indexes of lights, not light IDs as assigned by the Hue Bridges!
- [ 0, 1, 2, 3, 4, 5, 6] # Strand 1, Group 1 (Bridge 1)
- [ 7, 8, 9, 10, 11, 12, 13] # Strand 1, Group 2 (Bridge 2)
- [14, 15, 16, 17, 18, 19, 20] # Strand 2, Group 1 (Bridge 3)
- [21, 22, 23, 24, 25, 26, 27] # Strand 2, Group 2 (Bridge 4)
- [28, 29, 30, 31, 32, 33, 34, 35] # Dance Lights (Bridge 1..4)
values:
# [Mid-point, delta]. Brightness varies from `mid-point - delta`..`mid-point + delta`.
# - [0.000, 0.000]
- [0.250, 0.075]
- [0.350, 0.100]
- [0.450, 0.150]
- [0.550, 0.175]
- [0.650, 0.200]
- [0.800, 0.200]
saturation:
# Desaturation controller. As above, the `size` defines the height/width of the control.
#
# Transition time is how quickly to transition the saturation. I suggest not going too
# quickly because while the saturation is updated en masse via group update, the brightness
# is done per-bulb in the main rendering loop -- and you probably don't want to blind
# everyone during the transition!
transition: 0.5
positions:
- up
- down
- left
- right
- user1
positions_no: # Positions on the Numark Orbit controller.
- [0, 3]
- [1, 3]
- [2, 3]
- [3, 3]
- [0, 0]
# This defines which Hue Bridge, and which group on that bridge a control affects. It would
# be nonsensical if this didn't correspond to the arrangement of lights for the intensity
# controls, so be sure that they match!
groups:
- - ["Bridge-01", "AccentMain"]
- - ["Bridge-02", "AccentMain"]
- - ["Bridge-03", "Main"]
- - ["Bridge-04", "Main"]
- - ["Bridge-01", "Dance"]
- ["Bridge-02", "Dance"]
- ["Bridge-03", "Dance"]
- ["Bridge-04", "Dance"]
values:
# Values are [saturation, max-brightness] -- null means "don't clamp brightness":
- [0.2, 0.20]
# - [0.4, 0.10]
# - [0.6, 0.30]
# - [0.8, 0.70]
- [1.0, null]
spotlighting:
# This defines the spotlighting effect. The width and height of the
# widget are defined by the `mappings` configuration. The choice of
# widget class is not configurable because at the moment there's only
# one option that will work.
position: [0, 0]
base: 0.9
exponent: 2
mappings:
# NOTE: Values are indexes into main_lights array.
#
# Excluding outermost lights because they extend beyond the seating area.
# This configuration gives two rows, one corresponding to each of the two
# light strands I'm putting up.
#
# TODO: Automatically suss out lights by using padding / widget size settings and spreading
# TODO: across the simulations.
#
# Bridge 3/4:
- [15, 18, 19, 20, 21, 22, 23, 24]
# Bridge 1/2:
- [ 3, 4, 5, 6, 7, 8, 9, 10]
# TODO: Reallocate accent lights.
# TODO: Either break white lights up across bridges, or consolidate them to Bridge-01 -- I'm... not really sure which.
# TODO: Brightness controls for eating lights.
# TODO: X/Y mapping of lights vs. simulation.
# TODO: Is time Z, or do we still slide across X?
# TODO: Rearrange lights to evenly disperse A19s.
# TODO: Document bunching configuration on physical deployment.
# TODO: Document on-site validation process, including testing of all spotlighting positions.
# TODO: Document DHCP setup and use of nmap in case I forget Minbar again!!
# TODO: Group all writes to a particular bridge into a single thread.
# TODO: Either self-tune delays, or avoid sending refreshes to each light/group too fast?
# TODO: Play with X multiplier for Perlin component to see if that makes the lighting more visually interesting.
# TODO: Way to tweak output transition time on the fly? Maybe make this part of the intensity?
# TODO: Way to tweak sweep transition time on the fly? Maybe make this part of the intensity?
# TODO: De-duplicate the command queue before running it, and run it in a reliable way (E.G. retries with backoff)
# TODO: If multiple entries exist in-queue for a bridge/group, collapse them together.
# TODO: Finish simulation visualization tool. (Needs debugging!)
# TODO: Interactive tool for testing bulb positioning. (Be able to blink a specific light)
# TODO: Handy for persistence? http://ruby-doc.org/stdlib-2.2.3/libdoc/yaml/rdoc/YAML/Store.html