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

how to correctly use AddNode() / RemoveNode() #13

Closed
yesyesuk opened this issue Jun 8, 2017 · 4 comments
Closed

how to correctly use AddNode() / RemoveNode() #13

yesyesuk opened this issue Jun 8, 2017 · 4 comments
Labels

Comments

@yesyesuk
Copy link

yesyesuk commented Jun 8, 2017

Hi,
I have another question. I'm not really getting responses on the OpenZWave Google group, so I'm hoping someone here can help me, please?

I've made progress with implementing ZWave in my system. I'm at a point now where I want to implement adding (including) and removing (excluding) nodes without having to unplug the Z-Stick.

So I have a button that calls m_manager.AddNode(homeID, false) and one that calls m_manager.RemoveNode(homeID) to put the controller stick in inclusion/exclusion mode.

When I do that, I can add and remove a node. I get notifications of type ControllerCommand with the progress number in m_notification.Event. (by the way, did you not implement "enum OpenZWave::Driver::ControllerState" or can I just not find it?). Then I get a NodeNew notification.

So far so good. However, after including/excluding a node I get no further notifications at all.

Do I need to call anything to end the inclusion/exclusion mode and return to normal operation?

The OpenZWave API documentation for AddNode seems to imply that only one node can be added for each call to AddNode and then it would return to normal mode, but it's not quite clear.
"Start the Inclusion Process to add a Node to the Network." - A node, as in one node...

@dotMorten
Copy link
Member

I can't say for sure, but this part of the source code seems to indicate it will stop after the first one got added:

https://github.com/OpenZWave/open-zwave/blob/a1b24f962524c1940cc892e4af3791581c19d557/cpp/src/Driver.cpp#L3922

What were you expected in addition to the "NodeNew" notification?

@yesyesuk
Copy link
Author

yesyesuk commented Jun 9, 2017

I would expect it to return to normal operation where I can communicate with all included nodes.
Instead, after including a new node, I get no new notifications at all from any node. I need to restart the application to get things like ValueChanged or NodeEvent notifications at all.

It's quite possible that I'm doing something wrong, I just can't find what it is...

@dotMorten
Copy link
Member

dotMorten commented Jun 12, 2017

I don't get that. My network continues to operate fine while waiting for a node to get added.

@yesyesuk
Copy link
Author

That's weird.
I tested a bit more. When I call Manager.AddNode() or RemoveNode() notifications stop. When I then call Manager.CancelControllerCommand() (without including/excluding a node) it works again. If I actually include a node, the node gets added but Value related notifications do not resume. CancelControllerCommand() fails (returns true but the ControllerCommand notification has the Failed state in Event).
When I tried to exclude a node after calling RemoveNode() the node got excluded and for some reason another node also got excluded.

After including or excluding a node this way I need to call RemoveDriver and AddDriver to make it all work again (or restart the app, which does the same thing).

Could this be related to the controller stick I'm using? Which one are you using? I have the Aeotec Z-Stick S2.

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

No branches or pull requests

2 participants