UNPKG

@smappee/node-red-contrib-smappee

Version:

Smappee Node-RED contains Smappee nodes and example flows

53 lines (49 loc) 2.13 kB
<script type="text/x-red" data-template-name="aggregated-switch"> <div class="form-row"> <label for="node-input-device"><i class="fa fa-globe"></i> <span>Smappee</span></label> <input type="text" id="node-input-device"> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> <span>Name</span></label> <input type="text" id="node-input-name" placeholder="Name"> </div> </script> <script type="text/x-red" data-help-name="aggregated-switch"> <p>Returns aggregated consumption every 5 minutes for all <a href="https://www.smappee.com/be_en/switch-smart-plug">Smappee Switches</a>.</p> <h3>Outputs</h3> <p>Aggregated power values are periodically returned through <b>msg.payload</b>:</p> <dl class="message-properties"> <dt>switchIntervalDatas <span class="property-type">array</span></dt> <dd>Aggregated values for all <a href="https://www.smappee.com/be_en/switch-smart-plug">Smappee Switches</a>.</dd> </dl> <h3>Details</h3> <p>Aggregated consumption values are returned for the <a href="https://www.smappee.com/be_en/switch-smart-plug">Smappee Switch</a>, the values are added together for each switch.</p> <p>Requires a <a href="https://www.smappee.com/be_en/plus-energy-monitor">Smappee Plus</a> or <a href="https://www.smappee.com/be_en/pro-energy-monitor">Smappee Pro</a> device running with the latest firmware that supports Node-RED.</p> <p><b>Note:</b> Please contact <a href="mailto:support@smappee.com">support@smappee.com</a> if you are having issues.</p> </script> <script type="text/javascript"> RED.nodes.registerType('aggregated-switch', { category: 'smappee device', color: '#99c031', defaults: { name: {value: ''}, device: {value: '', required: true, type: 'device-config'}, }, inputs: 0, outputs: 1, icon: 'arrow-in.png', label: function() { const plug = RED.nodes.node(this.plug); return this.name || 'aggregated switch' + (plug ? ':' + plug.uuid : ''); }, labelStyle: function() { return this.name ? 'node_label_italic' : ''; }, }); </script>