-
Notifications
You must be signed in to change notification settings - Fork 3
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
Query about zbhub #55
Comments
@jrjefferies Another good spot! I am glad you have managed to untangle my possibly confusing web of function names and inheritance. This I feel could possibly do with a little untangling once understood. The idea was that all ‘zb’ classes inherited from zbnode could be written in such a way that they perform different functions on receiving a message (I.e the hub creates a list of known end devices, whereas the SmartPlug simply records its hub address). I haven’t got my kit up and running at the moment but from what you describe it looks like we are potentially sending discovery messages ( from device_obj_from_addr) before the expected replies therefore possibly confusing the end device? Or worse causing a cycle of repeating messages. Like you say we have a couple of options...
Or
To be honest I’d be interested in your view and your testing, but both sound plausible. The advantage of solution 1 is that it maintains the rudimentary force discovery of new unknown device types. I will attempt to get my kit setup again, but in the mean time, if you do come to a solution please feel free to pop it in a PR and I'll happily merge it in @andydvsn may also be interested. All the best, Jim |
Jim, If not, I am thinking about putting a statemachine in the zbhub process_packets. It will work something like this
[NOTE - stages to be worked out - I am still trying to get my head around all the steps needed for proper joining of the hub] This would keep the zbnode parse_message for generic message responses and move the specific coordinator responses in the zbhub process_message Tell me what you think. PS - I will commit the changes I made on this issue - even though its not completely fixed the issue. |
…ent / readability changes
Update to issue #55 (not fully fixed), + document / readability changes
I have spent most of the day working through the structure and trying to work out why we are messing up the joining. I think I have found something. The import structure goes like this (I think)
console-example -> zbhub -> zbnode -> node
Note - We can replace console-example with hub-example - it calls the same stuff
We we initiate the ZBHub, we initiate the ZBNode. This starts the zigbee library with a callback of 'receive_message'
receive_message does three things
The next thing to note is the zbnode process_message is documented as being STUB to be overwritten by zbhub
So in zbhub the process_message does the following
Now the problem is that device_obj_from_addr does the following
Because the device_obj_from_address is sending directly from the zbnode class, these message are
It looks like the messages being generated in device_obj_from_address are in the wrong place. This may be a leftover from an earlier version (sorry, not checked the commit record).
So we can do a couple of things. Move the send messages from the device_obj_from_addr (feels the correct thing to do), or move the process_message until after the parse_message queue is send.
I probably need guidance on what direction to go to..
Regards,
James
The text was updated successfully, but these errors were encountered: