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

Example code for including devices in Z-Wave network #4

Closed
trycoon opened this issue Aug 15, 2016 · 7 comments
Closed

Example code for including devices in Z-Wave network #4

trycoon opened this issue Aug 15, 2016 · 7 comments

Comments

@trycoon
Copy link

trycoon commented Aug 15, 2016

WZWave it quite lowlever (for the moment), it would be nice with an code example that shows how to include new Z-Wave devices to an already existing controller/network. Also excluding devices from a network, and route optimization commands if available would be nice.
http://www.vesternet.com/resources/technology-indepth/understanding-z-wave-networks

@whizzosoftware
Copy link
Owner

Currently there is no way in the library to include/exclude nodes or do route optimization. It's something that may be added in the future, but for now, you have to do that manually using whatever mechanism the USB controller gives you. On my Aeon Labs Z-Stick 2, you press the button to put the controller in inclusion mode and long-press the button to put it in exclusion mode.

@trycoon
Copy link
Author

trycoon commented Aug 16, 2016

Yes that is a nice feature of the Aeon Labs-stick, and the internal battery so you don't have to bring the device to your computer. My controller is simpler in design, https://www.z-wave.me/index.php?id=28, it does not have any buttons and all inclusion must be done by software as I understand it. But I guess I could always do that step in an other Z-wave software, its more or less a one-time procedure. Maybe this issue could remain open as a feature-request for the future?

@whizzosoftware
Copy link
Owner

Yes, let's leave it open. I'll have to dig around and see if I can find any information about putting Z-Wave controllers into inclusion/exclusion mode. I'm not sure if there's a standard way to do it or if it will vary by controller.

@whizzosoftware
Copy link
Owner

I did a little digging and found a standard way (I think) that Z-Wave controllers can be told to enter/exit inclusion mode. I've checked in an implementation that appears to work with my Z-Stick although it's lacking any feedback beyond a callback when the inclusion mode is entered or exited. It will be some more work to figure out how to get callbacks as devices are added to the network.

To enter inclusion, you'd call: controller.sendDataFrame(new AddNodeToNetwork(AddNodeToNetwork.ADD_NODE_ANY));

To exit inclusion, you'd call: controller.sendDataFrame(new AddNodeToNetwork(AddNodeToNetwork.ADD_NODE_STOP));

I'll keep this issue open until this capability can be fleshed out further and tested.

@whizzosoftware
Copy link
Owner

Oh, and I also just checked in an implementation for the SetDefault frame which will reset the controller back to factory defaults. This is helpful when testing the AddNodeToNetwork capability.

To call it:

controller.sendDataFrame(new SetDefault());

@trycoon
Copy link
Author

trycoon commented Aug 17, 2016

Thanks! I can confirm that all three commands works perfectly on my controller. When I enter inclusion mode a blue LED starts flashing within my controller and when I exit inclusion mode it stops flashing. Setting the controller to factory default removes the two nodes that I reported earlier was bound to my controller but I didn't know how they got included in the first place. Sweet! :-)

I have provided some trace-files, the first one shows my demo-program running, entering inclusion mode, exiting, and finally resetting the controller. All without any flaws.
trace1.txt

The second trace does the same thing, but in the start we could see that it no longer detects the node 2 and 3, that never should have been there in the first place (maybe I got a used controller). So the factory resetting command from the previous run does work.
trace2.txt

Finally the third trace I run the same program but during the inclusion phase I include a Fibaro Smoke sensor (http://manuals.fibaro.com/smoke-sensor/). Its detected and the sensor beeps and flashes green as it should when included.
trace3.txt

Nice done Daniel!

Next I will try to include a http://www.philio-tech.com/pdf/PAN04.pdf, and see if its working and if I could turn it on and off.

@whizzosoftware
Copy link
Owner

That's great news! The trace logs you provided all look as I would expect them to so I guess this issue is getting close to being resolved. There are a couple of things I want to improve before calling it done. Thanks for your help in testing :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants