homebridge-deconz 0.1.18 → 0.1.19

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.
@@ -16,7 +16,6 @@ const { SINGLE, DOUBLE, LONG } = DeconzService.Button
16
16
  const rtypes = ['lights', 'sensors', 'groups']
17
17
 
18
18
  const patterns = {
19
- uniqueid: /^([0-9a-f]{1,2}(?:[:-]?(?:[0-9a-f]{1,2})){7})-([0-9a-z]{2})(?:-([0-9a-z]{4}))?$/i,
20
19
  clipId: /^(S[0-9]{1,3})-([0-9a-z]{2})-([0-9a-z]{4})$/i,
21
20
  swversion: /^([0-9]+)(?:\.([0-9]+)(?:\.([0-9]+)(?:_([0-9]{4}))?)?)?$/
22
21
  }
@@ -52,20 +51,6 @@ const hueTapMap = {
52
51
  * @memberof Deconz
53
52
  */
54
53
  class Resource {
55
- /** Parse the `uniqueid` in the resource body of a resource for a Zigbee device.
56
- * @param {string} uniqueid - The `uniqueid`.
57
- * @return {object} The Zigbee `mac`, `endpoint`, and `cluster`.
58
- */
59
- static parseUniqueid (uniqueid) {
60
- toString('uniqueid', uniqueid, true)
61
- const a = patterns.uniqueid.exec(uniqueid.replace(/:/g, '').toUpperCase())
62
- return {
63
- mac: a?.[1],
64
- endpoint: a?.[2],
65
- cluster: a?.[3]
66
- }
67
- }
68
-
69
54
  /** Parse the `uniqueid` in the resource body of a resource for a CLIP sensor.
70
55
  * @param {string} uniqueid - The `uniqueid`.
71
56
  * @return {object} The MultiCLIP `id`, `endpoint`, and `cluster`.
@@ -132,7 +117,7 @@ class Resource {
132
117
  this.rtype === 'lights' ||
133
118
  (this.rtype === 'sensors' && this.body.type.startsWith('Z'))
134
119
  ) {
135
- const { mac, endpoint, cluster } = Resource.parseUniqueid(body.uniqueid)
120
+ const { mac, endpoint, cluster } = ApiClient.parseUniqueid(body.uniqueid)
136
121
 
137
122
  /** The device ID.
138
123
  *
@@ -170,7 +155,7 @@ class Resource {
170
155
 
171
156
  realDevice = true
172
157
  } else if (this.rtype === 'sensors') {
173
- const { mac, endpoint, cluster } = Resource.parseUniqueid(body.uniqueid)
158
+ const { mac, endpoint, cluster } = ApiClient.parseUniqueid(body.uniqueid)
174
159
  if (mac != null && endpoint != null && cluster != null) {
175
160
  // uniqueid for proxy device has proper mac, endpoint, cluster
176
161
  this.id = mac
@@ -26,8 +26,7 @@ class Motion extends DeconzService.SensorsResource {
26
26
 
27
27
  this.addCharacteristicDelegate({
28
28
  key: 'sensitivity',
29
- Characteristic: this.Characteristics.eve.Sensitivity,
30
- value: this.Characteristics.hap.TemperatureDisplayUnits.CELSIUS
29
+ Characteristic: this.Characteristics.eve.Sensitivity
31
30
  }).on('didSet', async (value, fromHomeKit) => {
32
31
  if (fromHomeKit) {
33
32
  const sensitivity = value === this.Characteristics.eve.Sensitivity.HIGH
@@ -30,8 +30,11 @@ class SensorsResource extends DeconzService {
30
30
  this.addCharacteristicDelegate({
31
31
  key: 'enabled',
32
32
  Characteristic: this.Characteristics.my.Enabled
33
- }).on('didSet', (value) => {
33
+ }).on('didSet', async (value, fromHomeKit) => {
34
34
  this.values.statusActive = value
35
+ if (fromHomeKit) {
36
+ await this.put('/config', { on: value })
37
+ }
35
38
  })
36
39
 
37
40
  this.addCharacteristicDelegate({
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.18",
7
+ "version": "0.1.19",
8
8
  "keywords": [
9
9
  "homebridge-plugin",
10
10
  "homekit",
@@ -23,13 +23,11 @@
23
23
  "engines": {
24
24
  "deCONZ": "2.21.2",
25
25
  "homebridge": "^1.6.1",
26
- "node": "^18.16.0"
26
+ "node": "^18.16.1"
27
27
  },
28
28
  "dependencies": {
29
- "hb-deconz-tools": "~1.0.2",
30
- "homebridge-lib": "~6.3.17",
31
- "ws": "^8.13.0",
32
- "xml2js": "~0.5.0"
29
+ "hb-deconz-tools": "~1.0.3",
30
+ "homebridge-lib": "~6.3.18"
33
31
  },
34
32
  "scripts": {
35
33
  "prepare": "standard && rm -rf out && jsdoc -c jsdoc.json",