Skip to content

Commit

Permalink
Add initial support for ZWave JS (home-assistant#1766)
Browse files Browse the repository at this point in the history
* Add initial support for ZWave JS

* fix version

* fix lint

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <[email protected]>
Co-authored-by: Charles Garwood <[email protected]>

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <[email protected]>

* Update zwave_js/config.json

Co-authored-by: Franck Nijhof <[email protected]>

* Address comments

* Fix install for all archs

* make lint happy

* Fix build

* fix comment

* Fix and clean zwave_js add-on (home-assistant#1780)

* Use new bashio feature

* address ozw

* update docs

* Add debug support

* fix template

* Fix lint

Co-authored-by: Martin Hjelmare <[email protected]>
Co-authored-by: Charles Garwood <[email protected]>
Co-authored-by: Franck Nijhof <[email protected]>
  • Loading branch information
4 people authored Jan 25, 2021
1 parent 1caa587 commit c6fe889
Show file tree
Hide file tree
Showing 17 changed files with 401 additions and 110 deletions.
212 changes: 108 additions & 104 deletions zwave/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,104 +1,108 @@
# Changelog

## 0.8.0

- Update OpenZWave to 66619ed
- Update ozw-admin to f68b43e


## 0.7.1

- Fix timezone issue on Alpine

## 0.7.0

- Fix vnc / ozwadmin
- Update Openzwave to 1c7b620
- Update qt-openzwave to 7ebd43e2

## 0.6.0

- Fix vnc / ozwadmin

## 0.5.4

- Fix build issues with 32bit CPU

## 0.5.3

- Update Openzwave to 7eaae21

## 0.5.2

- Fix startup failure due to stray OZW Daemon status retained in MQTT
- Propagate shutdown OZW Daemon status to upstream MQTT on shutdown
- Update OpenZWave to 6cf3729

## 0.5.1

- Roll-back alpine to 3.11 and qt 5.12
- Roll-back OpenZWave to 6c2ca613

## 0.5.0

- Update OpenZWave to 5d3978d5
- Update ozw-admin to da04ebfb
- Update qt-openzwave to 3ad9138f
- Update alpine to 3.12

## 0.4.4

- Update OpenZWave to a35732f
- Update ozw-admin to 278427b

## 0.4.3

- Update OpenZWave to 6cec95b
- Update ozw-admin to 167180c

## 0.4.2

- Improve error message when using documented network_key

## 0.4.1

- Fix optional instance parameter

## 0.4.0

- Add OZW instance ID configuration option
- Fix persistent storage of OpenZWave
- Fix permissions on discovery script
- Fix OZW database location
- Improve build speed by using all available cores
- Add built-in ozw-admin
- Add VNC access to add-on to access ozw-admin
- Add Ingress support to add-on to access ozw-admin
- Documentation improvements
- Update OpenZWave (and database) to d2de699
- Update ozwdaemon to 337e488
- Add logo and icon
- Detect use of example network key from documentation

## 0.3.0

- Add port to allow ozw-admin to connect
- Enable discovery again
- Set network key default to empty

## 0.2.1

- Disable discovery for 0.110.0

## 0.2.0

- Update OZW / QTOZW
- Rename `zwave_mqtt` to `ozw`

## 0.1.1

- Fix i386 build

## 0.1.0

- Initial release
# Changelog

## 0.9.0

- Update OpenZWave to ee90c89
- Cleanup permissions

## 0.8.0

- Update OpenZWave to 66619ed
- Update ozw-admin to f68b43e

## 0.7.1

- Fix timezone issue on Alpine

## 0.7.0

- Fix vnc / ozwadmin
- Update Openzwave to 1c7b620
- Update qt-openzwave to 7ebd43e2

## 0.6.0

- Fix vnc / ozwadmin

## 0.5.4

- Fix build issues with 32bit CPU

## 0.5.3

- Update Openzwave to 7eaae21

## 0.5.2

- Fix startup failure due to stray OZW Daemon status retained in MQTT
- Propagate shutdown OZW Daemon status to upstream MQTT on shutdown
- Update OpenZWave to 6cf3729

## 0.5.1

- Roll-back alpine to 3.11 and qt 5.12
- Roll-back OpenZWave to 6c2ca613

## 0.5.0

- Update OpenZWave to 5d3978d5
- Update ozw-admin to da04ebfb
- Update qt-openzwave to 3ad9138f
- Update alpine to 3.12

## 0.4.4

- Update OpenZWave to a35732f
- Update ozw-admin to 278427b

## 0.4.3

- Update OpenZWave to 6cec95b
- Update ozw-admin to 167180c

## 0.4.2

- Improve error message when using documented network_key

## 0.4.1

- Fix optional instance parameter

## 0.4.0

- Add OZW instance ID configuration option
- Fix persistent storage of OpenZWave
- Fix permissions on discovery script
- Fix OZW database location
- Improve build speed by using all available cores
- Add built-in ozw-admin
- Add VNC access to add-on to access ozw-admin
- Add Ingress support to add-on to access ozw-admin
- Documentation improvements
- Update OpenZWave (and database) to d2de699
- Update ozwdaemon to 337e488
- Add logo and icon
- Detect use of example network key from documentation

## 0.3.0

- Add port to allow ozw-admin to connect
- Enable discovery again
- Set network key default to empty

## 0.2.1

- Disable discovery for 0.110.0

## 0.2.0

- Update OZW / QTOZW
- Rename `zwave_mqtt` to `ozw`

## 0.1.1

- Fix i386 build

## 0.1.0

- Initial release
2 changes: 1 addition & 1 deletion zwave/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"aarch64": "homeassistant/aarch64-base:3.11"
},
"args": {
"OZW_VERSION": "66619eda6caaf2b41d07d68672efa7170f6c4722",
"OZW_VERSION": "ee90c896c137b3a473232565c45a51d70c41c431",
"QTOZW_VERSION": "7ebd43e246e97851ad20f2b1bb9c62bfd6a4a6ef",
"QTOZWADMIN_VERSION": "f68b43ec162f6eb59173710e00b1f1aa192ce373",
"QTMQTT_VERSION": "5.12.8",
Expand Down
6 changes: 1 addition & 5 deletions zwave/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "OpenZWave",
"version": "0.8.0",
"version": "0.9.0",
"slug": "zwave",
"description": "Control a ZWave network with Home Assistant",
"arch": ["amd64", "i386", "armhf", "armv7", "aarch64"],
Expand All @@ -25,10 +25,6 @@
"services": ["mqtt:want"],
"discovery": ["ozw"],
"auto_uart": true,
"gpio": true,
"apparmor": false,
"privileged": ["SYS_RAWIO"],
"devices": ["/dev/bus/usb:/dev/bus/usb:rwm", "/dev/mem:/dev/mem:rw"],
"options": {
"device": null,
"network_key": ""
Expand Down
5 changes: 5 additions & 0 deletions zwave_js/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 0.1.0

- Inital release
107 changes: 107 additions & 0 deletions zwave_js/DOCS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Home Assistant Add-on: Z-Wave JS

## Installation

Follow these steps to get the add-on installed on your system:

1. Navigate in your Home Assistant frontend to **Supervisor** -> **Add-on Store**.
2. Find the "Z-Wave JS" add-on and click it.
3. Click on the "INSTALL" button.

## How to use

The add-on needs to know where your Z-Wave stick can be found, and therefore,
you'll need to configure the add-on to point to the right device.

If you're using Home Assistant you may find the correct value for this on the
`Supervisor -> System -> Host system -> Hardware` page. It is recommended
to use a "by-id" path to the device if one exists, as it is not subject to
change if other devices are added to the system.

1. Replace `null` in the `device` option in the add-on configuration and specify
the device name in quotes: e.g., something like
`"/dev/serial/by-id/usb-0658_0200-if00"`,
`"/dev/ttyUSB0"`, `"/dev/ttyAMA0"`, or `"/dev/ttyACM0"`.
2. Set your 16-byte network key in the form `0x01, 0x02...` used in order to
connect securely to compatible devices. It is recommended that a network key
is configured as security enabled devices may not function correctly if they
are not added securely.
3. Click on "SAVE" to save the add-on configuration.
4. Start the add-on.
5. Add the Z-Wave JS integration to Home Assistant, see documentation:
<https://www.home-assistant.io/integrations/zwave_js>


## Configuration

Add-on configuration:

```yaml
device: /dev/ttyUSB0
network_key: 2232666D100F795E5BB17F0A1BB7A146
```
### Option `device`

The device address of your Z-Wave controller.

If you're using Home Assistant you may find the correct value for this on the
`Supervisor -> System -> Host system -> Hardware` page. It is recommended
to use a "by-id" path to the device if one exists, as it is not subject to
change if other devices are added to the system.

In most cases this looks like one of the following:

- `"/dev/serial/by-id/usb-0658_0200-if00"`
- `"/dev/ttyUSB0"`
- `"/dev/ttyAMA0"`
- `"/dev/ttyACM0"`

### Option `network_key`

Security Z-Wave devices require a network key before being added to the network.
You must set the `network_key` configuration option to use a network key before
adding these devices.

If you don't add an network key, it will autogenerate this for you.

To generate a network key manual, you can use the following script in, e.g., the SSH
add-on:

```bash
hexdump -n 16 -e '4/4 "%08X" 1 "\n"' /dev/random
```

You can also use sites like this one to generate the required data:

<https://www.random.org/cgi-bin/randbyte?nbytes=16&format=h>

Ensure you keep a backup of this key. If you have to rebuild your system and
don't have a backup of this key, you won't be able to reconnect to any security
devices. This may mean you have to do a factory reset on those devices, and your
controller, before rebuilding your Z-Wave network.

### Option `emulate_hardware` (optional)

If you don't have a USB stick, you can use a fake stick.

## Known issues and limitations

- Your hardware needs to be compatible with Z-Wave JS library

## Support

Got questions?

You have several options to get them answered:

- The [Home Assistant Discord Chat Server][discord].
- The Home Assistant [Community Forum][forum].
- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]

In case you've found a bug, please [open an issue on our GitHub][issue].

[discord]: https://discord.gg/c5DvZ4e
[forum]: https://community.home-assistant.io
[issue]: https://github.com/home-assistant/hassio-addons/issues
[reddit]: https://reddit.com/r/homeassistant
26 changes: 26 additions & 0 deletions zwave_js/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ARG BUILD_FROM
FROM ${BUILD_FROM}

ARG ZWAVEJS_SERVER_VERSION

# Install Z-Wave JS
WORKDIR /usr/src
RUN \
set -x \
&& apk add --no-cache \
nodejs \
npm \
&& apk add --no-cache --virtual .build-dependencies \
build-base \
git \
linux-headers \
python3 \
\
&& npm config set unsafe-perm \
&& npm install -g @zwave-js/server@${ZWAVEJS_SERVER_VERSION} \
\
&& apk del --no-cache \
.build-dependencies

WORKDIR /
COPY rootfs /
12 changes: 12 additions & 0 deletions zwave_js/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Home Assistant Add-on: Z-Wave JS

Allow Home Assistant to talk to a Z-Wave Network via a USB Controller.

![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield] ![Supports i386 Architecture][i386-shield]


[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg
Loading

0 comments on commit c6fe889

Please sign in to comment.