OpenZWave for node-red

1,709 views
Skip to first unread message

Ηλίας Καρακουλάκης

unread,
Jul 3, 2014, 2:05:10 AM7/3/14
to node...@googlegroups.com
Hi all, 
this is to let you know on something I'vee been working on the last couple of days:

https://github.com/ekarak/node-red-contrib-openzwave

OpenZWave nodes for node-red. Uses the OpenZWave binding for Node.JS (https://github.com/jperkin/node-openzwave). It includes:

'zwave-controller' : a unique CONFIG node (not able to participate in flows) that holds configuration for initializing OpenZWave and will acts as the encapsulator for OZW access. As a node-red 'config' node, it cannot be added to a graph, but it acts as a singleton object that gets created in the the background when you add 'zwave' or 'zwave-node' nodes and configure them accordingly.

'zwave' : a generic zwave node that can do ZWave I/O with arbitrary messages, so it can be used with function blocks.

'zwave-node': use this to target a specific ZWave node's function ("ValueID" in OpenZWave terminology) that can be parameterised for individual ZWave device endpoints. For instance, a ZWave switch can be an input node, or a ZWave dimmer can be a Node-Red output node.


Stay tuned, there's also a KNX/eibd node in the works. Hmmm, who's interested in binding different BMS's with some Javascript? :)

Elias

Lorenzo Maiorfi

unread,
Jul 3, 2014, 3:15:23 AM7/3/14
to node...@googlegroups.com
Hi Elias.

I'd like to link to your post just to mention that we have developed a Z-Wave solution integrated with node-red by mean of a custom MQTT-ZWave bridge (developed as a .NET Micro Framework firmware targeted to a board driving a 3rd party Z-Wave serial api controller).

Just to mention, we developed a similar bridge for XBee and at this time we are working on a third bridge for BLE.

Cheers,

Lorenzo


--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ηλίας Καρακουλάκης

unread,
Jul 3, 2014, 3:24:41 AM7/3/14
to node...@googlegroups.com
Well my solution is much simpler; it talks locally to a USB ZWave adapter, so the node.js interpreter needs to have raw access to the serial port where the USB stick is attached to.

My idea is to use node-red to bridge KNX and ZWave (and possibly others as well) to combine the best aspects of each protocol. KNX badly needs a good RF stack, and it already has three attempts at it, the last one announced at this April's L+B 2014. However, I'm not sure they'll ever get this right. ZWave on the other hand is on a far more better track...

Dave C-J

unread,
Jul 4, 2014, 1:00:14 PM7/4/14
to node...@googlegroups.com
Great timing.... a colleague was asking about something like this just a few days ago... 
I love this community !

Dave C-J

unread,
Jul 4, 2014, 1:31:29 PM7/4/14
to node...@googlegroups.com
Hi,

if I try the node without an Openzwave dongle I get an error

[10-zwave.js] Error: /home/blahblah/node-red/node_modules/openzwave/build/Release/openzwave.node: undefined symbol: udev_new

Is this expected ?

Also looking at the code it seems to be a single node... - Our normal pattern is to have one node for the input side and one for output unless it is really a command response type interface. I don't know enough about openzwave to know if this is the case - but I think things like this http://aeotec.com/z-wave-sensor - can just stream info once set up - so separate in and out nodes may be more appropriate ?


Ηλίας Καρακουλάκης

unread,
Jul 4, 2014, 2:17:52 PM7/4/14
to node...@googlegroups.com

You probably  need libudev-dev. Type "sudo apt-get install libudev-dev" to get in on ubuntu or debian.

--
http://nodered.org
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/W7TVBvR6BXQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.

Ηλίας Καρακουλάκης

unread,
Jul 4, 2014, 2:19:42 PM7/4/14
to node...@googlegroups.com

Forgot to add, this is a weekend project, so its not working yet :)

Στις 4 Ιουλ 2014 8:31 μ.μ., ο χρήστης "Dave C-J" <dce...@gmail.com> έγραψε:

Dave C-J

unread,
Jul 4, 2014, 2:36:53 PM7/4/14
to node...@googlegroups.com
Hi - I have that - latest level (though running Ubuntu 12.04 LTS)

(and no worries - we work weekends too :-(   )

Lawrence Griffiths

unread,
Jul 4, 2014, 3:21:35 PM7/4/14
to node...@googlegroups.com

Elias great to see your getting started with node-red (weekends only :)
I've just ordered the ROT KNX/EIB board will post when I've got something to share.

Lawrence

mark.h...@googlemail.com

unread,
Jul 10, 2014, 5:28:31 AM7/10/14
to node...@googlegroups.com
There is a workaround for the udev_new issue at:

  https://github.com/jperkin/node-openzwave/issues/20#issuecomment-30756898

HTH,
-Mark

Gilson Oguime

unread,
Mar 22, 2015, 10:01:44 AM3/22/15
to node...@googlegroups.com
Hi,

I installed node-red-contrib-openzwave but I'm pretty new to Node RED and have a few questions.

Could not find the generic Z-Wave node, only z-wave in/z-wave out. How can I fix it?

Are there any samples showing how to use the nodes z-wave in/z-wave out ?

Thanks!

Ηλίας Καρακουλάκης

unread,
Mar 23, 2015, 3:18:30 AM3/23/15
to node...@googlegroups.com
Apologies, the terminnology for this has changed, I need to update the README to mirror that. There is no 'ValueID-specific' node in the library , simply because I realized  its way too trivial to wrap a generic node around a JS transformator to add the valueId. In short, there are only TWO usable nodes in Node-Red, 
- ZWave In: Captures zwave updates from OpenZWave into NR flows. Just connect one of these to a debugging node (that simply logs messages on Node Red's right pane)
- ZWave Out: Sends commands to ZWave devices. You can find command examples in:
Remember to configure the ZWave nodes to point to the correct USB stick for your zwave network, usually /dev/ttyUSB0
There is no management interface (yet), so you need to have configured your zwave network beforehand.

Elias

--
http://nodered.org
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/W7TVBvR6BXQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Elias Karakoulakis
Electrical & Computer Engineer NTUA Athens
Msc Information Systems, AUEB Athens
KNX Advanced Partner

Gilson Oguime

unread,
Mar 23, 2015, 7:55:19 PM3/23/15
to node...@googlegroups.com
Hi Elias,

No problem, the two nodes are working fine and I'll start playing with my Z-Wave devices.

Thanks!
Gilson

Gilson Oguime

unread,
Apr 18, 2015, 8:21:09 PM4/18/15
to node...@googlegroups.com
Hi Elias,

OpenZWave for Node-RED has been working fine, only issue I have so far is with an Aeon Multisensor that used to report temperature, Humidity and Luminance each 4 minutes under openHAB. I do not receive anything besides the instant presence information anymore.

Any ideas on how to fix it?

Thanks,
Gilson

Ηλίας Καρακουλάκης

unread,
Apr 19, 2015, 2:11:52 AM4/19/15
to node...@googlegroups.com
The one solution I can imagine right now is for me to add the missing management functions.. :) . 
This is because I _assume_ that OpenHAB sets up periodic polling for these values, that the stock OpenZWave library doesn't do by default.
I'll get a look at this, although I don't have any sensor devices right now...

Gilson Oguime

unread,
Apr 19, 2015, 11:08:21 PM4/19/15
to node...@googlegroups.com
Hi Elias,
openHAB supports this feature but does not setup pooling, the sensor can be configured to report periodically as you can see here:

Gilson Oguime

unread,
Apr 20, 2015, 9:18:18 PM4/20/15
to node...@googlegroups.com
Hi again Elias,

Don't bother looking at the code yet. It seems that my multisensor is failing, even motion sensing is not working anymore. I'll report again when I can find another sensor to test, ok?

Thanks,
Gilson

Shem Jamieson

unread,
Apr 30, 2015, 3:43:39 AM4/30/15
to node...@googlegroups.com
Has anyone else tried to install this node lately, doesn't seem to work for me always get build errors on my RPi no matter what I try. I have installed about 10 other nodes on the same device and they all install fine.

Error log attached if anyone interested. Using: npm install node-red-contrib-openzwave
npm install node-red-contrib-openzwave
npm install node-red-contrib-openzwave
log.txt

Ηλίας Καρακουλάκης

unread,
Apr 30, 2015, 4:06:52 AM4/30/15
to node...@googlegroups.com
Hi,

The error indicates that the 'make' command invoked by the gyp rebuild for the openzwave c++ library failed. Is this a clean build or a rebuild? I've had some occasions where I had to do a 'make clean' from the root of the openzwave directory....

--
http://nodered.org
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/W7TVBvR6BXQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gilson Oguime

unread,
May 23, 2015, 1:18:40 PM5/23/15
to node...@googlegroups.com
Hi Elias,

I want to make a clean build starting from the latest Raspbian and using openzwave-shared. Is there a guide anywhere on installing the full openzwave libraries on a Raspberry Pi B+?

Gilson Oguime

unread,
May 23, 2015, 11:18:18 PM5/23/15
to node...@googlegroups.com
Hi Elias,
I rebuilt my Raspberry and installed a new device, an Ecolink Door Sensor. I can see it works looking at the Openzwave Control Panel, but the Node Red Zwave output node does not detect any changes. I have others devices working fine with the Z-stick and Node Red (switches and dimmers), any idea on what could be wrong?
Thanks

Ηλίας Καρακουλάκης

unread,
May 24, 2015, 1:46:54 AM5/24/15
to node...@googlegroups.com
Could you please raise an issue at
https://github.com/OpenZWave/node-openzwave-shared/issues
pasting in openzwave's logs?

--
http://nodered.org
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/W7TVBvR6BXQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gilson Oguime

unread,
May 24, 2015, 9:30:16 AM5/24/15
to node...@googlegroups.com
Hi Elias,

Just did it.

Thanks,
Gilson

Gilson Oguime

unread,
May 24, 2015, 3:50:49 PM5/24/15
to node...@googlegroups.com
Hi Elias,

The sensor was showing as Probe (Sleeping) on ozwcp so I pressed a button nearby the led and the status then became Awake.

A few hours latter it started appearing also on Node-RED. Seems to be working fine now.

Thanks,
Gilson

Ηλίας Καρακουλάκης

unread,
May 24, 2015, 4:21:34 PM5/24/15
to node...@googlegroups.com
Hey nice!
In general, the node-red plugin is a 'shallow wrapper', there is very few little extra functionality that could cause problems like this.

I've just published 0.1.0 of node-openzwave-shared, which adds management commands (for example to add new ZWave devices dynamically!)

Gilson Oguime

unread,
May 25, 2015, 2:07:22 PM5/25/15
to node...@googlegroups.com
Hi Elias,

I'll try that one, but I found out that the sensor will be unresponsive after Node-RED is restarted (I had to restart my Raspberry PI and it would not be captured by Node-RED again).

I added a comment on the issue, maybe you have an idea on how I could fix it.

Thanks again,
Gilson

Gilson Oguime

unread,
May 29, 2015, 9:00:03 PM5/29/15
to node...@googlegroups.com
Hi Elias,

While looking for a solution for my door sensor issue I noticed that you've added group association commands to openzwave-shared on Github.

Do you intend to update it on NPM as well?

Thanks,
Gilson

Ηλίας Καρακουλάκης

unread,
May 30, 2015, 1:21:19 AM5/30/15
to node...@googlegroups.com

Its not yet complete. Be patient:)

Gilson Oguime

unread,
May 30, 2015, 10:50:30 AM5/30/15
to node...@googlegroups.com
Sorry Elias, I'm really anxious and I thought associations might have something to do with my problem...

Meanwhile, can you tell if I should copy the ozwcfg_*.xml file generated when I added the devices with Openzwave Control Panel to a specific folder to have it used whithin Node-RED?

Thanks,
Gilson

Ηλίας Καρακουλάκης

unread,
May 30, 2015, 12:06:06 PM5/30/15
to node...@googlegroups.com

Yes that would be a good idea to try. However, I'm not sure if ozwcp does any extra stuff upon initialization (like setting up polling).please share your findings, should it be a nice way to use ozwcp end par node-red. Bear in mind that I'm gradually adding all the management API into node.js

Walter Kraembring

unread,
Jan 1, 2018, 1:34:08 PM1/1/18
to Node-RED
Dear Elias,
Got it working with an Aeotec stick, a Fibaro dual switch, running in a RPi3 (Stretch)

What about secure devices like locks - do you plan to add support to pair those directly via node-red? It seems a bit complicated to use ozwcp and it is also mentioned that "it is an alpha version..."
Any other good hints how to pair secure devices? (Sure, I believe I could run Home Assistant to configure everything and then copy file and start NR but this seems not very modern way of working) 

Kind regards, Walter

Ηλίας Καρακουλάκης

unread,
Jan 1, 2018, 1:38:39 PM1/1/18
to node...@googlegroups.com
this feature (support for setting encryption keys) has been recently added in the master. please check latest commits.

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack

---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/W7TVBvR6BXQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/0678f06f-5396-418f-818e-13f60a8527f6%40googlegroups.com.

Walter Kraembring

unread,
Jan 1, 2018, 5:40:06 PM1/1/18
to Node-RED
Thank you Elias, I have seen that setting but not tried

Does this mean, I just configure the network key and then I can pair a secure device (e.g a door lock) just using node-red-contrib-openzwave nodes directly via usb?
No need for ozwcp or similar?

Kind regards, Walter


Walter Kraembring

unread,
Jan 8, 2018, 7:37:09 AM1/8/18
to Node-RED
Anyone using a (secure) door lock?

We have a problem to lock/unlock the door lock (ID Lock) from node-red-contrib-openzwave nodes. The lock can be controlled fine using ozwcp and correct events are coming into NR when the door is unlocked/locked manually

In NR we get events like:

The syntax we are currently trying with (in the function nodes) to unlock is
msg = {"topic": "setValue", "payload": {"nodeid":3, "cmdclass":98, "cmdidx":0, "instance":1, "value":false}};
return msg

However, it just gives the following response
{"nodeid":3,"notification":1,"help":"Notification - TimeOut","uuid":"b827eb96e3ae-0xc2106156-3"} 


But using 

msg = {"topic": "getNodeStatistics", "payload": {"args": [3]}};
return msg; 

Gives the response:
{"topic":"getNodeStatistics","payload":{"args":[3],"result":{"sentCnt":12,"sentFailed":0,"retries":0,"receivedCnt":22,"receivedDups":0,"receivedUnsolicited":20,"lastRequestRTT":1290,"lastResponseRTT":1333,"averageRequestRTT":1269,"averageResponseRTT":1317,"quality":0,"sentTS":"2018-01-08
09:00:13:013 ","receivedTS":"2018-01-08 08:40:21:752
"}},"_msgid":"474d1466.0ef0cc"}

It looks as if the node is correctly added to the z-wave network but no luck when trying to unlock/lock

Any suggestion or hint is very much appreciated,
Kind regards, Walter


The flow



[{"id":"6749421e.5ab17c","type":"zwave-out","z":"49e77309.11683c","name":"Z-Wave ut","controller":"15641374.bcdded","x":610,"y":160,"wires":[["194ba270.1732fe"]]},{"id":"194ba270.1732fe","type":"debug","z":"49e77309.11683c","name":"","active":true,"console":"false","complete":"true","x":790,"y":160,"wires":[]},{"id":"42a6320.113b3d","type":"inject","z":"49e77309.11683c","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":210,"y":160,"wires":[["dc62fb9.2c9d508"]]},{"id":"dc62fb9.2c9d508","type":"function","z":"49e77309.11683c","name":"DoorUnlock","func":"msg = {\"topic\": \"setValue\", \"payload\": {\"nodeid\":3, \"cmdclass\":98, \"cmdidx\":0, \"instance\":1, \"value\":false}};\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":160,"wires":[["6749421e.5ab17c"]]},{"id":"b5868c4a.5a37e","type":"inject","z":"49e77309.11683c","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":210,"y":200,"wires":[["3bb5b099.c1d23"]]},{"id":"3bb5b099.c1d23","type":"function","z":"49e77309.11683c","name":"DoorLock","func":"msg = {topic: 'setValue', payload: {\"nodeid\":3, \"cmdclass\":98, \"cmdidx\":0, \"instance\":1, \"value\":true}};\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":200,"wires":[["6749421e.5ab17c"]]},{"id":"76cb6bd6.f97ad4","type":"comment","z":"49e77309.11683c","name":"Z-Wave","info":"","x":210,"y":120,"wires":[]},{"id":"338fa751.38e918","type":"inject","z":"49e77309.11683c","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":210,"y":280,"wires":[["f816fb8.1e35408"]]},{"id":"f816fb8.1e35408","type":"function","z":"49e77309.11683c","name":"","func":"msg = {\"topic\": \"getNodeStatistics\", \"payload\": {\"args\": [2]}};\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":280,"wires":[["6749421e.5ab17c"]]},{"id":"15641374.bcdded","type":"zwave-controller","z":"","port":"/dev/ttyAMA0","driverattempts":"3","pollinterval":"10000","allowunreadyupdates":false,"networkkey":"\"0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10\"","logging":"full"}]



steve rickus

unread,
Jan 8, 2018, 4:02:36 PM1/8/18
to Node-RED
Walter,

Although I know nothing about ZWave, it looks suspicious that the getNodeStatistics output shows
"receivedCnt":22, "receivedDups":0, "receivedUnsolicited":20

almost like it's ignoring your "unsolicited" requests to lock or unlock the door? Is there some other msg required as part of a dialog (for security or authentication) maybe?
--
Steve

BTW, you can put your test msg object {"nodeid":3, "cmdclass":98, "cmdidx":0, "instance":1, "value":false} directly into your inject node, with topic defined as "setValue" -- instead of injecting an empty string and using a 2 line function node. Just make sure to select the inject type as "Json"

Walter Kraembring

unread,
Jan 9, 2018, 7:08:17 AM1/9/18
to Node-RED
Finally we got it working!!!
I thought the following could be helpful if someone else is struggling with a similar task

What made the difference? It was all about the network key...

By default, in our case, the network key located in /home/pi/openzwave-1.4.164/config/options.xml is in the following format:
<Option name="NetworkKey" value=”0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10" />

When we paired the lock with OZWCP using this default format, the pairing worked fine. But we could not control the lock (lock/unlock) once we transfered the configuration xml to NR. Strange enough, events came into NR when the lock was operated manually

Just copying & pasting the same key into the NR Controller config does simply not work, then NR will just loop in new restarts, the format is not accepted

Instead the following formats are accepted in the z-wave controller config in NR:
"0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10”
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10

The problem is that this seems "not to be the same" as has previously been used during the pairing with OZWCP

In options.xml we then tried to set a format that is also allowed in NR (remove spaces):
<Option name="NetworkKey" value="0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10" />

Once we changed the network key format in options.xml, pairing the lock again using OZWCP worked fine (however, obviously, first you have to remove the lock from the z-wave network, eventually make a factory reset of the lock)

Then copy the config xml to NR (.node-red folder) and using the same key in the controller configuration, restarting NR and it started to work!!!

The lock can now be locked/unlocked from NR and events are popping in as expected!!!

Provided you have the "NR acceptabel format" prepared in the options.xml file to begin, I believe you can pair devices (also secure) directly from NR just by adding some nodes with a little code inside. As in this example (Please note, the configuration may not fully match yours)


[{"id":"e9cef7ff.dee088","type":"zwave-out","z":"d5c97481.664918","name":"","controller":"4e05476a.59dcd8","x":1110,"y":120,"wires":[["b06bd4d7.1f4a98"]]},{"id":"b06bd4d7.1f4a98","type":"debug","z":"d5c97481.664918","name":"","active":true,"console":"false","complete":"true","x":1250,"y":120,"wires":[]},{"id":"14a2130d.615d8d","type":"inject","z":"d5c97481.664918","name":"Add device","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":790,"y":80,"wires":[["824457bc.28bb48"]]},{"id":"824457bc.28bb48","type":"function","z":"d5c97481.664918","name":"","func":"msg = {\"topic\": \"addNode\", \"payload\": true};\nreturn msg;\n","outputs":1,"noerr":0,"x":970,"y":80,"wires":[["e9cef7ff.dee088"]]},{"id":"fdd7b6c1.558f38","type":"function","z":"d5c97481.664918","name":"","func":"//RemoveNode\nmsg = {\"topic\": \"removeNode\", \"payload\": {\"prependHomeId\":true}};\nreturn msg;","outputs":1,"noerr":0,"x":970,"y":160,"wires":[["e9cef7ff.dee088"]]},{"id":"72e2f479.5fb31c","type":"inject","z":"d5c97481.664918","name":"Remove device","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":800,"y":160,"wires":[["fdd7b6c1.558f38"]]},{"id":"4e05476a.59dcd8","type":"zwave-controller","z":"","port":"/dev/ttyACM0","driverattempts":"3","pollinterval":"10000","allowunreadyupdates":false,"networkkey":"\"0x00,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10\"","logging":"full"}]



Reply all
Reply to author
Forward
0 new messages