homebridge-deconz 0.1.19 → 1.0.0

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 CHANGED
@@ -18,19 +18,14 @@
18
18
  ## Homebridge plugin for deCONZ
19
19
  Copyright© 2022-2023 Erik Baauw. All rights reserved.
20
20
 
21
- ### Work in Progress
22
- See [Future Development of Homebridge Hue](https://github.com/ebaauw/homebridge-hue/issues/1070) for positioning Homebridge deCONZ versus Homebridge Hue.
23
-
24
- Homebridge deCONZ is still under development.
25
- See [Releases](https://github.com/ebaauw/homebridge-deconz/releases) for more details.
26
-
27
- If you have a question, please post a message to the **#deconz** channel of the Homebridge community on [Discord](https://discord.gg/zUhSZSNb4P).
28
-
29
21
  ### Introduction
30
22
  This [Homebridge](https://github.com/homebridge/homebridge) plugin exposes to Apple's [HomeKit](http://www.apple.com/ios/home/) ZigBee devices (lights, plugs, sensors, switches, ...) and virtual devices on a deCONZ gateway by dresden elektronik.
31
23
  Homebridge deCONZ communicates with deCONZ over its [REST API](https://dresden-elektronik.github.io/deconz-rest-doc/), provided by its [REST API plugin](https://github.com/dresden-elektronik/deconz-rest-plugin).
32
24
  It runs independently from the Phoscon web app, see [deCONZ for Dummies](https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/deCONZ-for-Dummies).
33
25
 
26
+ Homebridge deCONZ is the successor of Homebridge Hue for exposing Zigbee devices connected to a deCONZ gateway.
27
+ See [Future Development of Homebridge Hue](https://github.com/ebaauw/homebridge-hue/issues/1070) for more details.
28
+
34
29
  ### Prerequisites
35
30
  You need a deCONZ gateway to connect Homebridge deCONZ to your ZigBee devices (lights, plugs, sensors, switches, ...).
36
31
  For Zigbee communication, the deCONZ gateway requires a [ConBee II](https://phoscon.de/en/conbee2) or [Conbee](https://phoscon.de/en/conbee) USB stick, or a [RaspBee II](https://phoscon.de/en/raspbee2) or [RaspBee](https://phoscon.de/en/raspbee) Raspberry Pi shield.
@@ -41,47 +36,93 @@ You need a server to run Homebridge.
41
36
  This can be anything running [Node.js](https://nodejs.org): from a Raspberry Pi, a NAS system, or an always-on PC running Linux, macOS, or Windows.
42
37
  I strongly recommend to use a standard Homebridge installation, see the [Homebridge Wiki](https://github.com/homebridge/homebridge/wiki) for details.
43
38
  I recommend to run deCONZ and Homebridge deCONZ on the same server, avoiding any network latency between deCONZ and Homebridge deCONZ, and preventing any potential network issues.
44
- I strongly recommend to run Homebridge deCONZ in a separate Homebridge installation, with the Homebridge UI as only other plugin, or in a separate [child bridge](https://github.com/homebridge/homebridge/wiki/Child-Bridges), in a Homebridge installation with other plugins.
39
+ I strongly recommend to run Homebridge deCONZ in a separate [child bridge](https://github.com/homebridge/homebridge/wiki/Child-Bridges).
45
40
 
46
41
  To interact with HomeKit, you need an Apple device with Siri or a HomeKit app.
47
42
  Please note that Siri and Apple's [Home](https://support.apple.com/en-us/HT204893) app only provide limited HomeKit support.
48
- To configure Homebridge deCONZ, and to use its full features, you need another HomeKit app, like [Eve](https://www.evehome.com/en/eve-app) (free) or Matthias Hochgatterer's [Home+](https://hochgatterer.me/home/) (paid).
43
+ To use the full features of Homebridge deCONZ, you need another HomeKit app, like [Eve](https://www.evehome.com/en/eve-app) (free) or Matthias Hochgatterer's [Home+](https://hochgatterer.me/home/) (paid).
49
44
  As HomeKit uses mDNS (formally known as Bonjour) to discover Homebridge, the server running Homebridge must be on the same subnet as your Apple devices running HomeKit.
50
45
  Most cases of _Not Responding_ accessories are due to mDNS issues.
51
46
  For remote access and for HomeKit automations (incl. support for wireless switches), you need to setup an Apple TV (4th generation or later), HomePod, or iPad as [home hub](https://support.apple.com/en-us/HT207057).
52
- I recommend to use the latest released version of the Apple device OS: iOS, iPadOS, macOS, ...
47
+ I recommend to use the latest released non-beta version of the Apple device OS: iOS, iPadOS, macOS, ...
53
48
  HomeKit doesn't seem to like using different Apple device OS versions.
54
49
 
55
50
  ### Configuration
56
- Most settings for Homebridge deCONZ can be changed at run-time from HomeKit, by the owner of the HomeKit home.
57
- These settings are persisted across Homebridge restarts.
58
- In config.json, you only need to specify the platform, and maybe the hostname or IP address and port of your deCONZ gateway(s).
59
- See the [Wiki](https://github.com/ebaauw/homebridge-deconz/wiki/Configuration) for details and examples.
60
-
61
- Homebridge deCONZ exposes a [gateway accessory](https://github.com/ebaauw/homebridge-deconz/wiki/Gateway-Accessory) for each deCONZ gateway.
62
- In Apple's Home app, this accessory looks like a wireless switch; you'll need another HomeKit app to configure the accessory.
51
+ Most settings for Homebridge deCONZ, can be changed at run-time, including which devices to expose, how to expose these, and the level of logging.
52
+ This keeps `config.json` extremely simple.
53
+ Typically, you only need to specify the hostname and port of the deCONZ gateway(s) in `config.json`.
54
+ See [`Configuration`](https://github.com/ebaauw/homebridge-deconz/wiki/Configuration) in the Wiki for details.
55
+ I strongly recommended to run Homebridge deCONZ in a separate [child bridge](https://github.com/homebridge/homebridge/wiki/Child-Bridges).
56
+
57
+ Homebridge deCONZ provides a Configuration API to change the run-time settings.
58
+ These changes take effect immediately, and are persisted across Homebridge restarts.
59
+ See [`Dynamic Configuration`](https://github.com/ebaauw/homebridge-deconz/wiki/Dynamic-Configuration) in the Wiki for details.
60
+ For now, these dynamic settings are managed through the `ui` command-line tool.
61
+ Eventually, Homebridge deCONZ might provide a configuration user interface to the Homebridge UI, using this configuration API.
63
62
 
64
63
  When it connects to a deCONZ gateway for the first time, Homebridge deCONZ will try to obtain an API key for two minutes, before exposing the gateway accessory.
65
64
  Unless Homebridge deCONZ runs on the same server as the deCONZ gateway, you need to unlock the gateway to allow Homebridge deCONZ to obtain an API key.
66
- After two minutes, Homebridge deCONZ will give up, exposing the gateway accessory anyways, but marking it inactive.
67
- Set _Expose_ on the _Gateway Settings_ service of the gateway accessory to retry obtaining an API key.
65
+ If you don't, Homebridge deCONZ will give up, after two minutes.
66
+ In this case, you need to set `expose` on the gateway dynamic settings, to retry obtaining an API key.
68
67
  Homebridge deCONZ will **not** retry to obtain an API key on Homebridge restart.
69
68
 
70
- After setting _Expose Lights_, _Expose Sensors_, or _Expose Groups_ on the _Gateway Settings_ service, Homebridge deCONZ will expose a [device accessory](https://github.com/ebaauw/homebridge-deconz/wiki/Device-Accessory) for each of the corresponding devices.
71
- When clearing the characteristic, the corresponding device accessories are removed from HomeKit.
72
- Each device accessory has a _Device Settings_ service, to configure the device.
73
- Clear _Expose_ on that service, to blacklist the device, and remove the associated accessory from HomeKit.
74
- The gateway accessory gains an additional _Device Settings_ service for each blacklisted device.
75
- To re-expose the corresponding accessory, set _Expose_ on that service.
76
- Note that, unlike Homebridge Hue, Homebridge deCONZ handles blacklisting per device, instead of per resource.
77
- Setting _Expose Lights_ will include the ZHAConsumption and ZHAPower `/sensors` resources for smart plugs, and the ZHABattery for window covering devices; setting _Expose Sensors_ will exclude these.
69
+ Once it has obtained an API key, Homebridge deCONZ will expose all Zigbee devices connected to the gateway, by default.
70
+ Use the dynamic settings to exclude devices from being exposed, to change how devices are exposed, and to expose virtual devices like groups or CLIP sensors.
71
+ Homebridge deCONZ exposes a [gateway accessory](https://github.com/ebaauw/homebridge-deconz/wiki/Gateway-Accessory) for each deCONZ gateway.
72
+ In Apple's Home app, this accessory looks like a wireless switch; you'll need another HomeKit app to use the other features of this accessory.
73
+
78
74
  Note that HomeKit doesn't like configuration changes.
79
- Allow ample time after exposing or removing accessories for HomeKit to sync the changed configuration to all Apple devices.
75
+ After adding or removing accessories, allow ample time for HomeKit to sync the changed configuration to all Apple devices.
80
76
 
81
- ### Command-Line Utility
82
- Homebridge deCONZ includes the `deconz` command-line utility, to discover,
83
- monitor, and interact with a deCONZ gateway.
84
- See the [`deconz` Tutorial](https://github.com/ebaauw/homebridge-deconz/wiki/%60deconz%60-Tutorial) in the Wiki for more info.
77
+ ### Command-Line Utilities
78
+ Homebridge deCONZ includes the following command-line utilities:
79
+ - `deconz`, to discover, monitor, and interact with deCONZ gateways.
80
+ See the [`deconz` Command-Line Utility](https://github.com/ebaauw/homebridge-deconz/wiki/deconz-Command%E2%80%90Line-Utility) in the Wiki for more info.
81
+ - `otau`, to download and analyse over-the-air-update firmware files for Zigbee devices.
82
+ - `ui` to configure a running instance of Homebridge deCONZ.
83
+ See [`Dynamic Configuration`](https://github.com/ebaauw/homebridge-deconz/wiki/Dynamic-Configuration) in the Wiki for more info.
84
+
85
+ Each command-line tool takes a `-h` or `--help` argument to provide a brief overview of its functionality and command-line arguments.
85
86
 
86
87
  ### Troubleshooting
87
- - As mentioned above, Homebridge deCONZ is still under development. Sometimes, cached accessories from an older version might confuse a newer version, causing all sorts of weird errors. In this case, best un-expose the offending accessory, wait for HomeKit to remove it, and re-expose the accessory. Note that this will cause HomeKit to see a new accessory, and lose any associations with HomeKit rooms, groups, scenes, and automations.
88
+ Please check the [FAQ](https://github.com/ebaauw/homebridge-hue/wiki/FAQ) (for now still on Homebridge Hue Wiki).
89
+
90
+ #### Check Dependencies
91
+ If you run into Homebridge startup issues, please double-check what versions of Node.js and of Homebridge have been installed.
92
+ Homebridge deCONZ has been developed and tested using the [latest LTS](https://nodejs.org/en/about/releases/) version of Node.js and the [latest](https://www.npmjs.com/package/homebridge) version of Homebridge.
93
+ Other versions might or might not work - I simply don't have the bandwidth to test these.
94
+
95
+ #### Run Homebridge deCONZ Solo
96
+ If you run into Homebridge startup issues, please run Homebridge deCONZ in a separate [child bridge](https://github.com/homebridge/homebridge/wiki/Child-Bridges).
97
+
98
+ #### Debug Log File
99
+ Homebridge deCONZ outputs an info message to the Homebridge log, for each HomeKit characteristic value it sets and for each HomeKit characteristic value change notification it receives. Make sure that `logLevel` of the corresponding accessory is at least 1, to see these info messages.
100
+
101
+ Homebridge deCONZ outpits a debug message to the Homebridge log, for each interaction with a deCONZ gateway.
102
+ Make sure to run Homebridge in DEBUG mode, and that `logLevel` of the corresponding accessory is at least 2, to see these debug messages. Set `logLevel` to 3 to log the payload of the interaction with deCONZ as well.
103
+
104
+ #### Debug Dump File
105
+ To aid troubleshooting, on startup, Homebridge deCONZ dumps its environment, including its `config.json` settings, dynamic settings, and the full state of all gateways into a compresed json file, `homebridge-deconz.json.gz`.
106
+ This file is located in the Homebridge user directory.
107
+
108
+ #### Getting help
109
+ If you have a question about Homebridge deCONZ, please post a message to the **#deconz** channel of the Homebridge community on [Discord](https://discord.gg/zUhSZSNb4P).
110
+
111
+ If you encounter a problem with Homebridge deCONZ, please open an issue on [GitHub](https://github.com/ebaauw/homebridge-deconz/issues).
112
+ Please attach a copy of `homebridge-deconz.json.gz` to the issue, see [**Debug Dump File**](#debug-dump-file).
113
+ Please attach a copy of the (compressed) Homebridge log file to the issue, see [**Debug Log File**](#debug-log-file).
114
+ Please do **not** copy/paste large amounts of log output.
115
+
116
+ ### Contributing
117
+ Sometimes I get the question how people can support my work on Homebridge deCONZ.
118
+ I created Homebridge deCONZ as a hobby project, for my own use.
119
+ I share it on GitHub so others might benefit, and to give back to the open source community, without whom Homebridge Hue wouldn't have been possible.
120
+
121
+ Having said that, adding support for new devices, in Homebridge deCONZ, and in the deCONZ REST API plugin, is very hard without having physical access to the device.
122
+ Since this is a hobby project, I cannot afford to spend money on devices I won't be using myself, just to integrate them for the benefit of others.
123
+ I am happy to receive small donations in the form of new devices to integrate, or the money to buy these devices myself.
124
+ I am also happy to return the devices afterwards, if you provide the shipping costs.
125
+ Please contact me by email or on Discord for shipping details.
126
+
127
+ ### Caveats
128
+ Homebridge deCONZ is a hobby project of mine, provided as-is, with no warranty whatsoever. I've been running it successfully at my home since May 2023, replacing Homebridge Hue, but your mileage might vary.
package/cli/otau.js ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+
3
+ // otau.js
4
+ // Copyright © 2023 Erik Baauw. All rights reserved.
5
+ //
6
+ // Command line interface to deCONZ gateway.
7
+
8
+ 'use strict'
9
+
10
+ const { OtauTool } = require('hb-deconz-tools')
11
+ const pkgJson = require('../package.json')
12
+
13
+ new OtauTool(pkgJson).main()
@@ -94,8 +94,8 @@
94
94
  "title": "Advanced Settings",
95
95
  "description": "Don't change these, unless you understand what you're doing.",
96
96
  "items": [
97
- "brightnessAdjustment",
98
97
  "forceHttp",
98
+ "noResponse",
99
99
  "parallelRequests",
100
100
  "stealth",
101
101
  "timeout",
@@ -25,7 +25,6 @@ class DeconzPlatform extends Platform {
25
25
 
26
26
  parseConfigJson (configJson) {
27
27
  this.config = {
28
- brightnessAdjustment: 100,
29
28
  forceHttp: false,
30
29
  hosts: [],
31
30
  noResponse: false,
@@ -14,12 +14,25 @@ const { dateToString } = ApiClient
14
14
  */
15
15
  class Battery extends ServiceDelegate.Battery {
16
16
  constructor (accessory, resource, params = {}) {
17
- super(accessory, {
17
+ const batteryParams = {
18
18
  name: accessory.name + ' Battery',
19
19
  exposeConfiguredName: true
20
- })
20
+ }
21
+ const state = resource.body.state
22
+ const config = resource.body.config
23
+ if (state.battery != null) {
24
+ batteryParams.batteryLevel = state.battery
25
+ batteryParams.lowBatteryThreshold = 20
26
+ if (state.charging != null) {
27
+ batteryParams.chargingState = state.charging
28
+ }
29
+ } else if (config.battery != null) {
30
+ batteryParams.batteryLevel = config.battery
31
+ batteryParams.lowBatteryThreshold = 20
32
+ }
33
+ super(accessory, batteryParams)
21
34
 
22
- if (resource.body.state.battery != null) {
35
+ if (state.battery != null) {
23
36
  this.addCharacteristicDelegate({
24
37
  key: 'lastUpdated',
25
38
  Characteristic: this.Characteristics.my.LastUpdated,
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.19",
7
+ "version": "1.0.0",
8
8
  "keywords": [
9
9
  "homebridge-plugin",
10
10
  "homekit",
@@ -18,16 +18,17 @@
18
18
  "main": "index.js",
19
19
  "bin": {
20
20
  "deconz": "cli/deconz.js",
21
+ "otau": "cli/otau.js",
21
22
  "ui": "cli/ui.js"
22
23
  },
23
24
  "engines": {
24
- "deCONZ": "2.21.2",
25
+ "deCONZ": "2.22.2",
25
26
  "homebridge": "^1.6.1",
26
- "node": "^18.16.1"
27
+ "node": "18.17.1||^18||^16"
27
28
  },
28
29
  "dependencies": {
29
- "hb-deconz-tools": "~1.0.3",
30
- "homebridge-lib": "~6.3.18"
30
+ "hb-deconz-tools": "~1.0.6",
31
+ "homebridge-lib": "~6.4.1"
31
32
  },
32
33
  "scripts": {
33
34
  "prepare": "standard && rm -rf out && jsdoc -c jsdoc.json",