-
Notifications
You must be signed in to change notification settings - Fork 0
/
node_types.py
executable file
·621 lines (535 loc) · 25.1 KB
/
node_types.py
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
""" Node classes used by the Hue Node Server. """
from converters import RGB_2_xy, color_xy, bri2st, kel2mired
import polyinterface
LOGGER = polyinterface.LOGGER
""" Hue Default transition time is 400ms """
DEF_TRANSTIME = 400
""" Increment for DIM and BRT commands """
DEF_INCREMENT = 10
""" Transition time for FadeUp/Down commands """
FADE_TRANSTIME = 4000
HUE_EFFECTS = ['none', 'colorloop']
HUE_ALERTS = ['none', 'select', 'lselect']
class HueBase(polyinterface.Node):
""" Base class for lights and groups """
def __init__(self, controller, primary, address, name, element_id, element, hub_idx):
super().__init__(controller, primary, address, name)
self.name = name
self.address = address
self.element_id = int(element_id)
self.data = element
self.on = None
self.st = None
self.brightness = None
self.saved_brightness = None
self.alert = None
self.transitiontime = DEF_TRANSTIME
self.ct = None
self.hue = None
self.saturation = None
self.color_x = None
self.color_y = None
self.effect = None
self.hub_idx = hub_idx
""" Basic On/Off and brightness controls """
def setBaseCtl(self, command):
cmd = command.get('cmd')
""" transition time for FastOn/Off"""
if cmd in [ 'DFON', 'DFOF' ]:
trans = 0
else:
trans = self.transitiontime
if cmd in ['DON', 'DFON']:
hue_command = {}
val = command.get('value')
if val:
self.brightness = self._validateBri(int(val))
hue_command['bri'] = self.brightness
self.setDriver('GV5', self.brightness)
elif cmd == 'DON' and self.on and self.controller.ignore_second_on:
''' Ignore DON command if bulb is On already '''
LOGGER.info('Ignoring On command, {} is already On'.format(self.name))
elif cmd == 'DFON' or self.on:
''' Go to full brightness on Fast On or if already On '''
self.brightness = 254
hue_command['bri'] = self.brightness
self.setDriver('GV5', self.brightness)
self.st = bri2st(self.brightness)
""" setting self.on to False to ensure that _send_command will add it """
self.on = False
""" if this is a Hue Group class """
if hasattr(self,'all_on'):
self.all_on = False
result = self._send_command(hue_command, trans)
elif cmd in ['DOF', 'DFOF']:
self.on = False
if hasattr(self,'all_on'):
self.all_on = False
self.st = 0
hue_command = { 'on': self.on }
result = self._send_command(hue_command, trans, False)
if trans != DEF_TRANSTIME:
"""
Work around a known bug in Hue - setting the light off with transition time
resets brightness to a random level, we'll attempt to re-set it here
"""
self.saved_brightness = self.brightness
elif cmd in ['BRT', 'DIM', 'FDUP', 'FDDOWN', 'FDSTOP']:
if cmd == 'BRT':
increment = DEF_INCREMENT
if self.brightness + increment > 254:
increment = 254 - self.brightness
elif cmd == 'DIM':
increment = -DEF_INCREMENT
if self.brightness + increment < 1:
increment = 1 - self.brightness
elif cmd == 'FDUP':
trans = FADE_TRANSTIME
increment = 254 - self.brightness
elif cmd == 'FDDOWN':
trans = FADE_TRANSTIME
increment = 1 - self.brightness
else:
""" FDSTOP """
increment = 0
self.brightness += increment
self.st = bri2st(self.brightness)
hue_command = { 'bri_inc': increment }
self.setDriver('GV5', self.brightness)
result = self._send_command(hue_command, trans)
else:
LOGGER.error('setBaseCtl received an unknown command: {}'.format(cmd))
result = None
self.setDriver('ST', self.st)
return result
def setBrightness(self, command):
self.brightness = self._validateBri(int(command.get('value')))
self.setDriver('GV5', self.brightness)
self.setDriver('ST', self.st)
hue_command = { 'bri': self.brightness }
return self._send_command(hue_command)
def setTransition(self, command):
self.transitiontime = int(command.get('value'))
self.setDriver('RR', self.transitiontime)
return True
def setAlert(self, command):
val = int(command.get('value')) - 1
self.alert = HUE_ALERTS[val]
hue_command = { 'alert': self.alert }
return self._send_command(hue_command)
def _validateBri(self, brightness):
if brightness > 254:
brightness = 254
elif brightness < 1:
brightness = 1
self.st = bri2st(brightness)
return brightness
def setCt(self, command):
self.ct = int(command.get('value'))
self.setDriver('CLITEMP', self.ct)
hue_command = { 'ct': kel2mired(self.ct) }
return self._send_command(hue_command)
def setCtBri(self, command):
query = command.get('query')
self.brightness = self._validateBri(int(query.get('BR.uom100')))
self.ct = int(query.get('K.uom26'))
self.setDriver('CLITEMP', self.ct)
self.setDriver('ST', self.st)
self.setDriver('GV5', self.brightness)
hue_command = { 'ct': kel2mired(self.ct), 'bri': self.brightness }
return self._send_command(hue_command)
def setColorRGB(self, command):
query = command.get('query')
color_r = int(query.get('R.uom100'))
color_g = int(query.get('G.uom100'))
color_b = int(query.get('B.uom100'))
transtime = int(query.get('D.uom42'))
self.brightness = self._validateBri(int(query.get('BR.uom100')))
(self.color_x, self.color_y) = RGB_2_xy(color_r, color_g, color_b)
hue_command = {'xy': [self.color_x, self.color_y], 'bri': self.brightness}
self.setDriver('GV1', self.color_x)
self.setDriver('GV2', self.color_y)
self.setDriver('GV5', self.brightness)
self.setDriver('ST', self.st)
return self._send_command(hue_command, transtime)
def setColorXY(self, command):
query = command.get('query')
self.color_x = float(query.get('X.uom56'))
self.color_y = float(query.get('Y.uom56'))
transtime = int(query.get('D.uom42'))
self.brightness = self._validateBri(int(query.get('BR.uom100')))
hue_command = {'xy': [self.color_x, self.color_y], 'bri': self.brightness}
self.setDriver('GV1', self.color_x)
self.setDriver('GV2', self.color_y)
self.setDriver('GV5', self.brightness)
self.setDriver('ST', self.st)
return self._send_command(hue_command, transtime)
def setColor(self, command):
c_id = int(command.get('value')) - 1
(self.color_x, self.color_y) = color_xy(c_id)
hue_command = {'xy': [self.color_x, self.color_y]}
self.setDriver('GV1', self.color_x)
self.setDriver('GV2', self.color_y)
return self._send_command(hue_command)
def setHue(self, command):
self.hue = int(command.get('value'))
self.setDriver('GV3', self.hue)
hue_command = { 'hue': self.hue }
return self._send_command(hue_command)
def setSat(self, command):
self.saturation = int(command.get('value'))
self.setDriver('GV4', self.saturation)
hue_command = { 'sat': self.saturation }
return self._send_command(hue_command)
def setColorHSB(self, command):
query = command.get('query')
self.hue = int(query.get('H.uom56'))
self.saturation = int(query.get('S.uom100'))
self.brightness = self._validateBri(int(query.get('BR.uom100')))
transtime = int(query.get('D.uom42'))
hue_command = {'hue': self.hue, 'sat': self.saturation, 'bri': self.brightness}
self.setDriver('GV3', self.hue)
self.setDriver('GV4', self.saturation)
self.setDriver('GV5', self.brightness)
self.setDriver('ST', self.st)
return self._send_command(hue_command, transtime)
def setEffect(self, command):
val = int(command.get('value')) - 1
self.effect = HUE_EFFECTS[val]
hue_command = { 'effect': self.effect }
return self._send_command(hue_command)
def _send_command(self, command, transtime=None, checkOn=True):
pass
drivers = []
commands = {}
id = ''
class HueDimmLight(HueBase):
""" Node representing Hue Dimmable Light """
def __init__(self, controller, primary, address, name, element_id, device, hub_idx):
super().__init__(controller, primary, address, name, element_id, device, hub_idx)
self.reachable = None
def start(self):
try:
self.transitiontime = int(self.getDriver('RR'))
except:
self.transitiontime = DEF_TRANSTIME
self.updateInfo()
def query(self, command=None):
self.data = self.controller.hub[self.hub_idx].get_light(self.element_id)
if self.data is None:
return False
self._updateInfo()
self.reportDrivers()
def updateInfo(self):
if self.controller.lights[self.hub_idx] is None:
return False
try:
self.data = self.controller.lights[self.hub_idx][str(self.element_id)]
except KeyError:
LOGGER.error('Node {} no longer exists'.format(self.address))
self.controller.delNode(self.address)
return False
self._updateInfo()
def _updateInfo(self):
if self.on is not None:
if self.on != self.data['state']['on']:
if self.data['state']['on']:
self.reportCmd('DON')
else:
self.reportCmd('DOF')
self.on = self.data['state']['on']
self.brightness = self.data['state']['bri']
self.st = bri2st(self.data['state']['bri'])
self.reachable = self.data['state']['reachable']
self.alert = self.data['state']['alert']
self.setDriver('GV5', self.brightness)
if self.reachable:
self.setDriver('GV6', 1)
else:
self.setDriver('GV6', 0)
if self.on:
self.setDriver('ST', self.st)
else:
self.setDriver('ST', 0)
self.setDriver('RR', self.transitiontime)
return True
def _send_command(self, command, transtime=None, checkOn=True):
""" generic method to send command to light """
if transtime is None:
transtime = self.transitiontime
if transtime != DEF_TRANSTIME:
command['transitiontime'] = int(round(transtime / 100))
if checkOn and self.on is False:
command['on'] = True
self.on = True
if self.saved_brightness:
""" Attempt to restore saved brightness """
if 'bri' not in command:
command['bri'] = self.saved_brightness
self.saved_brightness = None
responses = self.controller.hub[self.hub_idx].set_light(self.element_id, command)
return all(
[list(resp.keys())[0] == 'success' for resp in responses[0]])
drivers = [ {'driver': 'ST', 'value': 0, 'uom': 51},
{'driver': 'GV5', 'value': 0, 'uom': 100},
{'driver': 'RR', 'value': 400, 'uom': 42},
{'driver': 'GV6', 'value': 0, 'uom': 2}
]
commands = {
'DON': HueBase.setBaseCtl, 'DOF': HueBase.setBaseCtl, 'QUERY': query,
'DFON': HueBase.setBaseCtl, 'DFOF': HueBase.setBaseCtl, 'BRT': HueBase.setBaseCtl,
'DIM': HueBase.setBaseCtl, 'FDUP': HueBase.setBaseCtl, 'FDDOWN': HueBase.setBaseCtl,
'FDSTOP': HueBase.setBaseCtl, 'SET_BRI': HueBase.setBrightness, 'RR': HueBase.setTransition,
'SET_ALERT': HueBase.setAlert
}
id = 'DIMM_LIGHT'
class HueWhiteLight(HueDimmLight):
""" Node representing Hue White Light """
def _updateInfo(self):
super()._updateInfo()
self.ct = kel2mired(self.data['state']['ct'])
self.setDriver('CLITEMP', self.ct)
return True
drivers = [ {'driver': 'ST', 'value': 0, 'uom': 51},
{'driver': 'GV5', 'value': 0, 'uom': 100},
{'driver': 'CLITEMP', 'value': 0, 'uom': 26},
{'driver': 'RR', 'value': 400, 'uom': 42},
{'driver': 'GV6', 'value': 0, 'uom': 2}
]
commands = {
'DON': HueBase.setBaseCtl, 'DOF': HueBase.setBaseCtl, 'QUERY': HueDimmLight.query,
'DFON': HueBase.setBaseCtl, 'DFOF': HueBase.setBaseCtl, 'BRT': HueBase.setBaseCtl,
'DIM': HueBase.setBaseCtl, 'FDUP': HueBase.setBaseCtl, 'FDDOWN': HueBase.setBaseCtl,
'FDSTOP': HueBase.setBaseCtl, 'SET_BRI': HueBase.setBrightness, 'RR': HueBase.setTransition,
'CLITEMP': HueBase.setCt, 'SET_ALERT': HueBase.setAlert, 'SET_CTBR': HueBase.setCtBri
}
id = 'WHITE_LIGHT'
class HueColorLight(HueDimmLight):
""" Node representing Hue Color Light """
def _updateInfo(self):
super()._updateInfo()
self.effect = self.data['state']['effect']
(self.color_x, self.color_y) = [round(float(val), 4)
for val in self.data['state'].get('xy',[0.0,0.0])]
self.hue = self.data['state']['hue']
self.saturation = self.data['state']['sat']
self.setDriver('GV1', self.color_x)
self.setDriver('GV2', self.color_y)
self.setDriver('GV3', self.hue)
self.setDriver('GV4', self.saturation)
return True
drivers = [ {'driver': 'ST', 'value': 0, 'uom': 51},
{'driver': 'GV1', 'value': 0, 'uom': 56},
{'driver': 'GV2', 'value': 0, 'uom': 56},
{'driver': 'GV3', 'value': 0, 'uom': 56},
{'driver': 'GV4', 'value': 0, 'uom': 100},
{'driver': 'GV5', 'value': 0, 'uom': 100},
{'driver': 'RR', 'value': 400, 'uom': 42},
{'driver': 'GV6', 'value': 0, 'uom': 2}
]
commands = {
'DON': HueBase.setBaseCtl, 'DOF': HueBase.setBaseCtl, 'QUERY': HueDimmLight.query,
'DFON': HueBase.setBaseCtl, 'DFOF': HueBase.setBaseCtl, 'BRT': HueBase.setBaseCtl,
'DIM': HueBase.setBaseCtl, 'FDUP': HueBase.setBaseCtl, 'FDDOWN': HueBase.setBaseCtl,
'FDSTOP': HueBase.setBaseCtl, 'SET_BRI': HueBase.setBrightness, 'RR': HueBase.setTransition,
'SET_COLOR': HueBase.setColor, 'SET_HUE': HueBase.setHue, 'SET_SAT': HueBase.setSat, 'SET_HSB': HueBase.setColorHSB,
'SET_COLOR_RGB': HueBase.setColorRGB, 'SET_COLOR_XY': HueBase.setColorXY, 'SET_ALERT': HueBase.setAlert,
'SET_EFFECT': HueBase.setEffect
}
id = 'COLOR_LIGHT'
class HueEColorLight(HueColorLight):
""" Node representing Hue Color Light """
def _updateInfo(self):
super()._updateInfo()
self.ct = kel2mired(self.data['state']['ct'])
self.setDriver('CLITEMP', self.ct)
return True
drivers = [ {'driver': 'ST', 'value': 0, 'uom': 51},
{'driver': 'GV1', 'value': 0, 'uom': 56},
{'driver': 'GV2', 'value': 0, 'uom': 56},
{'driver': 'GV3', 'value': 0, 'uom': 56},
{'driver': 'GV4', 'value': 0, 'uom': 100},
{'driver': 'GV5', 'value': 0, 'uom': 100},
{'driver': 'CLITEMP', 'value': 0, 'uom': 26},
{'driver': 'RR', 'value': 400, 'uom': 42},
{'driver': 'GV6', 'value': 0, 'uom': 2}
]
commands = {
'DON': HueBase.setBaseCtl, 'DOF': HueBase.setBaseCtl, 'QUERY': HueDimmLight.query,
'DFON': HueBase.setBaseCtl, 'DFOF': HueBase.setBaseCtl, 'BRT': HueBase.setBaseCtl,
'DIM': HueBase.setBaseCtl, 'FDUP': HueBase.setBaseCtl, 'FDDOWN': HueBase.setBaseCtl,
'FDSTOP': HueBase.setBaseCtl, 'SET_BRI': HueBase.setBrightness, 'RR': HueBase.setTransition,
'SET_COLOR': HueBase.setColor, 'SET_HUE': HueBase.setHue, 'SET_SAT': HueBase.setSat,
'CLITEMP': HueBase.setCt, 'SET_HSB': HueBase.setColorHSB, 'SET_COLOR_RGB': HueBase.setColorRGB,
'SET_COLOR_XY': HueBase.setColorXY, 'SET_ALERT': HueBase.setAlert, 'SET_EFFECT': HueBase.setEffect,
'SET_CTBR': HueBase.setCtBri
}
id = 'ECOLOR_LIGHT'
class HueGroup(HueBase):
""" Node representing a group of Hue Lights """
def __init__(self, controller, primary, address, name, element_id, device, hub_idx):
super().__init__(controller, primary, address, name, element_id, device, hub_idx)
self.devcount = None
self.all_on = None
def start(self):
try:
self.transitiontime = int(self.getDriver('RR'))
except:
self.transitiontime = DEF_TRANSTIME
self.updateInfo()
def query(self, command=None):
self.data = self.controller.hub[self.hub_idx].get_group(self.element_id)
if self.data is None:
return False
try:
self._updateInfo()
except Exception as ex:
LOGGER.error(f"{self.data['type']} {self.data['name']} exception during update: {ex}")
return False
self.reportDrivers()
def updateInfo(self):
if self.controller.groups[self.hub_idx] is None:
return False
self.data = self.controller.groups[self.hub_idx][str(self.element_id)]
self._updateInfo()
def _updateInfo(self):
self.devcount = len(self.data['lights'])
if self.devcount < 1:
LOGGER.info("{} {} has {} lights, skipping updates".format(self.data['type'], self.data['name'], self.devcount))
return False
else:
self.setDriver('GV6', self.devcount)
self.on = self.data['state']['any_on']
if self.all_on != self.data['state']['all_on']:
if self.data['state']['all_on']:
self.reportCmd('DON')
self.all_on = True
else:
self.reportCmd('DOF')
self.all_on = False
self.brightness = self.data['action']['bri']
self.setDriver('GV5', self.brightness)
self.st = bri2st(self.data['action']['bri'])
if self.on:
self.setDriver('ST', self.st)
else:
self.setDriver('ST', 0)
self.alert = self.data['action']['alert']
if 'ct' in self.data['action']:
self.ct = kel2mired(self.data['action']['ct'])
self.setDriver('CLITEMP', self.ct)
else:
self.setDriver('CLITEMP', 0)
if 'effect' in self.data['action']:
self.effect = self.data['action']['effect']
if 'xy' in self.data['action']:
(self.color_x, self.color_y) = [round(float(val), 4)
for val in self.data['action'].get('xy',[0.0,0.0])]
self.setDriver('GV1', self.color_x)
self.setDriver('GV2', self.color_y)
else:
self.setDriver('GV1', 0)
self.setDriver('GV2', 0)
if 'hue' in self.data['action']:
self.hue = self.data['action']['hue']
self.setDriver('GV3', self.hue)
else:
self.setDriver('GV3', 0)
if 'sat' in self.data['action']:
self.saturation = self.data['action']['sat']
self.setDriver('GV4', self.saturation)
else:
self.setDriver('GV4', 0)
self.setDriver('RR', self.transitiontime)
return True
def setCt(self, command):
if 'ct' not in self.data['action']:
LOGGER.info("{} {} does not have Color temperature lights but CT command is received".format(self.data['type'], self.data['name']))
return False
super().setCt(command)
def setCtBri(self, command):
if 'ct' not in self.data['action']:
LOGGER.info("{} {} does not have Color temperature lights but CTBR command is received".format(self.data['type'], self.data['name']))
return False
super().setCtBri(command)
def setColorRGB(self, command):
if 'xy' not in self.data['action']:
LOGGER.info("{} {} does not have Color lights but RGB command is received".format(self.data['type'], self.data['name']))
return False
super().setColorRGB(command)
def setColorXY(self, command):
if 'xy' not in self.data['action']:
LOGGER.info("{} {} does not have Color lights but XY command is received".format(self.data['type'], self.data['name']))
return False
super().setColorXY(command)
def setColor(self, command):
if 'xy' not in self.data['action']:
LOGGER.info("{} {} does not have Color lights but Color command is received".format(self.data['type'], self.data['name']))
return False
super().setColor(command)
def setHue(self, command):
if 'hue' not in self.data['action']:
LOGGER.info("{} {} does not have Color lights but HUE command is received".format(self.data['type'], self.data['name']))
return False
super().setHue(command)
def setSat(self, command):
if 'sat' not in self.data['action']:
LOGGER.info("{} {} does not have Color lights but SAT command is received".format(self.data['type'], self.data['name']))
return False
super().setSat(command)
def setColorHSB(self, command):
if 'hue' not in self.data['action']:
LOGGER.info("{} {} does not have Color lights but HSB command is received".format(self.data['type'], self.data['name']))
return False
super().setColorHSB(command)
def setEffect(self, command):
if 'effect' not in self.data['action']:
LOGGER.info("{} {} does not have Color lights but EFFECT command is received".format(self.data['type'], self.data['name']))
return False
super().setEffect(command)
def setHueScene(self, command):
requested_scene_id = int(command.get('value'))
for hue_scene in self.controller.scene_lookup:
if hue_scene['hub'] == self.hub_idx and hue_scene['group'] == self.element_id and hue_scene['idx'] == requested_scene_id:
LOGGER.info(f"{self.data['name']} requested scene: {hue_scene['name']} ({requested_scene_id}), hue scene id: {hue_scene['id']}")
return self._send_command({"scene": hue_scene['id']})
LOGGER.error(f"{self.data['name']} does not seem to have scene index {requested_scene_id}")
return False
def _send_command(self, command, transtime=None, checkOn=True):
if transtime is None:
transtime = self.transitiontime
""" generic method to send command to light """
if transtime != DEF_TRANSTIME:
command['transitiontime'] = int(round(transtime / 100))
if checkOn and self.all_on is False:
command['on'] = True
self.all_on = True
if self.saved_brightness:
""" Attempt to restore saved brightness """
if 'bri' not in command:
command['bri'] = self.saved_brightness
self.saved_brightness = None
responses = self.controller.hub[self.hub_idx].set_group(self.element_id, command)
return all(
[list(resp.keys())[0] == 'success' for resp in responses[0]])
drivers = [ {'driver': 'ST', 'value': 0, 'uom': 51},
{'driver': 'GV1', 'value': 0, 'uom': 56},
{'driver': 'GV2', 'value': 0, 'uom': 56},
{'driver': 'GV3', 'value': 0, 'uom': 56},
{'driver': 'GV4', 'value': 0, 'uom': 100},
{'driver': 'GV5', 'value': 0, 'uom': 100},
{'driver': 'GV6', 'value': 0, 'uom': 56},
{'driver': 'CLITEMP', 'value': 0, 'uom': 26},
{'driver': 'RR', 'value': 400, 'uom': 42}
]
commands = {
'DON': HueBase.setBaseCtl, 'DOF': HueBase.setBaseCtl, 'QUERY': query,
'DFON': HueBase.setBaseCtl, 'DFOF': HueBase.setBaseCtl, 'BRT': HueBase.setBaseCtl,
'DIM': HueBase.setBaseCtl, 'FDUP': HueBase.setBaseCtl, 'FDDOWN': HueBase.setBaseCtl,
'FDSTOP': HueBase.setBaseCtl, 'SET_BRI': HueBase.setBrightness, 'RR': HueBase.setTransition,
'SET_COLOR': setColor, 'SET_HUE': setHue, 'SET_SAT': setSat,
'CLITEMP': setCt, 'SET_HSB': setColorHSB, 'SET_COLOR_RGB': setColorRGB,
'SET_COLOR_XY': setColorXY, 'SET_ALERT': HueBase.setAlert, 'SET_EFFECT': setEffect,
'SET_CTBR': setCtBri, 'SET_HSCENE': setHueScene
}
id = 'HUE_GROUP'