homebridge-deconz 0.0.15 → 0.0.18
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/README.md +1 -4
- package/cli/deconz.js +2 -2
- package/homebridge-ui/public/index.html +249 -460
- package/homebridge-ui/public/index.old.html +506 -0
- package/lib/Deconz/ApiClient.js +3 -4
- package/lib/Deconz/Discovery.js +7 -4
- package/lib/Deconz/Resource.js +20 -3
- package/lib/DeconzAccessory/AirPurifier.js +38 -0
- package/lib/DeconzAccessory/Gateway.js +44 -20
- package/lib/DeconzAccessory/Motion.js +3 -0
- package/lib/DeconzAccessory/index.js +3 -3
- package/lib/DeconzPlatform.js +13 -12
- package/lib/DeconzService/AirPurifier.js +216 -0
- package/lib/DeconzService/AirQuality.js +23 -7
- package/lib/DeconzService/Button.js +4 -0
- package/lib/DeconzService/Consumption.js +1 -1
- package/lib/DeconzService/Contact.js +2 -0
- package/lib/DeconzService/Light.js +9 -9
- package/lib/DeconzService/LightLevel.js +2 -0
- package/lib/DeconzService/Motion.js +1 -1
- package/lib/DeconzService/Outlet.js +1 -1
- package/lib/DeconzService/Power.js +1 -1
- package/lib/DeconzService/Switch.js +35 -23
- package/lib/DeconzService/Temperature.js +1 -0
- package/lib/DeconzService/Thermostat.js +1 -0
- package/lib/DeconzService/WindowCovering.js +1 -1
- package/lib/DeconzService/index.js +1 -0
- package/package.json +6 -6
@@ -29,10 +29,19 @@ class Switch extends DeconzService.SensorsResource {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
createButtonServices (resource) {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
if (resource.body.type === 'ZHASwitch') {
|
33
|
+
this.buttonResources[resource.rpath] = {
|
34
|
+
buttonEvent: resource.body.state.buttonevent,
|
35
|
+
lastUpdated: '',
|
36
|
+
toButtonEvent: resource.capabilities.toButtonEvent
|
37
|
+
}
|
38
|
+
} else if (resource.body.type === 'ZHARelativeRotary') {
|
39
|
+
const keys = Object.keys(resource.capabilities.buttons)
|
40
|
+
this.buttonResources[resource.rpath] = {
|
41
|
+
lastUpdated: '',
|
42
|
+
right: keys[0],
|
43
|
+
left: keys[1]
|
44
|
+
}
|
36
45
|
}
|
37
46
|
for (const i in resource.capabilities.buttons) {
|
38
47
|
const { label, events, hasRepeat } = resource.capabilities.buttons[i]
|
@@ -42,8 +51,8 @@ class Switch extends DeconzService.SensorsResource {
|
|
42
51
|
this.buttonServices[i] = new DeconzService.Button(this.accessoryDelegate, {
|
43
52
|
name: this.name + ' ' + label,
|
44
53
|
button: Number(i),
|
45
|
-
events
|
46
|
-
hasRepeat
|
54
|
+
events,
|
55
|
+
hasRepeat
|
47
56
|
})
|
48
57
|
}
|
49
58
|
}
|
@@ -57,17 +66,27 @@ class Switch extends DeconzService.SensorsResource {
|
|
57
66
|
state.lastupdated !== buttonResource.lastUpdated
|
58
67
|
) {
|
59
68
|
buttonResource.lastUpdated = state.lastupdated
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
69
|
+
if (buttonResource.buttonEvent !== undefined) {
|
70
|
+
const oldValue = buttonResource.buttonEvent
|
71
|
+
if (state.buttonevent != null) {
|
72
|
+
buttonResource.buttonEvent = buttonResource.toButtonEvent == null
|
73
|
+
? state.buttonevent
|
74
|
+
: buttonResource.toButtonEvent(state.buttonevent)
|
75
|
+
}
|
76
|
+
// TODO handle repeat
|
77
|
+
const i = Math.floor(buttonResource.buttonEvent / 1000)
|
78
|
+
if (this.buttonServices[i] != null) {
|
79
|
+
this.buttonServices[i].update(
|
80
|
+
buttonResource.buttonEvent, oldValue,
|
81
|
+
this.accessoryDelegate.settingsService.values.repeat
|
82
|
+
)
|
83
|
+
}
|
84
|
+
} else {
|
85
|
+
const i = state.expectedrotation >= 0
|
86
|
+
? buttonResource.right
|
87
|
+
: buttonResource.left
|
88
|
+
this.buttonServices[i].updateRotation()
|
65
89
|
}
|
66
|
-
// TODO handle repeat
|
67
|
-
this.updateButtonEvent(
|
68
|
-
buttonResource.buttonEvent, oldValue,
|
69
|
-
this.accessoryDelegate.settingsService.values.repeat
|
70
|
-
)
|
71
90
|
}
|
72
91
|
super.updateState(state)
|
73
92
|
}
|
@@ -77,13 +96,6 @@ class Switch extends DeconzService.SensorsResource {
|
|
77
96
|
super.updateConfig(config)
|
78
97
|
}
|
79
98
|
|
80
|
-
updateButtonEvent (value, oldValue, repeat) {
|
81
|
-
const i = Math.floor(value / 1000)
|
82
|
-
if (this.buttonServices[i] != null) {
|
83
|
-
this.buttonServices[i].update(value, oldValue, repeat)
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
99
|
async identify () {
|
88
100
|
this.debug('hasRepeat: %j', this.hasRepeat)
|
89
101
|
return super.identify()
|
@@ -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) {
|
@@ -15,6 +15,7 @@ const { dateToString } = Deconz.ApiClient
|
|
15
15
|
*/
|
16
16
|
class DeconzService extends homebridgeLib.ServiceDelegate {
|
17
17
|
static get AirPressure () { return require('./AirPressure') }
|
18
|
+
static get AirPurifier () { return require('./AirPurifier') }
|
18
19
|
static get AirQuality () { return require('./AirQuality') }
|
19
20
|
static get Alarm () { return require('./Alarm') }
|
20
21
|
static get Battery () { return require('./Battery') }
|
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.18",
|
8
8
|
"keywords": [
|
9
9
|
"homebridge-plugin",
|
10
10
|
"homekit",
|
@@ -20,14 +20,14 @@
|
|
20
20
|
"deconz": "cli/deconz.js"
|
21
21
|
},
|
22
22
|
"engines": {
|
23
|
-
"deCONZ": "2.
|
24
|
-
"homebridge": "^1.
|
25
|
-
"node": "^16.
|
23
|
+
"deCONZ": "2.17.1",
|
24
|
+
"homebridge": "^1.5.0",
|
25
|
+
"node": "^16.16.0"
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
|
-
"homebridge-lib": "~5.4
|
28
|
+
"homebridge-lib": "~5.6.4",
|
29
29
|
"semver": "^7.3.7",
|
30
|
-
"ws": "^8.
|
30
|
+
"ws": "^8.8.1",
|
31
31
|
"xml2js": "~0.4.23"
|
32
32
|
},
|
33
33
|
"scripts": {
|