EdiMax SmartPlug Smart plug nodeRED and Emoncms

I was wondering, is there a solution to use Smart Plugs with Emoncms to monitor the energy consumption?

I use a EdiMax SmartPlug SP-2101W to capture the data and I use Node-RED to send it to a the emonPi version of emoncms.

1 Like

I’ve got a Belkin Wimo Insight plug which can monitor energy. Has anyone managed to connect this to emoncms? Remember seeing a thread on the old forums. NodeRed?

there is a Node-RED node for the Belkin WeMo device. I also looked into the Belkin device but I don’t remember why I bought the one over the other.

and lots of info on the old site also:
https://openenergymonitor.org/emon/search/node/wemo

1 Like

Nice, I’ll give the nodeRed flow a go to get power data into emoncms and control via mqtt :wink:

There is one thing you may want to look for with the Belkin…
https://openenergymonitor.org/emon/node/10324#comment-41268

Thanks guys! Looks interesting! I’m gonna try the Edimax

Both use wifi first instead of direct (433mhz) rf to PI. Looking for a solution to measure 1 phase installations on farms, where wifi isn’t available. Now I have 5 Emontx and just ordered another 2, but the single phase must be easier with smart plugs or something. And to cover a large range, I have now 3 PI with rf to collect al the data.

What about a DIY plug? As additional Emon product? (Just thinking)

What are the configurations of these nodes?

I’m interested in appliance level data, Jon, can you please post your exported nodes

Regards
Dave

@bart - the EdiMax SmartPlug SP-2101W is a wi-fi product. It is configured via a smartphone via wifi and it communicates with Node-RED via wi-fi

@bart and @Dave - Assuming you have Node-RED (and its dependencies) all set-up and running. Download and install the node-red-contrib-smartplug and the node-red-node-emoncms.

This is the json info to Import into a Node-RED Flow (hamburger menu > Import > Clipboard):

[{“id”:“61232a62.9edcd4”,“type”:“smartplug-device”,“z”:“”,“name”:“edimax smartplug”,“host”:“192.168.40.235”,“timeout”:“10”,“retry”:“5”},{“id”:“6f9482ce.906b7c”,“type”:“emoncms-server”,“z”:“”,“server”:“http://127.0.0.1/emoncms",“name”:“emonPi”},{“id”:“a40c0b3e.5bf3f8”,“type”:“function”,“z”:“88d45470.772ba8”,“name”:"get Data”,“func”:“msg.time = ‘’ + Math.round((Date.now() / 1000));\n\nvar str1 = "power:" + msg.payload.status.nowPower + ","\n + "current:" + msg.payload.status.nowCurrent + ","\n + "volts:" + (msg.payload.status.nowPower/msg.payload.status.nowCurrent);\n \nif (msg.payload.status.state === false) \n {\n var str2 = ",state:0";\n } \nif (msg.payload.status.state === true) \n {\n var str2 = ",state:10";\n }\nmsg.payload = str1.concat(str2);\nreturn msg;\n”,“outputs”:“1”,“noerr”:0,“x”:260,“y”:120,“wires”:[[“fee631b4.0119d”,“8dc3f490.723c08”]]},{“id”:“fee631b4.0119d”,“type”:“emoncms”,“z”:“88d45470.772ba8”,“name”:“emonPi emoncms 16”,“emonServer”:“6f9482ce.906b7c”,“nodegroup”:“18”,“x”:460,“y”:120,“wires”:},{“id”:“2442be42.dbbd42”,“type”:“smartplug-in”,“z”:“88d45470.772ba8”,“name”:“EdiPlug”,“topic”:“”,“device”:“61232a62.9edcd4”,“interval”:“10000”,“deviceinfo”:false,“schedule”:false,“status”:true,“cost”:false,“costFactor”:0.2,“costUnit”:“$”,“x”:110,“y”:120,“wires”:[[“a40c0b3e.5bf3f8”]]},{“id”:“d512a1e0.2aed6”,“type”:“comment”,“z”:“88d45470.772ba8”,“name”:“EdiMax SmartPlug SP-2101W”,“info”:" ",“x”:180,“y”:60,“wires”:},{“id”:“8dc3f490.723c08”,“type”:“debug”,“z”:“88d45470.772ba8”,“name”:“get Data debug”,“active”:false,“console”:“false”,“complete”:“payload”,“x”:440,“y”:80,“wires”:}]

EDIT: added config images below.

This is the Node-RED config for the SmartPlug:

and

There is a problem with these Edimax smart plugs. Most of these integrations use the http method to access the plug’s information. Unfortunately there seems to be a bug (likely to be a log or some such filling up) that means they stop communicating after a while and need to be switched off and then on again.

This code GitHub - panjanek/EdiManager: Command line utility for controlling Edimax plugs and cameras remotely through Edimax cloud service seems to operate using UDP which I think is likely to be more robust but it is written in C# and I have no idea how to convert it to python.

@borpin - I have not run across this issue. I’ve been running the EdiMax SmartPlug since the beginning of February with no stop in the communications.

There is updated firmware located at:
http://us.edimax.com/edimax/download/download/data/edimax/us/download/product/home_automation/home_automation_smart_plug/sp-2101w/
and that updates the firmware from version 1.04 to version 2.03. Maybe this firmware fixes the issue. I did see your comments at: GitHub - mapero/node-red-contrib-smartplug

@bart and @Dave - There are three slightly annoying issues:

1. If the power dies when the EdiMax SmartPlug is turned on, the EdiMax SmartPlug stays in the “off” mode when power is restored. The SmartPlug does not return to the previous state. I’d rather have the EdiMax SmartPlug return to previous state before the power died.

2. If the EdiMax SmartPlug is unplugged the Node-RED the SmartPlug node will generate errors every 10 or 15 seconds. This might fill up a log quickly.

3. If I change the Interval(ms) from the default of 1000 (or any other number) to the new number of 300000 the change does not happen after a Node-RED Deploy.

To get the interval change to be accepted I stop and start the Node-RED service via:
sudo service nodered restart

Ah, I had read that as the tool version not the firmware version. I’ll upgrade the firmware and see what happens. Cheers.

Are there any advantages to the Edimax plug over the belkin wemo insight? What are the pros and cons of each with regard to openness and ease of data access and control? Just interested if anyone has been able to compare?

Great! You convinced me, I ordered 4 Edimax SP-2101W.

@Jon annoying issue 2, can be solved by adding a check in the script of Get Data?

Does the Belkin return power data? I think the Belkin is more expensive. I got my Edimax smartplugs when they were on offer at Maplins for £25 ea. For simple on/off control I will go with some lightwave sockets and get an OOK controller chip.

@bart - I ignore the errors but you can parse for them as needed.

Here is the normal output with only the Status box checked (output from the Debug tab of Node-RED):

May 22, 2016 at 10:35:46 AM CDT debug(msg.payload)
msg.payload : Object
{ “status”: { “state”: true, “nowPower”: 240.75, “nowCurrent”: 2.0359, “day”: 0.029, “week”: 0.029, “month”: 10.878, “lastToggleTime”: “2016-04-20T02:59:31.000Z” } }

.
Here is the error output with SmartPlug unplugged:

May 22, 2016 at 10:39:38 AM CDT EdiPlug
msg : error
Error: Request timeout occurred - request aborted

May 22, 2016 at 10:39:53 AM CDT EdiPlug
msg : error
Error: Request timeout occurred - request aborted

May 22, 2016 at 10:40:08 AM CDT EdiPlug
msg : error
Error: Request timeout occurred - request aborted

In my test the above continues every 15 seconds (8 messages total) lasting about 2 minutes.
.

Here is the error output with SmartPlug unplugged longer than 2 minutes:

May 22, 2016 at 10:41:31 AM CDT EdiPlug
msg : error
Error: connect EHOSTUNREACH

May 22, 2016 at 10:41:39 AM CDT EdiPlug
msg : error
Error: connect EHOSTUNREACH

May 22, 2016 at 10:41:47 AM CDT EdiPlug
msg : error
Error: connect EHOSTUNREACH

The above continues every 8 seconds until the SmartPlug is plugged into an outlet.

Thanks in advance!

I’ll let you know when I have configured the splugs. First I have to wait till it arrives :wink:

Yes the Belkin Wimo Insight returns power data.

So it boils down to price. Maplin have the Edimax at £25 (make sure you get the SP2101 as I don not think the 1101 returns power) and the cheapest Wemo Insight seems to be £50.