Sunday, April 17, 2016

My Belkin WeMo Journey - Part 1

A few years ago, I purchased a house with solar pool heating. The system is supposed to be controlled by a little box which monitors temperatures around the place. The box has a set point in it (which is the desired water temperature) and determines whether it can pump water through some tubes on the roof to raise the water temperature to that set point. The box didn't work, and was showing wildly inaccurate readings so I decided it would just be easier if I plugged the pump in and turned it on manually on hot days.

This actually worked pretty great. In the morning, on a day we knew would be hot, we'd fire up the pump and go to work. We would come home and the pool would be a nice temperature for swimming. But, sometimes I forgot the pump was on and didn't realise until I went to bed later that night. I was wasting a lot of energy pumping water around unnecessarily.

I found the Belkin WeMo online and thought it was a great idea. I grabbed a waterproof container for outside, and placed the WeMo in the box. Now, I could turn the pump on and off whenever I wanted, all from my mobile phone. Fantastic.

I consider myself a fairly early adopter of this technology, and so I expected and understood the teething problems I originally experienced with the WeMo. It would occasionally disassociate from my Wireless Access Point and I'd need to power cycle it. Sometimes it would not connect to the AP, and I'd have to do a factory reset on it. It was a bit of a pain, but with each firmware update the reliability improved.

Today, I have 7 WeMo devices, 6 of them are the basic WeMo switch and one is a WeMo Insight. The Insight is now what I use to run the pool solar pump. It's in it's early infancy, so the stats collected aren't fantastic yet. The stats don't seem to persist across sessions and I can't get aggregated data from it yet, but I am sure these things will come with time.

The other WeMo devices I have control solenoid valves I have connected to sprinkler systems around my house. The in-built rules on the WeMo allow me to specify that after a switch has been turned on, it should automatically turn off after a set time. This means I don't accidentally water my front lawn for 3 hours. Love it!

I can water my front lawns (pop-up sprinklers), my front garden, my back garden, veggie patches, filling my pool with water, all from my phone. Plus, it also works via the internet.

There's currently a slight flaw though, which I hope one day can be resolved.
All of these WeMo switches are on my home WiFi network. This means that if a guest arrives at my house and connects to my Wireless, all they need to do is open the WeMo app on their phone and my WeMo's appear in the list. Not only this, but their app then registers with the Belkin Servers and can control them from anywhere in the world without my permission. I have since created a 'Things' wireless network, which is completely seperate from my home network for the WeMo's to live on. This prevents guests from being able to control my devices without my permission. But, most 'mum and dad' users won't know how to create separate wireless networks on their home router.

I have also created a C# WPF app which I can use to control these devices manually.
I watched a video by a pretty smart bloke on YouTube by the name of Jerry Berg (aka Barnacules).
This video of his ( demonstrates some code he wrote to use the WeMo Web API to control it via C# (or anything really). He very kindly released his code (in the video description), and I based several apps I have built around this foundation.
I now have a list which lists all of the WeMo devices in it. The app uses multi threading to regularly query the WeMo devices in the background and provide real-time updates on their status. Clicking on a WeMo allows you to turn that device on and off, etc.

The app also uses the uPnP searching that Jerry originally used (though it doesn't work on Windows 8 or up), and I took it one step further and integrated with the windows implementation of nmap to scan for devices that look like a WeMo on your lan automatically.

I went another step forward, and build a MVC5 web app in C# that lists all of the devices through a https website, and lets me control the devices from a web page hosted at my house. This means I can see and control the devices at home from any internet connected device with a web browser.

I did all of the above, because over the last two years the WeMo Android app has gone from being clunky, great, to poor, to great again. I did all my development when the app was performing poorly. But, the developers there have really done a good job with the current version.

I don't know who else out there has deployed the WeMo to the extent that I have, use as many of them on a daily basis or has developed applications that can control them via the web api. I'd love to talk to people who have done stuff like this.

If you're keen to play around with the code I have written, I am happy to send the latest versions through to you. I've got a couple other little purpose built wemo apps that run on Windows that do other things too (I even improved on Jerry's 'router reboot' script by re-writing it in C#).

If anybody from Belkin reads this, please have a look at my wish list below:
- I'd like to be able to sign in to the WeMo app with a Google Account
- I'd like to be able to add specific WeMo devices to my WeMo account
- I'd like to be able to login to a WeMo website and see all of my devices
- I'd like to be able to add devices that exist at multiple different locations and control them from the same interface (at the moment, I have one device at my office which I use to reboot a flakey ADSL router. I can't see it in my Android App, and so I have to use custom C# code to control it remotely)
- I'd like to be able to make a WeMo device 'managed', so that only the WeMo account that I have added it to can control it from outside of my LAN
- I'd still like to be able to query the web interface on it via a LAN address (i.e. same subnet)

So far, super happy with these WeMo's.

No comments:

Post a Comment