OpenEnergyMonitor Community

EdiMax SmartPlug Smart plug nodeRED and Emoncms

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


@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”:“”,“timeout”:“10”,“retry”:“5”},{“id”:“6f9482ce.906b7c”,“type”:“emoncms-server”,“z”:"",“server”:“",“name”:“emonPi”},{“id”:“a40c0b3e.5bf3f8”,“type”:“function”,“z”:“88d45470.772ba8”,“name”:"get Data”,“func”:“msg.time = ‘’ + Math.round(( / 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:


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:
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.

I have received the plugs, installed in the network and configured it in NodeRed. It seems that it there is a problem with autohorization.

Debug: Error: Unauthorized: check username/password

I used the name of the plug as in the app in IOS and the standard password 1234.

the username is admin
(all lower case)
and the password is 1234

You’re right! Thanks.

Next error unfortunatly:

Error: connect EHOSTUNREACH

From my brief experience that error usually happens when the SmartPlug is not power up (meaning plugged into a live power outlet).

Are you able to control the SmartPlug and see the power readings from the Smart Phone app?

I still had to restart and the problem solved. Now all the smartplugs are working.

The voltage calculations turns into strange low values due to the powerfactor. The code should be P = U * I * Powerfactor.

“volts:” + (msg.payload.status.nowPower/msg.payload.status.nowCurrent / POWERFACTOR);

Where can I find the available definitions? msg.payload.status.nowPF or something?

The voltage calculation was me experimenting more than anything else.

The available measurements from the Node-RED SmartPlug node are:
state = msg.payload.status.state
nowPower = msg.payload.status.nowPower
nowCurrent = msg.payload.status.nowCurrent
day = (same pattern as above)

Glyn, were you ever able to regally poll the wemo insight to get usage data? If so, do you have a node red flow you can share? Thanks kindly. Mike.