OpenEnergyMonitor Community

EdiMax SmartPlug Smart plug nodeRED and Emoncms

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

No, gave up on it. Was too unreliable. I returned the unit.

Mike - I am guessing you already have the node-red node - node-red-node-wemo.

There is an older example available Belkin Wemo Switch Control

And there is even an emulator available for the Amazon Echo Alexa: node-red-contrib-wemo-emulator

maybe one of those will help…

Thanks for everyones input into this, I recently received an EdiMax Plug and quickly got it working with node-red thanks to this post. The only thing i found i was missing was last state i spent a bit of time and came up with the following flows, in addition to the previous requirements you will need node-re-ping welcome to suggestions on improvements i would like to verify the plug is set to the last state and then end the flow how ever i’ll do that tomorrow now.

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

[{"id":"e1fe07d5.bd3648","type":"debug","z":"6102ceb1.69cb","name":"Get Last State","active":true,"console":"false","complete":"payload","x":612.9999847412109,"y":586.0000915527344,"wires":[]},{"id":"3194daa1.9a17b6","type":"debug","z":"6102ceb1.69cb","name":"get state","active":true,"console":"false","complete":"payload","x":537.9999847412109,"y":474,"wires":[]},{"id":"6e8be7bc.f0d1f8","type":"http request","z":"6102ceb1.69cb","name":"Get State","method":"GET","ret":"txt","url":"http://emoncms/emoncms/feed/value.json?id=33&apikey=","tls":"","x":383.99998474121094,"y":535.0000305175781,"wires":[["3194daa1.9a17b6","3c6dc7fb.b616f8"]]},{"id":"3c6dc7fb.b616f8","type":"function","z":"6102ceb1.69cb","name":"Get State Data","func":"if (msg.payload ===  \"\\\"1\\\"\")\n\nmsg.payload = \"laststate:1\";\n\nelse \n\nmsg.payload = \"laststate:0\"\n\nreturn msg;","outputs":1,"noerr":0,"x":569.9999847412109,"y":535.0000305175781,"wires":[["75a1e5a8.571e6c","ebf3f86c.490ee8"]]},{"id":"75a1e5a8.571e6c","type":"debug","z":"6102ceb1.69cb","name":"retrieved state","active":false,"console":"false","complete":"payload","x":763,"y":489,"wires":[]},{"id":"600361e7.d5863","type":"switch","z":"6102ceb1.69cb","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"","vt":"prev"},{"t":"false"},{"t":"true"}],"checkall":"false","outputs":3,"x":221,"y":538.0000305175781,"wires":[["c9d0923b.d19c2"],["6e053223.f68ecc","6e8be7bc.f0d1f8"],["e233f8d9.da68e8","3b099aee.1435c6"]]},{"id":"ebf3f86c.490ee8","type":"emoncms","z":"6102ceb1.69cb","name":"emoncms","emonServer":"c228ebaa.f505f8","nodegroup":"18","x":749.9999847412109,"y":535.0000915527344,"wires":[]},{"id":"f2d9e76d.d2f9f8","type":"function","z":"6102ceb1.69cb","name":"Convert to boolean","func":"if (msg.payload ===  \"\\\"1\\\"\")\n\nmsg.payload = \"true\";\n\nelse \n\nmsg.payload = \"false\";\n\nreturn msg;","outputs":1,"noerr":0,"x":682.0001068115234,"y":627.0000305175781,"wires":[["8a87ab1a.431058","389b4fd6.9e893"]]},{"id":"2c45481b.8afe58","type":"smartplug-out","z":"6102ceb1.69cb","name":"EdiPlug-1 Output","topic":"","device":"6eed92.db77a27","response":true,"x":1084.3723602294922,"y":627.3636779785156,"wires":[["5802f2a4.723d4c"]]},{"id":"5802f2a4.723d4c","type":"debug","z":"6102ceb1.69cb","name":"Plug now","active":true,"console":"false","complete":"payload","x":1266.3722381591797,"y":584.3636779785156,"wires":[]},{"id":"e233f8d9.da68e8","type":"http request","z":"6102ceb1.69cb","name":"Get Last State","method":"GET","ret":"txt","url":"http://emoncms./emoncms/feed/value.json?id=34&apikey=","tls":"","x":429.37205505371094,"y":626.5455627441406,"wires":[["f2d9e76d.d2f9f8","e1fe07d5.bd3648"]]},{"id":"24a1526e.d5764e","type":"ping","z":"6102ceb1.69cb","name":"Ping Ediplug-1","host":"","timer":"10","x":122.68464660644531,"y":428.38633728027344,"wires":[["6cc8d03c.19181"]]},{"id":"c9d0923b.d19c2","type":"debug","z":"6102ceb1.69cb","name":"Switch 1","active":false,"console":"false","complete":"payload","x":416.09934997558594,"y":366.727294921875,"wires":[]},{"id":"6e053223.f68ecc","type":"debug","z":"6102ceb1.69cb","name":"Switch 2","active":true,"console":"false","complete":"payload","x":423.0994110107422,"y":412.7273254394531,"wires":[]},{"id":"6cc8d03c.19181","type":"function","z":"6102ceb1.69cb","name":"Convert to boolean","func":"if (msg.payload ===  false)\n\nmsg.payload = false;\n\nelse \n\nmsg.payload = true;\n\nreturn msg;","outputs":1,"noerr":0,"x":137.1999969482422,"y":620.800048828125,"wires":[["3812925a.369f3e","600361e7.d5863"]]},{"id":"3812925a.369f3e","type":"debug","z":"6102ceb1.69cb","name":"convert","active":false,"console":"false","complete":"payload","x":192.2000274658203,"y":723.8000793457031,"wires":[]},{"id":"3b099aee.1435c6","type":"debug","z":"6102ceb1.69cb","name":"Switch 3","active":true,"console":"false","complete":"payload","x":359.0994110107422,"y":676.0001525878906,"wires":[]},{"id":"8a87ab1a.431058","type":"debug","z":"6102ceb1.69cb","name":"convert 2","active":true,"console":"false","complete":"payload","x":923.2812347412109,"y":565.0000305175781,"wires":[]},{"id":"389b4fd6.9e893","type":"delay","z":"6102ceb1.69cb","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":889.7783050537109,"y":626.8607482910156,"wires":[["2c45481b.8afe58"]]},{"id":"ed3ee68a.31c4c8","type":"comment","z":"6102ceb1.69cb","name":"Edimax Smart Plug Last State Restore","info":"","x":170.84027099609375,"y":360.4132080078125,"wires":[]},{"id":"c228ebaa.f505f8","type":"emoncms-server","z":"","server":"http://emoncms/emoncms","name":"emoncms"},{"id":"6eed92.db77a27","type":"smartplug-device","z":"","name":"edimax smartplug-1","host":"","timeout":"10","heartbeat":"5"}]

You’ll need to edit a few bits to get it working such as the http Requests to include your emoncms read api key as well as the ediplug ip. password etc