Open Source Software Rules!

The Wemo app is all fine and good, but how does one control these devices from an external script?

A quick Google search reveals some kind soul, with a mind for open source software, has done all the work for us. Better yet, his work is hosted on Github. This can't get any easier!

Check it out here: https://github.com/iancmcc/ouimeaux

To get a copy of the author's source code, clone it to your local drive. From the command line enter:

git clone https://github.com/iancmcc/ouimeaux

Then:

cd ouimeaux

If you get a command not found error then you will need to install the git software by using your system's package manager (i.e. yum, apt, etc).

Oh, hold on. Did I mentioned I'm doing this from a Linux computer? Mac and other *BSD users should be able to follow along. The instructions for a Windows computer will differ. If you are running Windows and want to follow along, you could go buy a Raspberry Pi. They run Linux, are very inexpensive, and it would be a fun learning experience. Now where was I?

Right, let's get the ouimeaux software installed and working.



Before we can build the software, we need a couple of packages:

sudo yum -y install python-setuptools python-devel

You will also need to install the following packages in order to run the ouimeaux software after it has been built. You might as well do this now:

sudo yum -y install PyYAML python-gevent python-requests

Since I'm running on CentOS, I'm using the yum package manager. Naturally you will need to use the package manager native to the distro you are running on.

Now we can build and install the software:

python setup.py install

Alternatively, if you are purist like me, always build a package first from the source code and then install the package:

python setup.py bdist_rpm
cd dist
sudo yum -y install  ouimeaux-0.7.9-1.noarch.rpm

If the installation succeeded, you should now be able to browse for your Wemo Switch from the command line like so:

[abauer@bauerhaus ~]$ wemo list
Switch: CableModem
As you can see, I gave my Wemo Switch the name "CableModem".

Note that, if you are running a firewall, you will need to open incoming UDP port 54321 on the machine you are running this from.