UNPKG

node-red-contrib-hs100

Version:

Node red module for controlling HS100 and HS110 devices.

89 lines (67 loc) 3.55 kB
<!-- The MIT License (MIT) Copyright (c) 2016 @biddster Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> <script type="text/javascript"> RED.nodes.registerType('hs100', { category: 'output', color: '#f37a33', defaults: { name: { value: '' }, host: { value: '' }, }, inputs: 1, outputs: 1, icon: 'hs100.png', label: function () { return this.name || 'hs100'; }, paletteLabel: 'hs100', align: 'right', }); </script> <script type="text/x-red" data-template-name="hs100"> <div class="form-row"> <label for="node-input-name"><i class="icon-tag"></i>Node Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-host"><i class="icon-tag"></i>TP-LINK Switch IP Address</label> <input type="text" id="node-input-host" placeholder=""> </div> <div class="form-row"> <div class="form-tips" id="node-tip">Tip: Setting the message property 'hs100_address' overrides the Address field above, so you can leave it empty.</div> </div> </script> <script type="text/x-red" data-help-name="hs100"> <h1>node-red-contrib-hs100</h1> <p>This Node-RED node is for controlling tp-link Wi-Fi Smart Plug - Model HS100.</p> <p>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.</p> <p>This node simply wraps the excellent work here <a href="https://github.com/czjs2/hs100-api">https://github.com/czjs2/hs100-api</a>. </p> <h1>Configuration</h1> <p>Drag this node on to a worksheet and double click it. Enter the IP address of the plug on your network. Save and deploy.</p> <p>If the message property 'hs100_address' is set it will <strong>override</strong> whatever is set in the Address field on the node's configuration screen.</p> <h1>Actuation</h1> <h2>Turn on</h2> <p>To turn the HS100 on, send a message to this node's input with the topic or payload set to <code>on</code>.</p> <h2>Turn off</h2> <p>To turn the HS100 off, send a message to this node's input with the topic or payload set to <code>off</code>.</p> <h2>Obtain power consumption data</h2> <p>To obtain the power consumption, send a message to this node's input with the topic or payload set to `consumption`. The consumption data will be sent via this node's output in <code>msg.payload</code>.</p> </script>