OpenZWave / node-openzwave-shared

OpenZWave addon for Node.js (all versions) including management and security functions
Other
199 stars 113 forks source link

macOS usability ? #231

Closed yadomi closed 6 years ago

yadomi commented 6 years ago

So i've tried to use this library on macOS but with many try I didn't been able to get something that works.

I'm using macOS High Sierra (10.13.3), here what i've done so far:

I tested first with open-zwave installed via homebrew:

brew install open-zwave
yarn add openzwave-shared

But the installation failed:

[...]
Package libopenzwave was not found in the pkg-config search path.
Perhaps you should add the directory containing `libopenzwave.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libopenzwave' found
gyp: Call to 'pkg-config --variable=libdir libopenzwave' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error

No luck here, look like the homebrew installation does not add the libopenzwave.pc, so I made a simlink to the .dylib but still can't install

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

So I removed open-zwave with homebrew and tried to build it myself:

cd /tmp
curl -O http://old.openzwave.com/downloads/openzwave-1.4.0.tar.gz 
tar -xzvf openzwave-1.4.0.tar.gz
cd openzwave-1.4.0
make
sudo make install

Ok, everything looks good, yarn add openzwave-shared is successful

So I try in a js file:

const OZW = require('openzwave-shared');
const zwave = new OZW();

But got this issue https://github.com/OpenZWave/node-openzwave-shared/issues/214, but ok nevermind I add some arguments and some event handler:

const OZW = require('openzwave-shared');
const zwave = new OZW({ ConsoleOutput: true, Logging: true })

zwave.on('driver ready', console.log.bind(console));
zwave.on('driver failed', console.log.bind(console));
zwave.on('scan complete', console.log.bind(console));

zwave.connect('/dev/tty.usbmodem14311');

And finnaly I got some message from openzwave but...

Initialising OpenZWave 1.4.0 binary addon for Node.JS.
    OpenZWave Security API is ENABLED
    ZWave device db    : /usr/local/etc/openzwave
    User settings path : /Users/yadomi/Workspace/zwave/node_modules/openzwave-shared/build/Release/../../
    Option Overrides : --ConsoleOutput true --Logging true --NetworkKey 0x10,0x6F,0x08,0x87,0x47,0x79,0xDA,0xF9,0xDE,0x18,0x53,0xA2,0x25,0x4F,0x36,0xD1
2018-05-26 17:41:42.420 Always, OpenZwave Version 1.4.0 Starting Up
2018-05-26 17:41:42.421 Info, Setting Up Provided Network Key for Secure Communications
2018-05-26 17:41:42.423 Info, mgr,     Added driver for controller /dev/tty.usbmodem14311
2018-05-26 17:41:42.423 Info,   Opening controller /dev/tty.usbmodem14311
2018-05-26 17:41:42.423 Info, Trying to open serial port /dev/tty.usbmodem14311 (attempt 1)

And that all I got, no logs from events, no more output, no retry whatsoever.

I've tried running node as root, but got the same exact behavior, also tried setting up inside a docker until I discoverd that you can't share a device with the current docker for mac version.

So, does this lib is actually even usable on macOS ?

ekarak commented 6 years ago

I have no Mac, sorry. Please use the search facility, there are users that report using this successfully since version 1.1.5 on MacOS: https://github.com/OpenZWave/node-openzwave-shared/pull/45

dsteinman commented 5 years ago

This issue should maybe be re-opened. I'm encountering this problem still in MacOS Mojave and it's very unclear what's wrong. I tried both brew and source install of libopenzwave with no luck.

The command:

pkg-config --variable=libdir libopenzwave

Returns:

Package libopenzwave was not found in the pkg-config search path.
Perhaps you should add the directory containing "libopenzwave.pc"
to the PKG_CONFIG_PATH environment variable
No package "libopenzwave" found

There is no such file on my system using find /usr/ -name libopenzwave.pc

If I knew how to get that zwave library to be found I imagine this might work.