Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for ozw v1.6 #26

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@ OZW_Log.txt
ozwcache_*.xml
zwcfg_*.xml
zwscene.xml
/.lib
/gominozw/gominozw
/gominozw/gominozw.exe
/open-zwave/*.dylib
/open-zwave/ozw_config
Empty file removed .gitmodules
Empty file.
62 changes: 19 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# goopenzwave

Go bindings for the [OpenZWave](https://github.com/OpenZWave/open-zwave) library.
Go bindings for the [OpenZWave](https://github.com/OpenZWave/open-zwave) library (version 1.6+).


## Warning
Expand All @@ -12,59 +12,35 @@ Most of the C++ OpenZWave library is wrapped now, but should you find anything m

## Installing OpenZWave

This package requires a system installation of [OpenZWave](https://github.com/OpenZWave/open-zwave). pkg-config is then used during the build of this package to get the open-zwave library and headers.
This package requires a system installation of [OpenZWave](https://github.com/OpenZWave/open-zwave). pkg-config is then used during the build of this package to get the OpenZWave 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:
1. `git clone https://github.com/OpenZWave/open-zwave.git`
2. `cd open-zwave`
3. `make -j$(nproc)`
4. `sudo make install`
5. You may need to call `sudo ldconfig` now on linux systems
5. See the [open-zwave/INSTALL](https://github.com/OpenZWave/open-zwave/blob/master/INSTALL) file for more information
### macOS

1. Install [homebrew](https://brew.sh)
2. Install the OpenZWave library and dependencies: `brew install open-zwave pkg-config` (v1.6.962 http://old.openzwave.com/downloads/)

## Get the Package
### Debian (and other Linuxes)

```
go get github.com/jimjibone/goopenzwave
```
1. Install pkg-config: `sudo apt install pkg-config`
2. Get the source: `wget http://old.openzwave.com/downloads/openzwave-1.6.962.tar.gz && tar xzf openzwave-1.6.962.tar.gz`
3. Build and install it: `cd openzwave-1.6.962 && sudo make install`
4. Run ldconfig to update library links and cache: `sudo ldconfig`
5. See the [open-zwave/INSTALL](https://github.com/OpenZWave/open-zwave/blob/master/INSTALL) file for more information


## Example: `gominozw`

This package comes with a basic example, `gominozw`, which is a replica of the original C++ OpenZWave MinOZW utility, now written in Go.
This package comes with a basic example, `gominozw`, which is based on 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.
It shows how to set up the Manager with various options and listen for Notifications. Once the initial scan of devices is complete the device state information is printed to the console.

To install and use:

```
go install github.com/jimjibone/goopenzwave/gominozw
gominozw --controller /dev/ttyYourUSBDevice
```


## Notes

### open-zwave build fails with `fatal error: libudev.h: No such file or directory` on Debian/Ubuntu

Try installing libudev with apt and build again.

```sh
apt-get install libudev-dev
cd open-zwave && make
```


### Crashes instantly on macOS 10.12

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](https://github.com/golang/go/issues/19734).
1. Build application: `go build -o gominozw ./gominozw`
2. Create config and user directories: `mkdir -p config user`
3. Copy openzwave config files:
- macOS: `cp -r /usr/local/Cellar/open-zwave/1.6.962/etc/openzwave/ ./config`
- Debian: `cp -r /usr/local/etc/openzwave/ ./config`
6. Run it: `./gominozw run -c ./config/openzwave -u ./user -p /dev/tty...`
10 changes: 0 additions & 10 deletions config.go

This file was deleted.

26 changes: 0 additions & 26 deletions controller.go

This file was deleted.

39 changes: 39 additions & 0 deletions controllercommand_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions controllererror_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions controllerstate_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138 changes: 0 additions & 138 deletions driver.go

This file was deleted.

5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/jimjibone/goopenzwave

go 1.13

require github.com/urfave/cli/v2 v2.2.0
Loading