2015-02-13

Automatically Email Zigbee/Z-wave Sensor Changes from the Almond+ WiFi Router

Disclaimer: I do not work for Securifi

Last year I backed the Almond+ WiFi router on Kickstarter (Securifi).  After a couple of delays which weren't entirely unexpected from this type of project, I received it in the mail.  Since then, it has been working quite well.

Before delivering the Almond+, Securifi sent out an option for backers to order sensors from them.  Since they were ~$30 each, I figured I would get a couple and try them out.  I ordered a flood sensor, AC switch, window/door switch and a motion sensor.

Securifi has a cloud service that allows you to remotely connect to your router, monitor sensors, etc...  They're working on pushing sensor statuses to a mobile app you install on your smartphone, however last I checked they have some bugs they're still fixing.  There are several people waiting patiently for this functionality, including myself.  I also decided to quickly code a poller.

Since you can get sensor statuses from the routers web interface, I decided to write a python polling script that will scrape the sensor values from your router and send an email whenever they change.  I threw the script together pretty quickly, so it's not the greatest code but it works.

I setup the script as a service that automatically runs on startup on a computer running Ubuntu Linux.

A couple of quick notes:
  • Update all the xxxx in the Python source code as appropriate
  • You may have to tweak ALMOND_URL for different versions of firmware
    • I have version Software Version : AP2-R070-L009-W016-ZW016-ZB005
  • I did have issues with the gmail password, and had to follow some steps found at the accounts website (see comment above variable) to setup the application
  • With a couple of changes, I'm sure you can get it working with email services other than gmail, or if you're more ambitious change it entirely to use some other communication (twitter, ifttt would be very powerful, etc...)
  • I added a bit of code to interpret the status of the sensors I have, I haven't tried it with any other sensors but I don't see why they wouldn't work
    • Custom code can easily be added for other sensors to make their status more human readable
Click here for the Python source code.

Post any questions, suggestions, and changes/additions you make in the comments section below.