npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

homebridge-openzwave

v1.0.8

Published

OpenZWave Platform for Homebridge

Downloads

47

Readme

homebridge-openzwave

Latest Version Total Downloads Build Status License

OpenZWave platform for Homebridge. The main goal of this project is to map Z-Wave protocol command classes to HomeKit Accessories, Services, and Characteristics. Theoretically, it should make it support any Open Z-Wave device.

This project was initially forked from velocityzen/homebridge-platform-zwave and has been completely rewritten in TypeScript.

Supported Z-Wave Command Classes

Requirements

In addition to OpenZwave, be sure to install the ozw dev package:

For Ubuntu/Debian:

sudo apt install libopenzwave1.5-dev

For Alpine:

sudo apk --no-cache add openzwave-dev

Installation

  1. Homebridge
  2. npm i -g homebridge-openzwave
  3. Add platform to your config file

Configuration

In order to use this plugin, you’ll need to add the following JSON object to your Homebridge config file:

{
  "platform": "openzwave",
  "name": "OpenZWave",
  "zwave": {
    "devicePath": "/dev/ttyACM0"
  }
}

| Config Key | Description | Required | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | platform | Homebridge Platform name.This value should always be openzwave. | Y | | name | The name of this platform within Homebridge.This is mainly used for logs and can be any value you want. | N | | zwave | This contains the settings that will be passed to OpenZWave. | Y | | zwave.devicePath | The device path to your gateway.See Finding Your Device for more information.] | Y | | uuidPrefix | Override the default prefix used when generating UUIDs for each node.NOTE: Most setups will not need to change this value. | N | | accessories | Customize how your Z-Wave accessories behave in HomeKit, or exclude them entirely.See the Accessories section for more information. | N |

Finding Your Device

To locate your Z-Wave controller, try running ls /dev/tty.* or ls /dev/cu.* in terminal. Depending on your OS, you may also be able to run ls -lah /dev/serial/by-id to find additional context for which device in your Z-Wave gateway.

If you’re unable to figure out the correct device, try unplugging it and running the commands above, after that, plug it back in and look for the additional device that wasn’t there before.

Accessories

The accessories config object allows you to customize how your devices appear and behave within HomeKit.

{
  "platform": "openzwave",
  "name": "Z-Wave Platform",
  "zwave": {
    "devicePath": "/dev/ttyACM0"
  },
  "accessories": {
    "3": {
      "name": "My Fan Control",
      "classes": {
        "ignored": [128],
        "rewrite": [{ "from": 38, "to": 999001, "indexes": { "5": 0 } }]
      },
      "hints": ["fan"]
    }
  }
}

| Config Key | Description | | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | name | The default name this accessory should have in HomeKit. | | commands | | | commands.ignored | An array of Z-Wave command classes you’d prefer this plugin not represent in HomeKit. | | commands.rewrite | An array of commands to rewrite to change their intended effect | | commands.rewrite[].from | The Z-Wave command class to replace | | commands.rewrite[].to | The Z-Wave command class to change to | | commands.rewrite[].indexes | A key value list to map the index of the from command to the to command. | | hints | An array of strings to better help the plugin understand what type of device this is.Currently the only supported value is fan. |

Excluding Accessories from HomeKit

If you have Z-Wave nodes you’d wish to exclude from HomeKit, you can hide them by setting the accessory to false:

{
  "platform": "openzwave",
  "name": "Z-Wave Platform",
  "zwave": {
    "devicePath": "/dev/ttyACM0"
  },
  "accessories": {
    "3": false
  }
}

Device Handlers

homebridge-openzwave supports global/shared device handlers to override default Z-Wave behavior. This can be useful for devices that use generic commands for more specific purposes, such as a fan control that only implements SWITCH_MULTILEVEL.

For more information on device handlers, see the README.

Development

Environment

All development tooling dynamically configures OpenZWave through a DEVICE_PATH environment var that should be set to the location of your Z-Wave Gateway.

A .env file is supported in the root of the project directory.

Tools

homebridge-openzwave has some tooling to help making development easier:

  • yarn testharness will launch Homebridge through Babel/TypeScript pointed towards src
  • yarn util ls displays a list of devices currently in your Z-Wave network
  • yarn util inspect :nodeid query a specific node to display debug information including node info and command classes

Emulated Development

You can run the testharness with a docker flag to launch an Z-Wave emulator with test devices.

yarn testharness --docker

Remote Development

If your Z-Wave Controller is plugged into a different machine, you can access it remotely via socat.

NOTE: Be sure to shutdown Homebridge on the machine before you run socat as the gateway only supports a single connection to it.

To get started, run this on the machine that your Z-Wave Controller is plugged into:

docker run --rm -ti  --privileged -p 32375:32375 -v /dev:/host/dev \
alpine/socat -d -d tcp-l:32375,reuseaddr,fork file:/host/dev/ttyACM0,raw,nonblock,echo=0

NOTE: Remember to update your /dev path to match the path from Finding Your Device.

Next, when launching the testharness on your local machine, pass through a remote flag:

yarn testharness --remote=$IP_OF_REMOTE_MACHINE:32375

The testharness will handle launching socat on your local machine and configuring DEVICE_PATH for you.