2 min read

I decided to replace the current flow to control the edimax smartplug over node-RED with two smartplug specific nodes. The node makes use of the existing node.js module edimax-smartplug Foo by mwittig. The node.js package node-red-contrib-smartplug Foo adds two new nodes to your node-RED palette, one input node and one output node.

The input node polls the status of your edimax smartplug in a given interval and inserts the value as json object into your flow:

In the node configuration you can select which information the node should read from the smartplug. The output is a json object, e.g.:

{ "deviceinfo": { "vendor": "Edimax", "model": "SP2101W", "fwVersion": "1.03", "mac": "801F02FA5FF3" }, "schedule": { "0": "i0iu0", "1": "i0iu0", "2": "i0iu0", "3": "i0iu0", "4": "i0iu0", "5": "i0iu0", "6": "i0iu0" }, "status": { "state": false, "nowPower": 0, "nowCurrent": 0, "day": 0, "week": 0, "month": 0.089, "lastToggleTime": "2015-08-25T15:14:07.000Z" } }

The with the output node you can change the state of the plug and switch it on or off. It will only accept a boolean as input payload. Sending true will switch the smartplug on, sending false will switch it off. You can configure the node to send the new state after toggle as output:

Feedback an suggestions are welcome. Try it out by install the package over npm:

npm install -g node-red-contrib-smartplug

Jochen Scheib

Read more posts by this author.