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

Upon discovery and association, devices remain in pairing mode. #45

Open
andydvsn opened this issue Oct 21, 2017 · 7 comments
Open

Upon discovery and association, devices remain in pairing mode. #45

andydvsn opened this issue Oct 21, 2017 · 7 comments
Projects

Comments

@andydvsn
Copy link

andydvsn commented Oct 21, 2017

Just getting to grips with the module and have managed to get it controlling some SmartPlugs pretty well, but I'm having difficulty getting devices to 'pair' with the XBee. Using your hive-smartplug-xbee project code the SmartPlugs once discovered drop out of pairing or range-finding mode and behave perfectly well. However, using the discovery feature of this module causes devices to associate at least well enough to show up when using hub_obj.list_devices(), but they are generally unreliable in returning data, while the switch_state of SmartPlugs associated using the hive-smartplug-xbee code is seen and logged instantaneously.

I'm in the process of associating some Buttons and Motion Sensors for testing, but they are remaining in range finding double-flash mode and are not reliably returning data when triggered. Are there further steps I should be taking in my code to properly associate them, other than calling hub_obj.discovery()?

Thanks!

@jamesleesaunders
Copy link
Owner

Hi Andy, Thanks for your interest in this library. I extremely glad it has proved useful to someone.
With the switch (SmartPlug) one thing I did discover is it always works better if the first message is sent to it is a call for switch relay status (CLUSTER_CMD_AM_STATE_REQ) before attempting to switch it on or off (CLUSTER_CMD_AM_STATE_CHANGE), otherwise the switch does not respond to switch changes. If you find out why please let me know. Like you say the cut down hive-smartplug-xbee example works slightly differently, perhaps there is something I missed in the transfer to PyAlertMe.

Now, I really could do with some help! I am not really a Python coder and I do not actually own a AlertMe hub (only a few sensors and plugs), I would be extremely delighted if someone wanted to help contribute to this PyAlertMe code to towards making it a more useful library. With the recent closure of the AlertMe platform there are no doubt countless AlertMe devices which could still be useful! It is a shame British Gas did not allow them to be associated with the Hive (It was technically possible, they just chose not to for commercial reasons). So, if you have any ideas please do let me know, better still raise a PR!

My first wish would be to structure the files and classes in a more appropriate organisation. I am not convinced my folder structure or class inheritance hierarchy is really 'pythoneske' If someone could guide me on this I would be most grateful!

All the best Andy, please do keep in touch - I would love to hear more about your project!

Jim

@andydvsn
Copy link
Author

Hi Jim, Thanks for getting back to me! I'll experiment with trying different status commands first; I tried pairing another SmartPlug yesterday and it didn't work with the library, but worked like a charm using hive-smartplug-xbee - after which time it was happy to chat to the XBee and communicate for on/off and power usage information using PyAlertMe. The Button I have managed to get paired, but it's stuck in range finding mode and rarely communicates reliably - and setting Normal mode in the library does nothing except for interrupt it briefly, then it resumes range finding.

I'm holding off removing any of my other AlertMe devices from the original Hub, as AlertMe are due to provide me with a data export from my system and I'm guessing that removing devices will erase the history. I'll definitely be tinkering with this more once the old system goes offline and I have my history exported though.

I am definitely a good few rungs down the ladder on your Python experience and a few years rusty on coding these days, but I'll definitely contribute what I can! The devices are so nicely made and the possibilities for using them with custom code is huge... :)

@andydvsn
Copy link
Author

andydvsn commented Oct 25, 2017

Made some progress this evening with the Button, mostly by repeatedly hammering the poor thing with Active Endpoint Requests, Match Descriptors and the Hardware Join messages.

At first it appeared to leave ranging mode, but only responded with the counter value when the button was pressed, with no illumination of the LED ring. Occasionally it would offer up a 'button_state', but most often not. I tried a few more times, but then gave it a whirl with the back cover attached (so the tamper button was depressed). Could have been coincidence, but from then on the Button has responded properly - though whether this will survive a battery pull is yet to be seen.

I've put some video evidence of where I've got to on Vimeo.

In theory there should be little difference between the Button, Keyfob, Motion Sensor and Alarm Sensor, so I'll definitely be trying the others at some point soon.

@jamesleesaunders
Copy link
Owner

Hi Andy,

Thanks for the updates. It sounds like you are really getting stuck in!

If any comfort I also experienced the issues where sensors and buttons would associate with the hub but act a little sporadically after a while.
Like you say it seems to work for 5 mins or so but then takes a bit of kicking to get it to respond again. I too experimented with the tamper button on the back (ie putting the lid back on) again with unpredictable results.

I did recently read that apparently the AlertMe setup need at least one SmartPlug in its setup as a router. The sensors and button are only ZigBee 'end-devices' and the network therefore needs at least one ZigBee 'router' (not to be confused with hub which is a ZigBee 'co-ordinator'). I did notice that things seems to associate better when I have a SmartPlug online also (by the looks of your videos you have).

Thanks for the link to the Vimeo vids - they looks great! It is amazing how a video can speak a millions words!
Please can I ask a favour?.. please can you pop a reference and link to the PyAlertMe GitHub page https://github.com/jamesleesaunders/PyAlertMe/ to hopefully bring in some other people.

Jim

@andydvsn
Copy link
Author

andydvsn commented Oct 27, 2017

No problem, I shall add in some links back to this project.

Just tried associating a PIR using the same 'brute force' method and it worked just fine. It's seems very sensitive to motion! However, I've just tried the same technique for associating a Door/Window Sensor and though it has dropped out of pairing mode, I only get the following when it is triggered.

2017-10-27 00:54:38,839 CRITICAL zbnode 418 XBee Error: need more than 2 values to unpack

It seems to be transmitting and being received okay, but perhaps there are issues beyond that. I'll make a separate issue for tracking.

It has just occurred to me that I have no idea what firmware version this is actually running. I know there were some differences between the versions for AlertMe and British Gas Safe & Secure (v2.8r1 was the latest on AlertMe, v2.9 on Safe & Secure). After the switch-off there'll be no way to update the firmware, so I should really go through and update all of these devices and test them again.

@jamesleesaunders
Copy link
Owner

Did you get anywhere with this one?
I am wondering if #55 will fix this?

Unfortunately zbnode 418 is the stock error for all errors which happen (it is a bit confusing really and potentially should be removed) If would be more useful to print out the whole error stack trace.

@andydvsn
Copy link
Author

andydvsn commented Nov 1, 2017

Just trying the firmware update on the Safe & Secure hub; v2.2r1 was the latest on the (now defunct) AlertMe hub, but looks like there's something new on the BG system.

@jamesleesaunders jamesleesaunders added this to To Do in PyAlertMe Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
PyAlertMe
  
To Do
Development

No branches or pull requests

2 participants