homebridge-deconz 0.1.11 → 0.1.12

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.
@@ -65,7 +65,7 @@ class Light extends DeconzAccessory {
65
65
  silent: true
66
66
  })
67
67
  }
68
- if (this.servicesByServiceName.Consumption?.[0] != null) {
68
+ if (this.service.characteristicDelegate('totalConsumption') != null) {
69
69
  params.totalConsumptionDelegate = this.service.characteristicDelegate('totalConsumption')
70
70
  if (this.service.values.consumption === undefined) {
71
71
  // Power to be computed by history if not exposed by device
@@ -75,7 +75,7 @@ class Light extends DeconzAccessory {
75
75
  unit: ' W'
76
76
  })
77
77
  }
78
- } else if (this.servicesByServiceName.Power?.[0] != null) {
78
+ } else if (this.service.characteristicDelegate('consumption') != null) {
79
79
  params.consumptionDelegate = this.service.characteristicDelegate('consumption')
80
80
  // Total Consumption to be computed by history
81
81
  params.computedTotalConsumptionDelegate = this.service.addCharacteristicDelegate({
@@ -178,25 +178,22 @@ class DeconzAccessory extends AccessoryDelegate {
178
178
  this.Characteristics.hap.ServiceLabelNamespace.ARABIC_NUMERALS
179
179
  }
180
180
  service = this.servicesByServiceName.Label?.[0]
181
- if (service == null) {
182
- service = new DeconzService.Label(this, resource, {
183
- primaryService: params.primaryService
184
- })
185
- }
186
- service.createButtonServices(resource, params)
187
181
  }
188
182
  if (service == null) {
189
183
  service = new DeconzService[params.serviceName](this, resource, {
190
184
  primaryService: params.primaryService
191
185
  })
186
+ if (this.servicesByServiceName[params.serviceName] == null) {
187
+ this.servicesByServiceName[params.serviceName] = [service]
188
+ } else {
189
+ this.servicesByServiceName[params.serviceName].push(service)
190
+ }
191
+ }
192
+ if (params.serviceName === 'Label') {
193
+ service.createButtonServices(resource, params)
192
194
  }
193
195
  this.serviceBySubtype[resource.subtype] = service
194
196
  this.serviceByRpath[resource.rpath] = service
195
- if (this.servicesByServiceName[params.serviceName] == null) {
196
- this.servicesByServiceName[params.serviceName] = [service]
197
- } else {
198
- this.servicesByServiceName[params.serviceName].push(service)
199
- }
200
197
  if (resource.body.config?.battery !== undefined) {
201
198
  if (this.servicesByServiceName.Battery?.[0] == null) {
202
199
  this.servicesByServiceName.Battery = [new DeconzService.Battery(this, resource)]
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.1.11",
7
+ "version": "0.1.12",
8
8
  "keywords": [
9
9
  "homebridge-plugin",
10
10
  "homekit",