homebridge-deconz 0.1.2 → 0.1.3
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 -1
- package/cli/deconz.js +1 -1
- package/cli/ui.sh +83 -0
- package/homebridge-ui/public/index.html +1 -1
- package/homebridge-ui/public/index.old.html +1 -1
- package/homebridge-ui/server.js +1 -1
- package/index.js +1 -1
- package/lib/Deconz/ApiClient.js +1 -1
- package/lib/Deconz/ApiError.js +1 -1
- package/lib/Deconz/ApiResponse.js +1 -1
- package/lib/Deconz/Device.js +1 -1
- package/lib/Deconz/Discovery.js +2 -2
- package/lib/Deconz/Resource.js +1 -1
- package/lib/Deconz/WsClient.js +1 -1
- package/lib/Deconz/index.js +1 -1
- package/lib/DeconzAccessory/AirPurifier.js +1 -1
- package/lib/DeconzAccessory/Gateway.js +1 -1
- package/lib/DeconzAccessory/Light.js +2 -1
- package/lib/DeconzAccessory/Sensor.js +3 -3
- package/lib/DeconzAccessory/Thermostat.js +1 -1
- package/lib/DeconzAccessory/WarningDevice.js +1 -1
- package/lib/DeconzAccessory/WindowCovering.js +1 -1
- package/lib/DeconzAccessory/index.js +1 -1
- package/lib/DeconzPlatform.js +1 -1
- package/lib/DeconzService/AirPressure.js +1 -1
- package/lib/DeconzService/AirPurifier.js +1 -1
- package/lib/DeconzService/AirQuality.js +1 -1
- package/lib/DeconzService/Alarm.js +1 -1
- package/lib/DeconzService/Battery.js +1 -1
- package/lib/DeconzService/Button.js +1 -1
- package/lib/DeconzService/CarbonMonoxide.js +1 -1
- package/lib/DeconzService/Consumption.js +1 -1
- package/lib/DeconzService/Contact.js +1 -1
- package/lib/DeconzService/Daylight.js +1 -1
- package/lib/DeconzService/Flag.js +1 -1
- package/lib/DeconzService/Gateway.js +1 -1
- package/lib/DeconzService/Humidity.js +1 -1
- package/lib/DeconzService/Leak.js +1 -1
- package/lib/DeconzService/Light.js +2 -3
- package/lib/DeconzService/LightLevel.js +1 -1
- package/lib/DeconzService/LightsResource.js +1 -1
- package/lib/DeconzService/Motion.js +1 -1
- package/lib/DeconzService/Outlet.js +1 -1
- package/lib/DeconzService/Power.js +1 -1
- package/lib/DeconzService/SensorsResource.js +1 -1
- package/lib/DeconzService/Smoke.js +1 -1
- package/lib/DeconzService/Status.js +1 -1
- package/lib/DeconzService/Switch.js +1 -1
- package/lib/DeconzService/Temperature.js +1 -1
- package/lib/DeconzService/Thermostat.js +1 -1
- package/lib/DeconzService/WarningDevice.js +1 -1
- package/lib/DeconzService/WindowCovering.js +1 -1
- package/lib/DeconzService/index.js +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
</span>
|
17
17
|
|
18
18
|
## Homebridge plugin for deCONZ
|
19
|
-
Copyright
|
19
|
+
Copyright© 2022-2023 Erik Baauw. All rights reserved.
|
20
20
|
|
21
21
|
### Work in Progress
|
22
22
|
See [Future Development of Homebridge Hue](https://github.com/ebaauw/homebridge-hue/issues/1070) for positioning Homebridge deCONZ versus Homebridge Hue.
|
package/cli/deconz.js
CHANGED
package/cli/ui.sh
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# homebridge-deconz/cli/ui.sh
|
4
|
+
# Copyright © 2023 Erik Baauw. All rights reserved.
|
5
|
+
#
|
6
|
+
# Command line interface to Homebridge deCONZ UI Server.
|
7
|
+
|
8
|
+
me=$(basename "$0")
|
9
|
+
|
10
|
+
function fatal() {
|
11
|
+
echo "${me}: $1" >&2
|
12
|
+
exit 1
|
13
|
+
}
|
14
|
+
|
15
|
+
if [ -z "${HOMEBRIDGE_DIR}" ] ; then
|
16
|
+
if [ -d /var/lib/homebridge ] ; then
|
17
|
+
HOMEBRIDGE_DIR=/var/lib/homebridge
|
18
|
+
elif [ -d ~/.homebridge ] ; then
|
19
|
+
HOMEBRIDGE_DIR=~/.homebridge
|
20
|
+
else
|
21
|
+
fatal "cannot find Homebridge directory - set HOMEBRIDGE_DIR"
|
22
|
+
fi
|
23
|
+
fi
|
24
|
+
|
25
|
+
if [ ! -f "${HOMEBRIDGE_DIR}/config.json" ] ; then
|
26
|
+
fatal "${HOMEBRIDGE_DIR|}/config.json: no such file"
|
27
|
+
fi
|
28
|
+
|
29
|
+
platformId=$(json -alp /platforms "${HOMEBRIDGE_DIR}/config.json" | grep /platform:\"deCONZ\" | cut -d / -f 2)
|
30
|
+
if [ -z "${platformId}" ] ; then
|
31
|
+
fatal "${HOMEBRIDGE_DIR}/config.json: cannot find deCONZ platform"
|
32
|
+
fi
|
33
|
+
|
34
|
+
username=$(json -alp /platforms/${platformId}/_bridge "${HOMEBRIDGE_DIR}/config.json" | grep /username: | cut -d \" -f 2 | sed -e "s/://g")
|
35
|
+
if [ -z "${username}" ] ; then
|
36
|
+
# Main Homebridge instance
|
37
|
+
cachedAccessories="${HOMEBRIDGE_DIR}/accessories/cachedAccessories"
|
38
|
+
else
|
39
|
+
# Child bridge instance
|
40
|
+
cachedAccessories="${HOMEBRIDGE_DIR}/accessories/cachedAccessories.${username}"
|
41
|
+
fi
|
42
|
+
if [ ! -f "${cachedAccessories}" ] ; then
|
43
|
+
fatal "${cachedAccessories}: no such file"
|
44
|
+
exit 1
|
45
|
+
fi
|
46
|
+
|
47
|
+
uiPort=$(json -alp /${platformId}/context "${cachedAccessories}" | grep /uiPort: | cut -d : -f 2)
|
48
|
+
gateway=$(json -alp /${platformId}/context "${cachedAccessories}" | grep /gid: | cut -d \" -f 2)
|
49
|
+
|
50
|
+
url="http://127.0.0.1:${uiPort}"
|
51
|
+
|
52
|
+
if [ "$(curl -s ${url}/ping)" != '"pong"' ] ; then
|
53
|
+
fatal "${url}: cannot connect to UI server"
|
54
|
+
fi
|
55
|
+
|
56
|
+
if [ -z "${1}" ] ; then
|
57
|
+
cat - >&2 <<+
|
58
|
+
Usage: ${me} command [arguments]
|
59
|
+
|
60
|
+
Commands:
|
61
|
+
get Get gateway details.
|
62
|
+
put body Update gateway settings.
|
63
|
+
getDevices Get list of devices.
|
64
|
+
getDevice id Get device details.
|
65
|
+
putDevice id body Update device settings.
|
66
|
+
getAccessories Get list of accessories
|
67
|
+
getAccessory id Get accessory details
|
68
|
+
putAccessory id body Update accessory settings.
|
69
|
+
+
|
70
|
+
exit 1
|
71
|
+
fi
|
72
|
+
|
73
|
+
case "$1" in
|
74
|
+
get) curl -s ${url}/gateways/${gateway} | json ;;
|
75
|
+
put) curl -s -X PUT -d "${2}" ${url}/gateways/${gateway}/settings | json ;;
|
76
|
+
getDevices) curl -s ${url}/gateways/${gateway}/devices | json ;;
|
77
|
+
getDevice) curl -s ${url}/gateways/${gateway}/devices/${1} | json ;;
|
78
|
+
putDevice) curl -s -X PUT -d "${2}" ${url}/gateways/${gateway}/devices/${1}/settings | json ;;
|
79
|
+
getAccessories) curl -s ${url}/gateways/${gateway}/accessories | json ;;
|
80
|
+
getAccessory) curl -s ${url}/gateways/${gateway}/accessories/${1} | json ;;
|
81
|
+
putAccessory) curl -s -X PUT -d "${2}" ${url}/gateways/${gateway}/accessories/${1}/settings | json ;;
|
82
|
+
*) fatal "${1}: invalid command" ;;
|
83
|
+
esac
|
package/homebridge-ui/server.js
CHANGED
package/index.js
CHANGED
package/lib/Deconz/ApiClient.js
CHANGED
package/lib/Deconz/ApiError.js
CHANGED
package/lib/Deconz/Device.js
CHANGED
package/lib/Deconz/Discovery.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
// homebridge-hue/lib/Deconz/Discovery.js
|
2
2
|
//
|
3
3
|
// Homebridge plug-in for Philips Hue and/or deCONZ.
|
4
|
-
// Copyright © 2018-
|
4
|
+
// Copyright © 2018-2023 Erik Baauw. All rights reserved.
|
5
5
|
|
6
6
|
'use strict'
|
7
7
|
|
@@ -130,7 +130,7 @@ class Discovery extends events.EventEmitter {
|
|
130
130
|
this.jobs.push(this._upnp())
|
131
131
|
if (!stealth) {
|
132
132
|
this.jobs.push(this._nupnp({
|
133
|
-
name: 'phoscon',
|
133
|
+
name: 'phoscon.de',
|
134
134
|
https: !this._options.forceHttp,
|
135
135
|
host: 'phoscon.de',
|
136
136
|
path: '/discover'
|
package/lib/Deconz/Resource.js
CHANGED
package/lib/Deconz/WsClient.js
CHANGED
package/lib/Deconz/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// homebridge-deconz/lib/DeconzAccessory/Light.js
|
2
|
-
// Copyright
|
2
|
+
// Copyright© 2022-2023 Erik Baauw. All rights reserved.
|
3
3
|
//
|
4
4
|
// Homebridge plugin for deCONZ.
|
5
5
|
|
@@ -78,6 +78,7 @@ class Light extends DeconzAccessory {
|
|
78
78
|
})
|
79
79
|
}
|
80
80
|
} else if (this.serviceByServiceName.Power != null) {
|
81
|
+
params.powerDelegate = this.service.characteristicDelegate('currentConsumption')
|
81
82
|
// Total Consumption to be computed by history
|
82
83
|
params.computedConsumptionDelegate = this.service.addCharacteristicDelegate({
|
83
84
|
key: 'totalConsumption',
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// homebridge-deconz/lib/DeconzAccessory/Sensor.js
|
2
|
-
// Copyright
|
2
|
+
// Copyright© 2022-2023 Erik Baauw. All rights reserved.
|
3
3
|
//
|
4
4
|
// Homebridge plugin for deCONZ.
|
5
5
|
|
@@ -70,7 +70,7 @@ class Sensor extends DeconzAccessory {
|
|
70
70
|
if (this.serviceByServiceName.Motion != null) {
|
71
71
|
const service = this.serviceByServiceName.Motion
|
72
72
|
params.motionDelegate = service.characteristicDelegate('motion')
|
73
|
-
params.lastMotionDelegate =
|
73
|
+
params.lastMotionDelegate = service.addCharacteristicDelegate({
|
74
74
|
key: 'lastActivation',
|
75
75
|
Characteristic: this.Characteristics.eve.LastActivation,
|
76
76
|
silent: true
|
@@ -105,7 +105,7 @@ class Sensor extends DeconzAccessory {
|
|
105
105
|
if (this.serviceByServiceName.Flag != null) {
|
106
106
|
const service = this.serviceByServiceName.Flag
|
107
107
|
params.switchOnDelegate = service.characteristicDelegate('on')
|
108
|
-
params.lastSwitchOnDelegate =
|
108
|
+
params.lastSwitchOnDelegate = service.addCharacteristicDelegate({
|
109
109
|
key: 'lastActivation',
|
110
110
|
Characteristic: this.Characteristics.eve.LastActivation,
|
111
111
|
silent: true
|
package/lib/DeconzPlatform.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// homebridge-deconz/lib/DeconzService/Light.js
|
2
|
-
// Copyright
|
2
|
+
// Copyright© 2022-2023 Erik Baauw. All rights reserved.
|
3
3
|
//
|
4
4
|
// Homebridge plugin for deCONZ.
|
5
5
|
|
@@ -294,8 +294,7 @@ class Light extends DeconzService.LightsResource {
|
|
294
294
|
const service = new homebridgeLib.ServiceDelegate(this.accessoryDelegate, {
|
295
295
|
name: this.resource.body.name + ' ' + effect,
|
296
296
|
Service: this.Services.hap.Lightbulb,
|
297
|
-
subtype: this.subtype + '-E' + id
|
298
|
-
exposeConfiguredName: true
|
297
|
+
subtype: (this.subtype == null ? 'E' : this.subtype + '-E') + id
|
299
298
|
})
|
300
299
|
service.addCharacteristicDelegate({
|
301
300
|
key: 'on',
|
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.
|
7
|
+
"version": "0.1.3",
|
8
8
|
"keywords": [
|
9
9
|
"homebridge-plugin",
|
10
10
|
"homekit",
|
@@ -17,15 +17,16 @@
|
|
17
17
|
],
|
18
18
|
"main": "index.js",
|
19
19
|
"bin": {
|
20
|
-
"deconz": "cli/deconz.js"
|
20
|
+
"deconz": "cli/deconz.js",
|
21
|
+
"ui": "cli/ui.sh"
|
21
22
|
},
|
22
23
|
"engines": {
|
23
24
|
"deCONZ": "2.19.3",
|
24
25
|
"homebridge": "^1.6.0",
|
25
|
-
"node": "^18.
|
26
|
+
"node": "^18.14.0"
|
26
27
|
},
|
27
28
|
"dependencies": {
|
28
|
-
"homebridge-lib": "~6.3.
|
29
|
+
"homebridge-lib": "~6.3.5",
|
29
30
|
"ws": "^8.12.0",
|
30
31
|
"xml2js": "~0.4.23"
|
31
32
|
},
|