homebridge-deconz 1.0.4 → 1.0.5
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.
@@ -5,10 +5,9 @@
|
|
5
5
|
|
6
6
|
'use strict'
|
7
7
|
|
8
|
-
const {
|
9
|
-
AccessoryDelegate, HttpClient, OptionParser, timeout
|
10
|
-
} = require('homebridge-lib')
|
8
|
+
const { AccessoryDelegate, OptionParser, timeout } = require('homebridge-lib')
|
11
9
|
const { ApiClient, ApiError, WsClient } = require('hb-deconz-tools')
|
10
|
+
const { HttpError } = ApiClient
|
12
11
|
const Deconz = require('../Deconz')
|
13
12
|
const DeconzAccessory = require('../DeconzAccessory')
|
14
13
|
const DeconzService = require('../DeconzService')
|
@@ -399,7 +398,7 @@ class Gateway extends AccessoryDelegate {
|
|
399
398
|
})
|
400
399
|
this.client
|
401
400
|
.on('error', (error) => {
|
402
|
-
if (error instanceof
|
401
|
+
if (error instanceof HttpError) {
|
403
402
|
if (error.request.id !== this.requestId) {
|
404
403
|
this.log(
|
405
404
|
'request %d: %s %s%s', error.request.id,
|
@@ -1113,12 +1112,26 @@ class Gateway extends AccessoryDelegate {
|
|
1113
1112
|
const rids = Object.keys(this.deviceByRidByRtype[rtype]).sort()
|
1114
1113
|
for (const rid of rids) {
|
1115
1114
|
try {
|
1116
|
-
const { id, zigbee } = this.deviceByRidByRtype[rtype][rid]
|
1115
|
+
const { id, resource, zigbee } = this.deviceByRidByRtype[rtype][rid]
|
1117
1116
|
if (this.context.settingsById[id] == null) {
|
1118
1117
|
this.context.settingsById[id] = { expose: zigbee && this.values.autoExpose }
|
1119
1118
|
}
|
1120
1119
|
if (this.context.settingsById[id].expose) {
|
1121
1120
|
if (this.accessoryById[id] == null) {
|
1121
|
+
const name = resource.body.name
|
1122
|
+
if (zigbee && resource.body.type !== 'ZGPSwitch') {
|
1123
|
+
const mac = resource.body.uniqueid.split('-')[0]
|
1124
|
+
try {
|
1125
|
+
const ddf = await this.client.get('/devices/' + mac + '/ddf')
|
1126
|
+
if (ddf.status !== 'Gold') {
|
1127
|
+
this.warn('%s: exposed by %s ddf', name, ddf.status.toLowerCase())
|
1128
|
+
} else {
|
1129
|
+
this.debug('%s: exposed by %s ddf', name, ddf.status.toLowerCase())
|
1130
|
+
}
|
1131
|
+
} catch (error) { }
|
1132
|
+
} else {
|
1133
|
+
this.debug('%s: exposed by legacy code', name)
|
1134
|
+
}
|
1122
1135
|
this.addAccessory(id)
|
1123
1136
|
changed = true
|
1124
1137
|
}
|
@@ -133,8 +133,9 @@ class Light extends DeconzAccessory {
|
|
133
133
|
key: 'index',
|
134
134
|
Characteristic: this.Characteristics.hap.ServiceLabelIndex,
|
135
135
|
silent: true,
|
136
|
-
value: Number(i)
|
136
|
+
value: Number(i) + 1
|
137
137
|
})
|
138
|
+
service.values.index = Number(i) + 1
|
138
139
|
if (i === '0') {
|
139
140
|
continue
|
140
141
|
}
|
@@ -100,7 +100,7 @@ class Sensor extends DeconzAccessory {
|
|
100
100
|
const service = this.servicesByServiceName.AirPressure[0]
|
101
101
|
params.airPressureDelegate = service.characteristicDelegate('airPressure')
|
102
102
|
}
|
103
|
-
if (this.servicesByServiceName.AirQuality?.length
|
103
|
+
if (this.servicesByServiceName.AirQuality?.length >= 1) {
|
104
104
|
const service = this.servicesByServiceName.AirQuality[0]
|
105
105
|
if (service.characteristicDelegate('vocDensity') != null) {
|
106
106
|
params.vocDensityDelegate = service.characteristicDelegate('vocDensity')
|
@@ -22,7 +22,10 @@ class AirQuality extends DeconzService.SensorsResource {
|
|
22
22
|
})
|
23
23
|
}
|
24
24
|
|
25
|
-
if (
|
25
|
+
if (
|
26
|
+
resource.body.state.measured_value !== undefined &&
|
27
|
+
resource.body.capabilities?.measured_value != null
|
28
|
+
) {
|
26
29
|
const cmv = resource.body.capabilities.measured_value
|
27
30
|
switch (cmv.substance) {
|
28
31
|
case 'PM2.5':
|
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": "1.0.
|
7
|
+
"version": "1.0.5",
|
8
8
|
"keywords": [
|
9
9
|
"homebridge-plugin",
|
10
10
|
"homekit",
|
@@ -24,11 +24,11 @@
|
|
24
24
|
"engines": {
|
25
25
|
"deCONZ": "2.23.2",
|
26
26
|
"homebridge": "^1.6.1",
|
27
|
-
"node": "20.8.
|
27
|
+
"node": "20.8.1||^20||^18"
|
28
28
|
},
|
29
29
|
"dependencies": {
|
30
|
-
"hb-deconz-tools": "~1.0.
|
31
|
-
"homebridge-lib": "~6.6.
|
30
|
+
"hb-deconz-tools": "~1.0.9",
|
31
|
+
"homebridge-lib": "~6.6.3"
|
32
32
|
},
|
33
33
|
"scripts": {
|
34
34
|
"prepare": "standard && rm -rf out && jsdoc -c jsdoc.json",
|