Control "smart" devices - WeMo Example


With more and more inexpensive “smart” devices coming on the market, using PAC + [I]groov [/I]can be even more fun!

I’ve got a few devices kicking around here on my desk–all in the $50 - $199 range–which allow me to wirelessly control a wall socket or switch, a color-changing LED lightbulb, or even anything IR–like my TV/DVR/Roku! Since these devices are all IP addressable controlled by relatively simple/common tcp/ip packets, that means I can control/monitor them using the “Communication” commands in PAC Control.

For example, the simplest/cheapest of these devices is my WeMo WiFi-enabled switch by belkin which I bought at the local Home Depot.

With the explosion of open source code/the Internet of Things, more and more of these protocols and packets for smart devices are published and well-documented on the Internet.

The WeMo was not as well-documented as some (I get a little spoiled around here with our award-winning Opto 22 documentation). But the packets were plain http (vs. https), and therefore easy for Mary “the hacker” St. John to sniff. Of course, this “Ver. VA01” WeMo switch could work differently than WeMos in the future, your results may vary, standard disclaimers here.

The initial setup was pretty easy using their free app for Android & iOS. Once I had it working through the app, I just needed to know the IP address and the exact packet (an HTTP Post) to send to it.

I used another free smartphone app, called FING, to do the IP scan. If your network is large, search the big list for “belkin” or MAC addresses starting with EC:1A…

We’ve used a couple of different packet sniffing tools around here, but I’ve included my sample chart below, so you don’t have to do any sniffing!

Just import this chart into an existing strategy (right-click on the Charts folder in your strategy tree), initialize the variable called [B]WEMO_sIPAddress[/B], then change the value (from groov, PAC Display, or other HMI) of the Numeric Variable called [B]WEMO_nOnOff[/B] to turn on/off the switch.

This chart could be even simpler if I just kept hitting the WeMo with the HttpPost command, but I’ve added a little extra logic in the chart to only send the command if it changes. Also note the optional pink block if you have the “Insight” (more expensive) WeMo which has power usage information too.

[B]Neat-o, WeMo!

-OptoMary (4.63 KB)[/B]


This was soooooo cool, that we decided to make a little video of the process…


Thanks Mary!


OK. So we got our W-Emo switch up and running, and the example writes directly from Opto to [B]WEMO_nOnOff[/B] which updates the Belkin exernal switch through Wi-Fi.

The only slight problem is that if someone switches the output directly from a dedicated phone app, the output status as perceived by PAC/Groov is not correct. I.e. there is no feedback of true device status.

Maybe after sorting out Bens garage :D, her highness the “High Priestess of Technology” could expand the sample code to include the relevant code samples to read current status of the wemo device. A “best practice” implementation would be some subroutines that just need you to add the IP address of the Wemo device as a parameter, or even a new command group “Wemo” for slick integration.

For all geeks out there, all the possible commands that you can currently throw at a Wemo device are detailed in


We bought the “bumper fun pack” which includes a Wemo Movement Detector, which also needs the same GET command to read the Wifi device input status

The interesting thing about Wemo is that all the device configuration including rules and alerts is actually being stored on the end device, which is actually quite cool, in that there is no common master hub /gateway or polling.



Gob smacked.

I am in utter shock that you would even want to use another app once you get your Wemo working in groov!

All jokes aside, we see your point about reading the status, but seriously, since getting it working on the PAC and thus groov, I have not opened the Wemo app since… It never occurred to me to use two apps to do the one job… Its been fantastic!
One app to rule them all!

Note, Marys chart does loop around and do a read every second, so perhaps you just need to tweak your implementation of her chart?

Thanks for the URL listing the commands. The fun just doesn’t stop!


Hi All,

Well, I’ve been called various names before, but I think: “her highness the ‘High Priestess of Technology’” is a new one for me. Perhaps an acronym is in order? HHTHPOT? Or maybe I could just be “Princess of Technology” (POT) for short? :o

ANYWAY, I did discuss the “multiple masters” question with Ben, and even if you do have all [I]groov [/I]all the time, you might have more than one [I]groov [/I]user. So that’s a good point. But in the meantime, I have other gadgets on my desk that need hacking… I mean… need little examples to save y’all some programming.

However, do check out the optional PINK block show above, where I did read info from Ben’s fancier power WeMo device. It spits back info about power usage that looks something like this:

 // we need to parse the data that came back, which looks like this:
<s:Envelope xmlns:s="" s:encodingStyle=""><s:Body>
<u:GetInsightParamsResponse xmlns:u="urn:Belkin:service:metainfo:1">
</s:Body> </s:Envelope>

You might leverage some of that code to read back the on/off state and update so it’ll work w/multiple “masters,” and I hope you’ll share if/when you do!

-OptoMary AKA POT


Between you and me, the main reason that Ben moved to the U.S. is that the WeMo “Insight” version of the switch (which allows power usage monitoring) is only available in the U.S. and not “Rest of the World”. You might think that the problem can be solved with a travel adaptor, but the problem is that it only rated for 110VAC and not 220-240VAC, so it might just well blow up if you plug it in in Australia. Maybe someday Belkin will think about this, but for the moment the WeMo Insight is off limits for International usage.

BTW. I think HPOT is sufficient for business purposes!!


Update. Belkin has now released two “Continental European” versions of the WeMo Insight switch for 230Vac. Do be careful to select the right one for the plugs in your specific country or you might just be surprised. Needless to say the status feedback variables give different results than the original WeMo V1 Switch so your program should first ask for the model type.