diff --git a/README.md b/README.md new file mode 100644 index 0000000..9a734a3 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# node-red-contrib-hs100 + +This Node-RED node is for controlling tp-link Wi-Fi Smart Plug - Model HS100. + +This node has only been tested with a HS100(UK). The HS100 is also available in US and EU plug versions. We expect they will work too. + +This node simply wraps the excellent work here https://github.com/czjs2/hs100-api. + +# Installation + +Change directory to your node red installation: + + $ npm install node-red-contrib-schedex + +Alternatively, use the Palette Manager in Node-RED. + +# Configuration + +Drag this node on to a worksheet and double click it. Enter the IP address of the plug on your network. Save and deploy. + +To turn the HS100 on, send a message a message with the topic or payload set to `on`. + +To turn the HS100 off, send a message a message with the topic or payload set to `off`. diff --git a/index.html b/index.html index 4b04a8d..df53179 100644 --- a/index.html +++ b/index.html @@ -48,12 +48,27 @@
- +
\ No newline at end of file diff --git a/index.js b/index.js index 43003fb..e35a0df 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ module.exports = function (RED) { var plug = client.getPlug({host: config.host}); node.on('input', function (msg) { - var state = msg.payload === 'on'; + var state = (msg.payload === 'on' || msg.topic === 'on'); plug.setPowerState(state); node.status({ fill: 'green', diff --git a/package.json b/package.json index 27763ef..3062807 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { "name": "node-red-contrib-hs100", - "version": "0.1.0", + "version": "0.2.0", "description": "", "main": "index.js", + "keywords": ["node-red", "tp-link", "tplink", "hs100"], "devDependencies": { "chai": "^3.0.0", "markdown-to-html": "0.0.13", @@ -21,7 +22,6 @@ "type": "git", "url": "https://github.com/biddster/node-red-contrib-hs100.git" }, - "dependencies": { "fx-hs100-api": "^0.3.0" },