Page 1 of 1

AlertMe Devices and the XBee

Posted: Thu Oct 19, 2017 9:19 am
by roobarb!
With the imminent demise of the AlertMe servers I’ve started experimenting with the PyAlertMe library written by James Saunders. I’ve had some success - there are some oddities that have cropped up, but on the whole I can now control a SmartPlug pretty reliably. I actually started with the simpler hive-smartplug-xbee code to better get to grips with how it all should work.

I’ll post some more detail when I get chance, but I’m using an XBee S2C with the little whip antenna, a USB adapter and the Python code. That’s all you need to get started, so long as you have some programming experience. I’m very rusty these days, but most of the complicated radio fettling has already been done.

Now I need to get to grips with controlling multiple devices and having them register reliably - something which I remember being a bit funny in the early days of the AlertMe system. I hit one issue where there are huge delays turning a newly discovered SmartPlug on and off, but this seemed to resolve itself over time or by re-running the script. All very odd.

Re: AlertMe Devices and the XBee

Posted: Sat Oct 21, 2017 1:54 am
by roobarb!
First working attempt to automate a SmartPug. :)


Re: AlertMe Devices and the XBee

Posted: Sat Oct 21, 2017 2:07 am
by roobarb!
This time the Python script builds an array of available devices and loops through them, turning them on and off. They're not all known immediately, which is why the start is a little stuttery.



The next step is to try integrating the actions of the plugs with services like IFTTT, but the basics of controlling a SmartPlug are remarkably straightforward now that I've wrapped my brain around it a bit.

Need to work on the code which does the association a bit though; it's a little finicky and the hive-smartplug-xbee script actually seems to make a better job of it than the code I've managed to cobble together from the PyAlertMe library. Very happy to have got this far, though!

Re: AlertMe Devices and the XBee

Posted: Wed Oct 25, 2017 6:33 pm
by mw631774
Can you tell me what XBee module you bought? I wouldn't mind playing around with one but want to be sure I buy the right one ...

Re: AlertMe Devices and the XBee

Posted: Thu Oct 26, 2017 10:34 am
by roobarb!
mw631774 wrote:
Wed Oct 25, 2017 6:33 pm
Can you tell me what XBee module you bought? I wouldn't mind playing around with one but want to be sure I buy the right one ...
Sure, it was an XB24CAWIT-001 which comes with a little whip antenna attached. You'll also need an XBee USB Adapter. If you're doing any testing on a Mac you'll need to install the FTDI Virtual COM Port driver because the one built-in with macOS High Sierra seemed a little twitchy for me. Actually, you're probably best installing the latest official Windows driver too.

Re: AlertMe Devices and the XBee

Posted: Tue Oct 31, 2017 7:54 pm
by mw631774
Thanks roobarb! - I've checked out at Farnell's and Digi's websites; I found the XB24CAWIT-001 you chose and noticed that this is an 802.15.4 variant; I know 802.15.4 is the basis of ZigBee but would it not be better to chose a ZigBee variant as this is what AlertMe is using?

For example, there are:

Re: AlertMe Devices and the XBee

Posted: Tue Oct 31, 2017 9:44 pm
by roobarb!
The honest answer is "I don't know". I just bought the XB24CAWIT-001 and re-flashed it with the ZigBee firmware using their XCTU software. Maybe there's something different about the models you linked to; or perhaps they just come pre-flashed with the ZigBee firmware.

If in doubt, grab the one that says ZigBee on the box. It's only £1 difference on OneCall.

Re: AlertMe Devices and the XBee

Posted: Thu Nov 02, 2017 8:04 pm
by mw631774
Fair enough :)