WebThingsIO / zwave-adapter

Z-Wave adapter add-on for WebThings Gateway
Mozilla Public License 2.0
15 stars 20 forks source link

Native JS implementation #19

Open mishoboss opened 6 years ago

mishoboss commented 6 years ago

Have you ever considered to use IOPA-ZWAVE instead of OpenZWave? I know OpenZWave is a mature thing, but installing it on different platforms is a huge pain. A JS only solution would be the perfect scenario. The Z-Wave spec is now open and IOPA-ZWAVE seems to implement it. But I've never tested it. Do you?

mishoboss commented 6 years ago

P.S. This project deserves watching too: https://github.com/AlCalzone/node-zwave-js

dhylands commented 6 years ago

I haven't played with either of the JS ones. I had used OpenZWave on a previous project so had some familiarity with it.

I think that its definitely worth looking at.

mishoboss commented 6 years ago

Great. Crossing fingers those nasty binaries can go away. :)

Swaagie commented 6 years ago

This is from the current arm docker image. Going to investigate, but the default experience on rb3 seems to be a dead adapter.

2018-07-26 11:49:37.502 zwave: Loading add-on for zwave-adapter from /home/node/.mozilla-iot/addons/zwave-adapter
2018-07-26 11:49:38.274 zwave: Failed to load zwave-adapter - Failed to load openzwave-shared: Error: libopenzwave.so.1.4: cannot open shared object file: No such file or directory
2018-07-26 11:49:38.300 Plugin: zwave-adapter died, code = 100 NOT restarting...

edit: just found https://github.com/mozilla-iot/gateway-docker/issues/8 which explains above ^.

Swaagie commented 6 years ago

After fixing above issue with a temporary symlink in the arm docker container, it now dies with

2018-07-26 12:26:11.209 Loading add-on: zwave-adapter
2018-07-26 12:26:12.647 zwave: Opening database: /home/node/.mozilla-iot/config/db.sqlite3
2018-07-26 12:26:12.710 Killing zwave-adapter plugin.
2018-07-26 12:26:12.725 Plugin: zwave-adapter died, code = null restarting...
2018-07-26 12:26:13.881 zwave: Opening database: /home/node/.mozilla-iot/config/db.sqlite3
2018-07-26 12:26:13.966 zwave: Loading add-on for zwave-adapter from /home/node/.mozilla-iot/addons/zwave-adapter
2018-07-26 12:26:14.865 zwave: Failed to load zwave-adapter - Unable to find ZWave adapter
2018-07-26 12:26:14.887 Plugin: zwave-adapter died, code = 100 NOT restarting...
dhylands commented 6 years ago

That means that the zwave adapter is unable to find the dongle. It looks for the dongle by enumerating the serial ports using the .list function from the serialport module. Internally, the serialport module uses udev to determine which USB serial ports exist. Presumably you'd need a way to get docker to know what serial ports it can access from inside the container. I'm not familiar enough with docker to know how or if this is possible.