Skip to content

OpenZWave addon for Node.js (all versions) including management and security functions

License

Notifications You must be signed in to change notification settings

carpaij/node-openzwave-shared

 
 

Repository files navigation

node-openzwave-shared

Join the chat at https://gitter.im/OpenZWave/node-openzwave-shared

This is the homepage for node-openzwave-shared, the official binary add-on for Node.js, which wraps Open ZWave, a high quality C++ library for controlling Z-Wave networks.

You can now easily control and manage your ZWave devices (lights, dimmers, blinds, you name it) from within Node.js applications. This library also supports secure devices (eg door locks) that require encryption.

All known Node.js versions are supported with the help of NaN. This add-on is currently tested against 0.12.x on ARM and 4.2.x on x86_64, but it should also work on all supported Node.js versions (as early as 0.10.x) and architectures.

Check out the Node-Red integration project for an interesting use case, in which I've wired up ZWave and KNX devices working together as one big happy automated home.

This addon is currently able to:

  • scan a Z-Wave network and report on connected devices,
  • write values to zwave nodes
  • monitor the network for changes,
  • heal nodes and/or the network
  • perform management tasks (add/remove nodes, replace failed nodes, manage their group associations etc)

Important notice

This library differs from its ancestor library in that it links dynamically to an OpenZWave shared library by means of your system dynamic linker. This is in contrast to statically linking OpenZWave as part of the node.js addon.

Thus you need to have OpenZWave fully installed on your system (both the compiled library AND the development headers) before trying to install this little baby. I know this diverges from the dominant npm paradigm, but with the shared lib approach:

  • compilation / installation is a lot faster and
  • OZW minor upgrades / bugfixes are way lot easier.

This also means that you need to be careful if you upgrade your OZW library: you might need to rebuild this addon, otherwise you'd might get api mismatch exceptions.

Prerequisites

Linux

You will need to ensure the OpenZWave library and headers are installed first. You can do this one of two ways.

MacOS/X

The only dependency that you need before compiling is pkg-config. Then, you could either pull down the OZW repo from Github and do a make && sudo make install , or you could try installing OpenZWave using brew install open-zwave.

Windows

Since there is no standard installation location for Open Z-Wave on Windows, it will be automatically downloaded, compiled, and installed when you install this module.

Installation

Whenever you have OpenZWave installed in your machine, then all you need to do is:

$ npm install openzwave-shared

Notice: If you receive the error cannot find -lopenzwave on a 64-bit Linux system, libopenzwave.so was likely compiled into /usr/local/lib64. Run the terminal command ld -lopenzwave --verbose for a list of search locations used. You can workaround this by providing a symlink to one of the listed locations such as /usr/local/lib. Run sudo ln -s /usr/local/lib64/libopenzwave.so /usr/local/lib/libopenzwave.so creates symlink so that the file appears to be in the location that ld looks in. Now npm install should work.

In case you want to develop your application in TypeScript, there is also a TypeScript declaration file available. Besides adding typechecking to your codebase this will also help you to navigate the API and see the type of parameters available for each function. You can download the latest version of the declaration file from GitHub.

Development documentation

Environment-specific documentation

License

The Open Z-Wave library that this module heavily relies upon is licensed under the Lesser GPLv3.

Everything else (all the bits that I and Jonathan have written) is under the vastly more sensible ISC license.

About

OpenZWave addon for Node.js (all versions) including management and security functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 86.0%
  • JavaScript 11.6%
  • Python 2.4%