homebridge-deconz 0.1.13 → 0.1.14

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.
@@ -594,7 +594,7 @@ class Gateway extends AccessoryDelegate {
594
594
  const device = this.deviceById[id]
595
595
  delete this.exposeErrorById[id]
596
596
  const { body } = device.resource
597
- this.debug('%s: add accessory', body.name)
597
+ this.log('%s: add accessory', body.name)
598
598
  let { serviceName } = device.resource
599
599
  if (DeconzAccessory[serviceName] == null) {
600
600
  // this.warn('%s: %s: not yet supported %s type', body.name, body.type, rtype)
@@ -622,7 +622,10 @@ class Gateway extends AccessoryDelegate {
622
622
  }
623
623
  if (this.accessoryById[id] != null) {
624
624
  this.monitorResources(this.accessoryById[id], false)
625
- this.log('%s: delete accessory', this.accessoryById[id].name)
625
+ this.log(
626
+ '%s: delete accessory%s', this.accessoryById[id].name,
627
+ delegateOnly ? ' delegate' : ''
628
+ )
626
629
  this.accessoryById[id].destroy(delegateOnly)
627
630
  delete this.accessoryById[id]
628
631
  if (this.exposeErrorById[id] != null) {
@@ -71,14 +71,29 @@ class DeconzAccessory extends AccessoryDelegate {
71
71
 
72
72
  this
73
73
  .on('polled', (device) => {
74
+ let reExpose = false
74
75
  this.values.firmware = device.resource.firmware
75
- for (const subtype in this.serviceBySubtype) {
76
- try {
77
- const service = this.serviceBySubtype[subtype]
78
- const resource = device.resourceBySubtype[subtype]
79
- this.debug('%s: polled: %j', resource.rpath, resource.body)
76
+ for (const subtype in device.resourceBySubtype) {
77
+ const resource = device.resourceBySubtype[subtype]
78
+ this.debug('%s: polled: %j', resource.rpath, resource.body)
79
+ const service = this.serviceBySubtype[subtype]
80
+ if (service == null) {
81
+ this.log('%s: new resource: %j', resource.rpath, resource.body)
82
+ reExpose = true
83
+ } else {
80
84
  service.update(resource.body, resource.rpath)
81
- } catch (error) { this.error(error) }
85
+ }
86
+ }
87
+ for (const subtype in this.serviceBySubtype) {
88
+ const service = this.serviceBySubtype[subtype]
89
+ const resource = device.resourceBySubtype[subtype]
90
+ if (resource == null) {
91
+ this.log('%s: resource deleted', service.rpath)
92
+ reExpose = true
93
+ }
94
+ }
95
+ if (reExpose) {
96
+ this.gateway.reExposeAccessory(this.id)
82
97
  }
83
98
  })
84
99
  .on('changed', (rpath, body) => {
@@ -59,6 +59,11 @@ class Label extends DeconzService.SensorsResource {
59
59
 
60
60
  updateState (state, rpath) {
61
61
  const buttonResource = this.buttonResources[rpath]
62
+ if (buttonResource == null) {
63
+ this.log('%s: resource deleted', rpath)
64
+ this.gateway.reExposeAccessory(this.accessory.id)
65
+ return
66
+ }
62
67
  if (buttonResource.lastUpdated === '') {
63
68
  buttonResource.lastUpdated = state.lastupdated
64
69
  } else if (
@@ -55,6 +55,7 @@ class DeconzService extends ServiceDelegate {
55
55
  })
56
56
  this.id = resource.id
57
57
  this.gateway = accessory.gateway
58
+ this.accessory = accessory
58
59
  this.client = accessory.client
59
60
  this.resource = resource
60
61
  this.rtype = resource.rtype
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.13",
7
+ "version": "0.1.14",
8
8
  "keywords": [
9
9
  "homebridge-plugin",
10
10
  "homekit",
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "engines": {
24
24
  "deCONZ": "2.21.2",
25
- "homebridge": "^1.6.0",
25
+ "homebridge": "^1.6.1",
26
26
  "node": "^18.16.0"
27
27
  },
28
28
  "dependencies": {
29
- "homebridge-lib": "~6.3.14",
29
+ "homebridge-lib": "~6.3.15",
30
30
  "ws": "^8.13.0",
31
31
  "xml2js": "~0.5.0"
32
32
  },