With more and more inexpensive “smart” devices coming on the market, using PAC + groov 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 WEMO_sIPAddress, then change the value (from groov, PAC Display, or other HMI) of the Numeric Variable called WEMO_nOnOff 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.
WeMoChartToImportV1_1.zip (4.63 KB)[/B]