homebridge-deconz 0.0.15 → 0.0.16
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.
- package/cli/deconz.js +2 -2
- package/lib/Deconz/ApiClient.js +1 -1
- package/lib/Deconz/Discovery.js +2 -2
- package/lib/Deconz/Resource.js +2 -2
- package/lib/DeconzAccessory/Gateway.js +12 -5
- package/lib/DeconzAccessory/index.js +1 -1
- package/lib/DeconzPlatform.js +13 -12
- package/lib/DeconzService/Consumption.js +1 -1
- package/lib/DeconzService/Light.js +9 -9
- package/lib/DeconzService/Motion.js +1 -1
- package/lib/DeconzService/Power.js +1 -1
- package/lib/DeconzService/Switch.js +2 -2
- package/lib/DeconzService/Temperature.js +1 -0
- package/lib/DeconzService/Thermostat.js +1 -0
- package/lib/DeconzService/WindowCovering.js +1 -1
- package/package.json +3 -3
package/cli/deconz.js
CHANGED
@@ -703,7 +703,7 @@ class Main extends homebridgeLib.CommandLineTool {
|
|
703
703
|
const { websocketport } = await this.client.get('/config')
|
704
704
|
options.host = this.client.host + ':' + websocketport
|
705
705
|
this.wsMonitor = new Deconz.WsClient(options)
|
706
|
-
this.setOptions({ mode
|
706
|
+
this.setOptions({ mode })
|
707
707
|
this.wsMonitor
|
708
708
|
.on('error', (error) => { this.error(error) })
|
709
709
|
.on('listening', (url) => { this.log('listening on %s', url) })
|
@@ -813,7 +813,7 @@ class Main extends homebridgeLib.CommandLineTool {
|
|
813
813
|
.parse(...args)
|
814
814
|
const apiKey = await this.client.getApiKey('deconz')
|
815
815
|
this.print(jsonFormatter.stringify(apiKey))
|
816
|
-
this.gateways[this.bridgeid] = { apiKey
|
816
|
+
this.gateways[this.bridgeid] = { apiKey }
|
817
817
|
if (this.client.fingerprint != null) {
|
818
818
|
this.gateways[this.bridgeid].fingerprint = this.client.fingerprint
|
819
819
|
}
|
package/lib/Deconz/ApiClient.js
CHANGED
@@ -149,7 +149,7 @@ class ApiClient extends homebridgeLib.HttpClient {
|
|
149
149
|
maxSockets: _options.maxSockets,
|
150
150
|
path: '/api',
|
151
151
|
timeout: _options.timeout,
|
152
|
-
validStatusCodes: [200, 400, 403
|
152
|
+
validStatusCodes: [200, 400, 403] //, 404]
|
153
153
|
}
|
154
154
|
if (_options.phoscon) {
|
155
155
|
// options.headers = { Accept: 'application/vnd.ddel.v1' }
|
package/lib/Deconz/Discovery.js
CHANGED
@@ -44,7 +44,7 @@ class Discovery extends events.EventEmitter {
|
|
44
44
|
*/
|
45
45
|
async config (host) {
|
46
46
|
const client = new homebridgeLib.HttpClient({
|
47
|
-
host
|
47
|
+
host,
|
48
48
|
json: true,
|
49
49
|
path: '/api',
|
50
50
|
timeout: this._options.timeout
|
@@ -96,7 +96,7 @@ class Discovery extends events.EventEmitter {
|
|
96
96
|
*/
|
97
97
|
async description (host) {
|
98
98
|
const options = {
|
99
|
-
host
|
99
|
+
host,
|
100
100
|
timeout: this._options.timeout
|
101
101
|
}
|
102
102
|
const client = new homebridgeLib.HttpClient(options)
|
package/lib/Deconz/Resource.js
CHANGED
@@ -256,7 +256,7 @@ class Resource {
|
|
256
256
|
get prio () {
|
257
257
|
if (this.rtype === 'groups') return -1
|
258
258
|
if (this.rtype === 'lights') return this.endpoint
|
259
|
-
return sensorsPrios.indexOf(this.
|
259
|
+
return sensorsPrios.indexOf(this.serviceName)
|
260
260
|
}
|
261
261
|
|
262
262
|
/** The resource path of the resource, e.g. `/lights/1`.
|
@@ -270,7 +270,7 @@ class Resource {
|
|
270
270
|
* corresponding HomeKit service, or `null` for unsupported and unknown
|
271
271
|
* resources.
|
272
272
|
*
|
273
|
-
* This is derived from the resource type and`type` in the resource body.
|
273
|
+
* This is derived from the resource type and `type` in the resource body.
|
274
274
|
* @type {string}
|
275
275
|
*/
|
276
276
|
get serviceName () {
|
@@ -44,6 +44,7 @@ class Gateway extends homebridgeLib.AccessoryDelegate {
|
|
44
44
|
|
45
45
|
this.gateway = this
|
46
46
|
this.id = params.config.bridgeid
|
47
|
+
this.recommendedSoftware = this.platform.packageJson.engines.deCONZ
|
47
48
|
|
48
49
|
/** Persisted properties.
|
49
50
|
* @type {Object}
|
@@ -109,6 +110,9 @@ class Gateway extends homebridgeLib.AccessoryDelegate {
|
|
109
110
|
'%s %s gateway v%s', this.values.manufacturer, this.values.model,
|
110
111
|
this.values.software
|
111
112
|
)
|
113
|
+
if (this.values.software !== this.recommendedSoftware) {
|
114
|
+
this.warn('recommended version: deCONZ v%s', this.recommendedSoftware)
|
115
|
+
}
|
112
116
|
|
113
117
|
/** Map of Accessory delegates by id for the gateway.
|
114
118
|
* @type {Object<string, DeconzAccessory.Device>}
|
@@ -182,6 +186,9 @@ class Gateway extends homebridgeLib.AccessoryDelegate {
|
|
182
186
|
this.values.manufacturer, this.values.model, this.values.software,
|
183
187
|
this.nAccessories, this.nDevices, this.nResourcesMonitored
|
184
188
|
)
|
189
|
+
if (this.values.software !== this.recommendedSoftware) {
|
190
|
+
this.warn('recommended version: deCONZ v%s', this.recommendedSoftware)
|
191
|
+
}
|
185
192
|
if (this.context.migration != null) {
|
186
193
|
this.log(
|
187
194
|
'migration: %s: %d resources',
|
@@ -716,11 +723,11 @@ class Gateway extends homebridgeLib.AccessoryDelegate {
|
|
716
723
|
this.vdebug('polling done')
|
717
724
|
this.pollNext = false
|
718
725
|
this.polling = false
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
726
|
+
}
|
727
|
+
if (!this.initialised) {
|
728
|
+
this.initialised = true
|
729
|
+
this.debug('initialised')
|
730
|
+
this.emit('initialised')
|
724
731
|
}
|
725
732
|
}
|
726
733
|
|
package/lib/DeconzPlatform.js
CHANGED
@@ -70,13 +70,17 @@ class DeconzPlatform extends homebridgeLib.Platform {
|
|
70
70
|
})
|
71
71
|
this.discovery
|
72
72
|
.on('error', (error) => {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
if (error instanceof homebridgeLib.HttpClient.HttpError) {
|
74
|
+
this.log(
|
75
|
+
'%s: request %d: %s %s', error.request.name,
|
76
|
+
error.request.id, error.request.method, error.request.resource
|
77
|
+
)
|
78
|
+
this.warn(
|
79
|
+
'%s: request %d: %s', error.request.name, error.request.id, error
|
80
|
+
)
|
81
|
+
return
|
82
|
+
}
|
83
|
+
this.warn(error)
|
80
84
|
})
|
81
85
|
.on('request', (request) => {
|
82
86
|
this.debug(
|
@@ -105,10 +109,7 @@ class DeconzPlatform extends homebridgeLib.Platform {
|
|
105
109
|
async foundGateway (host, config) {
|
106
110
|
const id = config.bridgeid
|
107
111
|
if (this.gatewayMap[id] == null) {
|
108
|
-
this.gatewayMap[id] = new DeconzAccessory.Gateway(this, {
|
109
|
-
config: config,
|
110
|
-
host: host
|
111
|
-
})
|
112
|
+
this.gatewayMap[id] = new DeconzAccessory.Gateway(this, { config, host })
|
112
113
|
}
|
113
114
|
await this.gatewayMap[id].found(host, config)
|
114
115
|
await events.once(this.gatewayMap[id], 'initialised')
|
@@ -190,7 +191,7 @@ class DeconzPlatform extends homebridgeLib.Platform {
|
|
190
191
|
gatewayByHost[gateway.context.host] = {
|
191
192
|
config: gateway.context.config,
|
192
193
|
host: gateway.context.host,
|
193
|
-
id
|
194
|
+
id
|
194
195
|
}
|
195
196
|
}
|
196
197
|
return {
|
@@ -51,7 +51,7 @@ class Light extends DeconzService.LightsResource {
|
|
51
51
|
}).on('didSet', (value, fromHomeKit) => {
|
52
52
|
if (fromHomeKit) {
|
53
53
|
const bri = Math.round(value * 2.54)
|
54
|
-
this.put({ bri
|
54
|
+
this.put({ bri })
|
55
55
|
this.updateAdaptiveLighting()
|
56
56
|
}
|
57
57
|
})
|
@@ -97,7 +97,7 @@ class Light extends DeconzService.LightsResource {
|
|
97
97
|
this.capabilities.ctMin, Math.min(value, this.capabilities.ctMax)
|
98
98
|
)
|
99
99
|
if (fromHomeKit) {
|
100
|
-
this.put({ ct
|
100
|
+
this.put({ ct })
|
101
101
|
this.values.colormode = 'ct'
|
102
102
|
}
|
103
103
|
if (this.capabilities.xy && this.values.colormode === 'ct') {
|
@@ -118,7 +118,7 @@ class Light extends DeconzService.LightsResource {
|
|
118
118
|
const xy = hsvToXy(
|
119
119
|
value, this.values.saturation, this.capabilities.gamut
|
120
120
|
)
|
121
|
-
this.put({ xy
|
121
|
+
this.put({ xy })
|
122
122
|
this.values.colormode = 'xy'
|
123
123
|
}
|
124
124
|
})
|
@@ -129,7 +129,7 @@ class Light extends DeconzService.LightsResource {
|
|
129
129
|
}).on('didSet', (value, fromHomeKit) => {
|
130
130
|
if (fromHomeKit) {
|
131
131
|
const xy = hsvToXy(this.values.hue, value, this.capabilities.gamut)
|
132
|
-
this.put({ xy
|
132
|
+
this.put({ xy })
|
133
133
|
this.values.colormode = 'xy'
|
134
134
|
}
|
135
135
|
})
|
@@ -141,7 +141,7 @@ class Light extends DeconzService.LightsResource {
|
|
141
141
|
}).on('didSet', (value, fromHomeKit) => {
|
142
142
|
if (fromHomeKit) {
|
143
143
|
const hue = Math.round(this.values.hue * 65535.0 / 360.0)
|
144
|
-
this.put({ hue
|
144
|
+
this.put({ hue })
|
145
145
|
this.values.colormode = 'hs'
|
146
146
|
}
|
147
147
|
})
|
@@ -152,7 +152,7 @@ class Light extends DeconzService.LightsResource {
|
|
152
152
|
}).on('didSet', (value, fromHomeKit) => {
|
153
153
|
if (fromHomeKit) {
|
154
154
|
const sat = Math.round(this.values.saturation * 254.0 / 100.0)
|
155
|
-
this.put({ sat
|
155
|
+
this.put({ sat })
|
156
156
|
this.values.colormode = 'hs'
|
157
157
|
}
|
158
158
|
})
|
@@ -165,7 +165,7 @@ class Light extends DeconzService.LightsResource {
|
|
165
165
|
}).on('didSet', (value, fromHomeKit) => {
|
166
166
|
if (fromHomeKit) {
|
167
167
|
const effect = value ? 'colorloop' : 'none'
|
168
|
-
const state = { effect
|
168
|
+
const state = { effect }
|
169
169
|
if (value) {
|
170
170
|
state.colorloopspeed = this.values.colorLoopSpeed
|
171
171
|
}
|
@@ -181,7 +181,7 @@ class Light extends DeconzService.LightsResource {
|
|
181
181
|
}).on('didSet', (value, fromHomeKit) => {
|
182
182
|
if (fromHomeKit) {
|
183
183
|
const effect = 'colorloop'
|
184
|
-
this.put({ effect
|
184
|
+
this.put({ effect, colorloopspeed: value })
|
185
185
|
this.values.colormode = 'hs'
|
186
186
|
}
|
187
187
|
})
|
@@ -467,7 +467,7 @@ class Light extends DeconzService.LightsResource {
|
|
467
467
|
if (this.values.colormode === 'ct' && ct === this.values.colorTemperature) {
|
468
468
|
return
|
469
469
|
}
|
470
|
-
this.put({ ct
|
470
|
+
this.put({ ct })
|
471
471
|
this.fromAdaptiveLighting = true
|
472
472
|
this.values.colormode = 'ct'
|
473
473
|
if (ct !== this.values.colorTemperature) {
|
@@ -35,7 +35,7 @@ class Motion extends DeconzService.SensorsResource {
|
|
35
35
|
: value === this.Characteristics.eve.Sensitivity.LOW
|
36
36
|
? 0
|
37
37
|
: Math.round(this.sensitivitymax / 2)
|
38
|
-
await this.put('/config', { sensitivity
|
38
|
+
await this.put('/config', { sensitivity })
|
39
39
|
}
|
40
40
|
})
|
41
41
|
|
@@ -42,8 +42,8 @@ class Switch extends DeconzService.SensorsResource {
|
|
42
42
|
this.buttonServices[i] = new DeconzService.Button(this.accessoryDelegate, {
|
43
43
|
name: this.name + ' ' + label,
|
44
44
|
button: Number(i),
|
45
|
-
events
|
46
|
-
hasRepeat
|
45
|
+
events,
|
46
|
+
hasRepeat
|
47
47
|
})
|
48
48
|
}
|
49
49
|
}
|
@@ -27,6 +27,7 @@ class Temperature extends DeconzService.SensorsResource {
|
|
27
27
|
key: 'offset',
|
28
28
|
Characteristic: this.Characteristics.my.Offset,
|
29
29
|
unit: '°C',
|
30
|
+
props: { minValue: -5, maxValue: 5, minStep: 0.1 },
|
30
31
|
value: 0
|
31
32
|
}).on('didSet', async (value, fromHomeKit) => {
|
32
33
|
if (fromHomeKit) {
|
@@ -77,6 +77,7 @@ class Thermostat extends DeconzService.SensorsResource {
|
|
77
77
|
key: 'offset',
|
78
78
|
Characteristic: this.Characteristics.my.Offset,
|
79
79
|
unit: '°C',
|
80
|
+
props: { minValue: -5, maxValue: 5, minStep: 0.1 },
|
80
81
|
value: 0
|
81
82
|
}).on('didSet', async (value, fromHomeKit) => {
|
82
83
|
if (fromHomeKit) {
|
@@ -114,7 +114,7 @@ class WindowCovering extends DeconzService.LightsResource {
|
|
114
114
|
? this.Characteristics.hap.PositionState.INCREASING
|
115
115
|
: this.Characteristics.hap.PositionState.DECREASING
|
116
116
|
this.moving = new Date()
|
117
|
-
await this.put({ lift
|
117
|
+
await this.put({ lift })
|
118
118
|
}
|
119
119
|
|
120
120
|
updateState (state) {
|
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.
|
7
|
+
"version": "0.0.16",
|
8
8
|
"keywords": [
|
9
9
|
"homebridge-plugin",
|
10
10
|
"homekit",
|
@@ -20,12 +20,12 @@
|
|
20
20
|
"deconz": "cli/deconz.js"
|
21
21
|
},
|
22
22
|
"engines": {
|
23
|
-
"deCONZ": "2.
|
23
|
+
"deCONZ": "2.15.3",
|
24
24
|
"homebridge": "^1.4.0",
|
25
25
|
"node": "^16.14.2"
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
|
-
"homebridge-lib": "~5.
|
28
|
+
"homebridge-lib": "~5.5.0",
|
29
29
|
"semver": "^7.3.7",
|
30
30
|
"ws": "^8.5.0",
|
31
31
|
"xml2js": "~0.4.23"
|