homebridge-deconz 0.0.22 → 0.0.25

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.
@@ -152,7 +152,7 @@ class ApiClient extends homebridgeLib.HttpClient {
152
152
  }
153
153
  if (_options.phoscon) {
154
154
  // options.headers = { Accept: 'application/vnd.ddel.v1' }
155
- options.headers = { Accept: 'application/vnd.ddel.v1.1,vnd.ddel.v1.1' }
155
+ options.headers = { Accept: 'application/vnd.ddel.v3,application/vnd.ddel.v2,application/vnd.ddel.v1.1' }
156
156
  }
157
157
  if (_options.apiKey) {
158
158
  options.path += '/' + _options.apiKey
@@ -256,7 +256,7 @@ class Resource {
256
256
  */
257
257
  get prio () {
258
258
  if (this.rtype === 'groups') return -1
259
- if (this.rtype === 'lights') return this.endpoint
259
+ if (this.rtype === 'lights') return 0xFF - this.endpoint
260
260
  return sensorsPrios.indexOf(this.serviceName)
261
261
  }
262
262
 
@@ -446,6 +446,13 @@ class Resource {
446
446
  this.capabilities.bri = false
447
447
  }
448
448
  break
449
+ case 'LEDVANCE':
450
+ this.capabilities.gamut = {
451
+ r: [0.6972, 0.3027],
452
+ g: [0.1737, 0.6991],
453
+ b: [0.1227, 0.0959]
454
+ }
455
+ break
449
456
  case 'LIDL Livarno Lux':
450
457
  this.capabilities.ctMax = 454 // 2200 K
451
458
  this.capabilities.ctMin = 153 // 6500 K
@@ -474,9 +481,9 @@ class Resource {
474
481
  break
475
482
  case 'OSRAM':
476
483
  this.capabilities.gamut = {
477
- r: [0.6877, 0.3161],
478
- g: [0.1807, 0.7282],
479
- b: [0.1246, 0.0580]
484
+ r: [0.6850, 0.3149],
485
+ g: [0.1780, 0.7253],
486
+ b: [0.1241, 0.0578]
480
487
  }
481
488
  break
482
489
  case 'Philips':
@@ -642,7 +649,7 @@ class Resource {
642
649
  }
643
650
  break
644
651
  case 'TRADFRI SHORTCUT Button':
645
- buttons.push([1, 'Button', SINGLE | LONG])
652
+ buttons.push([1, 'Button', SINGLE | DOUBLE | LONG])
646
653
  break
647
654
  case 'TRADFRI on/off switch':
648
655
  buttons.push([1, 'On', SINGLE | LONG])
@@ -1036,6 +1043,19 @@ class Resource {
1036
1043
  break
1037
1044
  }
1038
1045
  break
1046
+ case '_TZ3000_wkai4ga5':
1047
+ switch (this.model) {
1048
+ case 'TS0044':
1049
+ dots = true
1050
+ buttons.push([1, 'Top Left', SINGLE | DOUBLE | LONG])
1051
+ buttons.push([2, 'Top Right', SINGLE | DOUBLE | LONG])
1052
+ buttons.push([3, 'Bottom Left', SINGLE | DOUBLE | LONG])
1053
+ buttons.push([4, 'Bottom Right', SINGLE | DOUBLE | LONG])
1054
+ break
1055
+ default:
1056
+ break
1057
+ }
1058
+ break
1039
1059
  case '_TZ3000_xabckq1v':
1040
1060
  switch (this.model) {
1041
1061
  case 'TS004F': // Tuya 4-button switch, single press only
@@ -60,7 +60,7 @@ class WsClient extends events.EventEmitter {
60
60
  listen () {
61
61
  this.reconnect = true
62
62
  const url = 'ws://' + this.config.hostname + ':' + this.config.port
63
- this.ws = new WebSocket(url)
63
+ this.ws = new WebSocket(url, { family: 4 })
64
64
 
65
65
  this.ws
66
66
  .on('error', (error) => {
@@ -21,6 +21,8 @@ class Light extends DeconzAccessory {
21
21
  * @param {Deconz.Device} device - The device.
22
22
  */
23
23
  constructor (gateway, device, settings = {}) {
24
+ // settings.forceEveEnergy = true
25
+
24
26
  super(gateway, device, gateway.Accessory.Categories.LIGHTBULB)
25
27
 
26
28
  this.identify()
@@ -35,12 +37,14 @@ class Light extends DeconzAccessory {
35
37
  serviceName: this.values.serviceName
36
38
  })
37
39
 
40
+ let nLights = 1
38
41
  for (const subtype in device.resourceBySubtype) {
39
42
  const resource = device.resourceBySubtype[subtype]
40
43
  if (subtype === device.primary) {
41
44
  continue
42
45
  }
43
46
  if (resource.rtype === 'lights') {
47
+ nLights++
44
48
  this.createService(resource, { serviceName: this.values.serviceName })
45
49
  } else {
46
50
  this.createService(resource)
@@ -48,16 +52,66 @@ class Light extends DeconzAccessory {
48
52
  }
49
53
 
50
54
  if (this.serviceByServiceName.Consumption != null) {
55
+ // Current Consumption to be computed by history if not exposed by device
56
+ const currentConsumption =
57
+ this.service.values.currentConsumption === undefined
58
+ ? this.service.addCharacteristicDelegate({
59
+ key: 'currentConsumption',
60
+ Characteristic: this.Characteristics.eve.CurrentConsumption,
61
+ unit: ' W'
62
+ })
63
+ : null
51
64
  this.historyService = new History.Consumption(
52
65
  this, {},
53
- this.serviceByServiceName.Consumption.characteristicDelegate('totalConsumption'),
54
- this.serviceByServiceName.Consumption.characteristicDelegate('currentConsumption')
66
+ this.service.characteristicDelegate('totalConsumption'),
67
+ currentConsumption,
68
+ this.service.characteristicDelegate('on')
55
69
  )
56
70
  } else if (this.serviceByServiceName.Power != null) {
71
+ // Total Consumption to be computed by history
72
+ const TotalConsumption = this.service.addCharacteristicDelegate({
73
+ key: 'totalConsumption',
74
+ Characteristic: this.Characteristics.eve.TotalConsumption,
75
+ unit: ' kWh',
76
+ value: 0
77
+ })
57
78
  this.historyService = new History.Power(
58
79
  this, {},
59
- this.serviceByServiceName.Power.characteristicDelegate('currentConsumption')
80
+ this.service.characteristicDelegate('currentConsumption'),
81
+ TotalConsumption,
82
+ this.service.characteristicDelegate('on')
60
83
  )
84
+ } else if (this.values.serviceName === 'Outlet' && settings.forceEveEnergy) {
85
+ if (nLights > 1) {
86
+ // Eve would recognise device as Eve Energy Strip.
87
+ } else if (this.serviceByServiceName.Switch != null) {
88
+ // Eve would recognise device as Eve Button.
89
+ } else {
90
+ // Needed for Eve to recognise device as Eve Energy.
91
+ this.service.addCharacteristicDelegate({
92
+ key: 'totalConsumption',
93
+ Characteristic: this.Characteristics.eve.TotalConsumption,
94
+ unit: ' kWh'
95
+ })
96
+ this.historyService = new History.On(
97
+ this, {},
98
+ this.service.characteristicDelegate('on')
99
+ )
100
+ }
101
+ }
102
+
103
+ if (this.values.serviceName === 'Outlet' && this.historyService != null) {
104
+ if (nLights > 1) {
105
+ // Eve would recognise device as Eve Energy Strip.
106
+ } else if (this.serviceByServiceName.Switch != null) {
107
+ // Eve would recognise device as Eve Button.
108
+ } else {
109
+ // Needed for Eve to show history for On.
110
+ this.service.addCharacteristicDelegate({
111
+ key: 'lockPhysicalControls',
112
+ Characteristic: this.Characteristics.hap.LockPhysicalControls
113
+ })
114
+ }
61
115
  }
62
116
 
63
117
  this.createSettingsService()
@@ -157,7 +157,6 @@ class DeconzAccessory extends homebridgeLib.AccessoryDelegate {
157
157
  if (service != null) {
158
158
  service.addResource(resource)
159
159
  }
160
- this.consumptionService = service
161
160
  } else if (params.serviceName === 'Switch') {
162
161
  // Default button
163
162
  if (resource.capabilities.buttons == null) {
@@ -71,7 +71,7 @@ class GatewaySettings extends homebridgeLib.ServiceDelegate {
71
71
  this.addCharacteristicDelegate({
72
72
  key: 'logLevel',
73
73
  Characteristic: this.Characteristics.my.LogLevel,
74
- value: gateway.platform.logLevel
74
+ value: this.accessoryDelegate.logLevel
75
75
  })
76
76
 
77
77
  this.addCharacteristicDelegate({
@@ -210,6 +210,7 @@ class Light extends DeconzService.LightsResource {
210
210
  return this.adaptiveLighting.generateControl()
211
211
  },
212
212
  setter: async (value) => {
213
+ this.initAdaptiveLighting()
213
214
  const control = this.adaptiveLighting.parseControl(value)
214
215
  this.context.transitionControl = value
215
216
  const response = this.adaptiveLighting.generateControlResponse()
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName": "Homebridge deCONZ",
5
5
  "author": "Erik Baauw",
6
6
  "license": "Apache-2.0",
7
- "version": "0.0.22",
7
+ "version": "0.0.25",
8
8
  "keywords": [
9
9
  "homebridge-plugin",
10
10
  "homekit",
@@ -20,14 +20,13 @@
20
20
  "deconz": "cli/deconz.js"
21
21
  },
22
22
  "engines": {
23
- "deCONZ": "2.17.1",
24
- "homebridge": "^1.5.0",
25
- "node": "^16.17.0"
23
+ "deCONZ": "2.19.1",
24
+ "homebridge": "^1.5.1",
25
+ "node": "^18.12.0"
26
26
  },
27
27
  "dependencies": {
28
- "homebridge-lib": "~5.6.5",
29
- "semver": "^7.3.7",
30
- "ws": "^8.8.1",
28
+ "homebridge-lib": "~5.7.1",
29
+ "ws": "^8.10.0",
31
30
  "xml2js": "~0.4.23"
32
31
  },
33
32
  "scripts": {
@@ -42,8 +41,14 @@
42
41
  "url": "https://github.com/ebaauw/homebridge-deconz/issues"
43
42
  },
44
43
  "homepage": "https://github.com/ebaauw/homebridge-deconz#readme",
45
- "funding": {
46
- "type": "paypal",
47
- "url": "https://www.paypal.me/ebaauw/EUR"
48
- }
44
+ "funding": [
45
+ {
46
+ "type": "github",
47
+ "url": "https://github.com/sponsors/ebaauw"
48
+ },
49
+ {
50
+ "type": "paypal",
51
+ "url": "https://www.paypal.me/ebaauw/EUR"
52
+ }
53
+ ]
49
54
  }