Belkin Wemo Insight + Emoncms

Hey guys as some of you already know i'm using smart plugs that are capable of reading power usuage in combination with emoncms. I already modified plugctl to make it read and upload data to emoncms for maginon smart energy plugs.

I wanted to have more plugs and more readings from smart plugs so i bought myself a Belkin Wemo insight. Rather expensive compared to the Maginon smart energy plugs, (25 € compared to 59€) but at least these are available, the smart Maginon are nowhere to be found anymore. More info on these smart plugs here www.belkin.com/us/p/P-F7C029/ link is for us version but there's a Europe version that works in France/Belgium/Netherlands as well (I just bought one from Coolblue)

I spent the evening looking around the web to see if it's somehow possible to get the milliWatt readings from the plug using software, and this is possible. So I now have whipped up a small Delphi application that reads the data from a Wemo Insight and posts it to emoncms. The data comes at a specified node and all seems to be working fine. I haven't let it run for a whole night, will do that this night. But I was wondering if anyone having Wemo Insights is interested in a program to read the data and post it to emoncms. You'll need a dedicated (Windows) PC though for this to monitor the plug day and night since i used Delphi to create the command line tool. I haven't tried creating a golang version of this (yet) which should make it more cross platform and be possible to run from Linux as well as from different hardware (like raspberry pi). But for now, I only have a crude Delphi application.

If there's interest in this, I can clean the source code and upload it to github and perhaps check to see if a go version of the program is somehow possible.

renza's picture

Re: Belkin Wemo Insight + Emoncms

I have a small python script that I wrote that does the same thing! Might be an alternative for those that don't have a windows box on 24/7.

 

 

import urllib2
import time

from ouimeaux.environment import Environment

env = Environment()
env.start()
env.discover(10)

while True:
        InsightParams=env.get_switch('WeMo Insight').insight.GetInsightParams()
        InsightParams=str(InsightParams)
        InsightParamsSplit=InsightParams.split("|")
        CurrentPower=InsightParamsSplit[7]
        CurrentPower=float(CurrentPower)
        CurrentPower=CurrentPower/1000
        CurrentPower=str(CurrentPower)
        print CurrentPower
        emoncmsURLhosted="http://emoncms.org/input/post.json?node=2&apikey=APIKEY&csv="
        PostURL=emoncmsURL + CurrentPower
        urllib2.urlopen(PostURL).read()

        time.sleep(1)

It's pretty rough and has no error handling, but it does the job. Please suggest any improvements!

joyrider3774's picture

Re: Belkin Wemo Insight + Emoncms

My program does more or less the same thing. I also use InsightParams, but i'm sending the soap message from within Delphi (not using Ouimeaux) and I'm connecting using ip:port, but it's basically the same thing. The only difference that I have is I calculate how long it takes to read the power from the plug, and have a delay value equal to the update interval of the feed (well it's configurable). If you know both values you can sleep for (delay-timeittooktogetpowervalue) and this makes it wait more or less 5 seconds since I have a delay specified of 5000 ms which is the same value I have my feeds set to. I don't know how this can be done in python though. I'm using tickcount.

borpin123's picture

Re: Belkin Wemo Insight + Emoncms

Yes I am interested.  Can you expand on how you setup the server environment, etc to communicate with the WeMO?  Interested in something to run on my Pi.

bruce_miranda's picture

Re: Belkin Wemo Insight + Emoncms

@renza Where is the python script running from?

nickpreiser's picture

Re: Belkin Wemo Insight + Emoncms

Hi,  I am running an Odroid (pi like) Linux box, with Ouimeaux, and it is working just fine for toggling the switch.  

I am interested in trying to get the power out, and did try your python script above, but got nothing out.

My Wemo device name is the default (same as your script) and the script did not error. 

Is there something I am missing? My python is very rough. I am a java guy.  

Thanks 

Nick P. 

nickpreiser's picture

Re: Belkin Wemo Insight + Emoncms

Nevermind,  I got it working. Hopefully, I am all set. Thanks for the script. 

Robert Wall's picture

Re: Belkin Wemo Insight + Emoncms

If you needed to change anything, it might be helpful to someone, doing the same at some time in the future, if you mentioned what you changed, or what you misunderstood.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.