Go bindings for the OpenZWave library.
This package is still fairly new and so the API is changing pretty rapidly, so be careful if you decide to use it. However, the API will try to mimic the C++ OpenZWave library as much as possible, if it doesn't already, so there shouldn't be many breaking changes.
Most of the C++ OpenZWave library is wrapped now, but should you find anything missing please create a new issue or fork it, implement it yourself and submit a pull request.
This package requires a system installation of OpenZWave. pkg-config is then used during the build of this package to get the open-zwave library and headers.
Note that package managers may install an old version of the library so a manual build/install from source is preferred.
Example install from source:
git clone https://github.com/OpenZWave/open-zwave.git
cd open-zwave
make -j$(nproc)
sudo make install
- You may need to call
sudo ldconfig
now on linux systems - See the open-zwave/INSTALL file for more information
go get github.com/jimjibone/goopenzwave
This package comes with a basic example, gominozw
, which is a replica of the original C++ OpenZWave MinOZW utility, now written in Go.
It shows how to set up the Manager with various options and listen for Notifications. Once the initial scan of devices is complete, polling for basic values is set up for the devices.
To install and use:
go install github.com/jimjibone/goopenzwave/gominozw
gominozw --controller /dev/ttyYourUSBDevice
Try installing libudev with apt and build again.
apt-get install libudev-dev
cd open-zwave && make
Do you see something like this when trying to run something with the goopenzwave package?
$ ./gominozw -h
zsh: killed ./gominozw -h
You should try building with the -ldflags=-s
option. E.g.: go build -ldflags=-s
. More info at golang/go#19734.