homebridge-deconz 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Deconz/Resource.js +19 -9
- package/lib/DeconzService/Light.js +104 -51
- package/package.json +3 -3
package/lib/Deconz/Resource.js
CHANGED
|
@@ -410,15 +410,24 @@ class Resource {
|
|
|
410
410
|
case 'LIDL Livarno Lux':
|
|
411
411
|
this.capabilities.ctMax = 454 // 2200 K
|
|
412
412
|
this.capabilities.ctMin = 153 // 6500 K
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
this.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
413
|
+
break
|
|
414
|
+
case '_TZE200_s8gkrkxk': // LIDL Xmas light strip
|
|
415
|
+
if (this.model === 'TS0601') { // Xmas light strip
|
|
416
|
+
this.manufacturer = 'LIDL Livarno Lux'
|
|
417
|
+
this.model = 'HG06467'
|
|
418
|
+
this.body.capabilities.bri = {
|
|
419
|
+
no_bri_inc: true
|
|
420
|
+
}
|
|
421
|
+
this.body.capabilities.color = {
|
|
422
|
+
effects: [
|
|
423
|
+
'steady', 'snow', 'rainbow', 'snake',
|
|
424
|
+
'twinkle', 'fireworks', 'flag', 'waves',
|
|
425
|
+
'updown', 'vintage', 'fading', 'collide',
|
|
426
|
+
'strobe', 'sparkles', 'carnival', 'glow'
|
|
427
|
+
],
|
|
428
|
+
effect_colors: 6,
|
|
429
|
+
effect_speed: true
|
|
430
|
+
}
|
|
422
431
|
}
|
|
423
432
|
break
|
|
424
433
|
default:
|
|
@@ -892,6 +901,7 @@ class Resource {
|
|
|
892
901
|
break
|
|
893
902
|
case 'ROM001': // Hue smart button
|
|
894
903
|
case 'RDM003': // Hue smart button
|
|
904
|
+
case 'RDM005': // Hue smart button v2
|
|
895
905
|
buttons.push([1, 'Button', SINGLE | LONG, true])
|
|
896
906
|
break
|
|
897
907
|
case 'RWL020':
|
|
@@ -11,7 +11,7 @@ import { ServiceDelegate } from 'homebridge-lib/ServiceDelegate'
|
|
|
11
11
|
import { DeconzService } from '../DeconzService/index.js'
|
|
12
12
|
import '../DeconzService/LightsResource.js'
|
|
13
13
|
|
|
14
|
-
const { defaultGamut, xyToHsv, hsvToXy, ctToXy } = Colour
|
|
14
|
+
const { defaultGamut, xyToHsv, hsvToXy, ctToXy, hsvToRgb } = Colour
|
|
15
15
|
|
|
16
16
|
class Light extends DeconzService.LightsResource {
|
|
17
17
|
constructor (accessory, resource, params = {}) {
|
|
@@ -78,16 +78,18 @@ class Light extends DeconzService.LightsResource {
|
|
|
78
78
|
}
|
|
79
79
|
})
|
|
80
80
|
|
|
81
|
-
this.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
if (!this.resource.body.capabilities.bri.no_bri_inc) {
|
|
82
|
+
this.addCharacteristicDelegate({
|
|
83
|
+
key: 'brightnessChange',
|
|
84
|
+
Characteristic: this.Characteristics.my.BrightnessChange,
|
|
85
|
+
value: 0
|
|
86
|
+
}).on('didSet', async (value) => {
|
|
87
|
+
this.putState({ bri_inc: Math.round(value * 254.0 / 100.0) })
|
|
88
|
+
await timeout(this.platform.config.waitTimeReset)
|
|
89
|
+
this.values.brightnessChange = 0
|
|
90
|
+
})
|
|
88
91
|
this.values.brightnessChange = 0
|
|
89
|
-
}
|
|
90
|
-
this.values.brightnessChange = 0
|
|
92
|
+
}
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
if (this.capabilities.ct || this.capabilities.xy || this.capabilities.hs) {
|
|
@@ -338,8 +340,8 @@ class Light extends DeconzService.LightsResource {
|
|
|
338
340
|
}).on('didSet', (value, fromHomeKit) => {
|
|
339
341
|
if (fromHomeKit) {
|
|
340
342
|
this.checkAdaptiveLighting()
|
|
341
|
-
this.putState({ effect: value ? effect : 'none' })
|
|
342
343
|
this.values.effectString = value ? effect : 'none'
|
|
344
|
+
this.putEffect()
|
|
343
345
|
}
|
|
344
346
|
})
|
|
345
347
|
effectString.on('didSet', (value) => {
|
|
@@ -347,44 +349,95 @@ class Light extends DeconzService.LightsResource {
|
|
|
347
349
|
})
|
|
348
350
|
}
|
|
349
351
|
}
|
|
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
|
-
|
|
352
|
+
if (this.resource.body.capabilities.color.effect_speed) {
|
|
353
|
+
this.addCharacteristicDelegate({
|
|
354
|
+
key: 'effectSpeed',
|
|
355
|
+
Characteristic: this.Characteristics.my.EffectSpeed,
|
|
356
|
+
unit: '%',
|
|
357
|
+
value: 50
|
|
358
|
+
}).on('didSet', (value, fromHomeKit) => {
|
|
359
|
+
if (fromHomeKit) {
|
|
360
|
+
this.checkAdaptiveLighting()
|
|
361
|
+
this.putEffect()
|
|
362
|
+
}
|
|
363
|
+
})
|
|
364
|
+
}
|
|
365
|
+
if (this.resource.body.capabilities.color.effect_colors != null) {
|
|
366
|
+
this.effectServices = []
|
|
367
|
+
for (let i = 0; i < this.resource.body.capabilities.color.effect_colors; i++) {
|
|
368
|
+
const service = new ServiceDelegate(this.accessory, {
|
|
369
|
+
name: this.name + ' Effect Color ' + (i + 1),
|
|
370
|
+
Service: this.Services.hap.Lightbulb,
|
|
371
|
+
subtype: this.subtype + '-C' + i
|
|
372
|
+
})
|
|
373
|
+
service.addCharacteristicDelegate({
|
|
374
|
+
key: 'on',
|
|
375
|
+
Characteristic: this.Characteristics.hap.On,
|
|
376
|
+
value: true
|
|
377
|
+
}).on('didSet', (value, fromHomeKit) => {
|
|
378
|
+
if (fromHomeKit) {
|
|
379
|
+
if (value) {
|
|
380
|
+
for (let j = 0; j < i; j++) {
|
|
381
|
+
this.effectServices[j].values.on = true
|
|
382
|
+
}
|
|
383
|
+
} else {
|
|
384
|
+
for (let j = i + 1; j < this.resource.body.capabilities.color.effect_colors; j++) {
|
|
385
|
+
this.effectServices[j].values.on = false
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
this.checkAdaptiveLighting()
|
|
389
|
+
this.putEffect()
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
service.addCharacteristicDelegate({
|
|
393
|
+
key: 'hue',
|
|
394
|
+
Characteristic: this.Characteristics.hap.Hue,
|
|
395
|
+
unit: '°',
|
|
396
|
+
value: i * 60
|
|
397
|
+
}).on('didSet', (value, fromHomeKit) => {
|
|
398
|
+
if (fromHomeKit) {
|
|
399
|
+
this.checkAdaptiveLighting()
|
|
400
|
+
this.putEffect()
|
|
401
|
+
}
|
|
402
|
+
})
|
|
403
|
+
service.addCharacteristicDelegate({
|
|
404
|
+
key: 'saturation',
|
|
405
|
+
Characteristic: this.Characteristics.hap.Saturation,
|
|
406
|
+
unit: '%',
|
|
407
|
+
value: 100
|
|
408
|
+
}).on('didSet', (value, fromHomeKit) => {
|
|
409
|
+
if (fromHomeKit) {
|
|
410
|
+
this.checkAdaptiveLighting()
|
|
411
|
+
this.putEffect()
|
|
412
|
+
}
|
|
413
|
+
})
|
|
414
|
+
this.effectServices.push(service)
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
putEffect () {
|
|
420
|
+
this.putState({ effect: this.values.effectString })
|
|
421
|
+
if (this.values.effectString === 'none') {
|
|
422
|
+
return
|
|
423
|
+
}
|
|
424
|
+
if (this.resource.body.capabilities.color.effect_speed) {
|
|
425
|
+
this.putState({ effectSpeed: this.values.effectSpeed })
|
|
426
|
+
}
|
|
427
|
+
if (this.resource.body.capabilities.color.effect_colors != null) {
|
|
428
|
+
const effectColours = []
|
|
429
|
+
for (let i = 0; i < this.resource.body.capabilities.color.effect_colors; i++) {
|
|
430
|
+
const service = this.effectServices[i]
|
|
431
|
+
if (!service.values.on) {
|
|
432
|
+
break
|
|
433
|
+
}
|
|
434
|
+
const { r, g, b } = hsvToRgb(service.values.hue, service.values.saturation)
|
|
435
|
+
effectColours.push([Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)])
|
|
436
|
+
}
|
|
437
|
+
if (effectColours.length > 0) {
|
|
438
|
+
this.putState({ effectColours })
|
|
439
|
+
}
|
|
440
|
+
}
|
|
388
441
|
}
|
|
389
442
|
|
|
390
443
|
updateState (state, rpath, stateKey = 'state') {
|
|
@@ -426,7 +479,7 @@ class Light extends DeconzService.LightsResource {
|
|
|
426
479
|
break
|
|
427
480
|
case 'hue':
|
|
428
481
|
if (!this.capabilities.xy) {
|
|
429
|
-
this.values.hue = value
|
|
482
|
+
this.values.hue = Math.round(value * 360.0 / 65535.0)
|
|
430
483
|
}
|
|
431
484
|
break
|
|
432
485
|
case 'on':
|
|
@@ -444,7 +497,7 @@ class Light extends DeconzService.LightsResource {
|
|
|
444
497
|
break
|
|
445
498
|
case 'sat':
|
|
446
499
|
if (!this.capabilities.xy) {
|
|
447
|
-
this.values.
|
|
500
|
+
this.values.saturation = Math.round(value / 2.54)
|
|
448
501
|
}
|
|
449
502
|
break
|
|
450
503
|
case 'xy':
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"ebaauw"
|
|
8
8
|
],
|
|
9
9
|
"license": "Apache-2.0",
|
|
10
|
-
"version": "1.2.
|
|
10
|
+
"version": "1.2.8",
|
|
11
11
|
"keywords": [
|
|
12
12
|
"homebridge-plugin",
|
|
13
13
|
"homekit",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"node": "^24||^22||^20"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"hb-deconz-tools": "~2.0.
|
|
35
|
-
"homebridge-lib": "~7.
|
|
34
|
+
"hb-deconz-tools": "~2.0.19",
|
|
35
|
+
"homebridge-lib": "~7.2.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"prepare": "standard && rm -rf out && jsdoc -c jsdoc.json",
|