82 lines
3.2 KiB
HTML
82 lines
3.2 KiB
HTML
|
<script type="text/javascript">
|
||
|
RED.nodes.registerType('watt2kwh',{
|
||
|
category: 'function',
|
||
|
color: '#A6BBCF',
|
||
|
defaults: {
|
||
|
format: {value:"kwh"},
|
||
|
maximum: {value:"60", validator: function(v) { return !v || !isNaN(v)}},
|
||
|
maximumunit: {value:"mins"},
|
||
|
name: {value:""}
|
||
|
},
|
||
|
inputs:1,
|
||
|
outputs:1,
|
||
|
icon: "power.png",
|
||
|
label: function() {
|
||
|
return this.name||"watt2kwh";
|
||
|
}
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
<script type="text/x-red" data-template-name="watt2kwh">
|
||
|
|
||
|
<div class="form-row">
|
||
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
||
|
<input type="text" id="node-input-name" placeholder="Name">
|
||
|
</div>
|
||
|
|
||
|
<div class="form-row">
|
||
|
<label for="node-input-format"><i class="fa fa-envelope"></i> Output Format</label>
|
||
|
<select id="node-input-format">
|
||
|
<option value="j">joule</option>
|
||
|
<option value="kj">kilojoule</option>
|
||
|
<option value="wh">watt hour</option>
|
||
|
<option value="kwh">kilowatt hour</option>
|
||
|
<option value="mwh">megawatt hour</option>
|
||
|
</select>
|
||
|
</div>
|
||
|
|
||
|
<div class="form-row">
|
||
|
<label for="node-input-maximum"><i class="fa fa-history"></i> Timeout</label>
|
||
|
<input type="number" id="node-input-maximum" style="width:180px;">
|
||
|
<select id="node-input-maximumunit" style="width:120px;">
|
||
|
<option value="secs">Seconds</option>
|
||
|
<option value="mins">Minutes</option>
|
||
|
<option value="hours">Hours</option>
|
||
|
</select>
|
||
|
</div>
|
||
|
</script>
|
||
|
|
||
|
<script type="text/x-red" data-help-name="watt2kwh">
|
||
|
<h2 id="noderedcontribwatt2kwh">node-red-contrib-watt2kwh</h2>
|
||
|
|
||
|
<p>A node specifically written to convert power (watts) to energy (kWh).</p>
|
||
|
|
||
|
<h3 id="inputs">Inputs</h3>
|
||
|
|
||
|
<p>The node accepts a msg.payload input in the format of a number (example 6) or a string (example "6") provided that the string only contains numbers.</p>
|
||
|
|
||
|
<h3 id="outputs">Outputs</h3>
|
||
|
|
||
|
<p>The msg.payload contains the energy output, which can be set in the node config to be;</p>
|
||
|
|
||
|
<ul>
|
||
|
<li>Joules</li>
|
||
|
|
||
|
<li>Watt hour</li>
|
||
|
|
||
|
<li>Kilowatt hour or</li>
|
||
|
|
||
|
<li>Megawatt hour</li>
|
||
|
</ul>
|
||
|
|
||
|
<h3 id="details">Details</h3>
|
||
|
|
||
|
<p>As the calculation is dependent upon the relationship between the amount of power used, (or generated) <strong>and</strong> the interval between consecutive data points; <strong>interval x power = energy</strong> the very first value fed into the node will not produce an output, because the node requires a second value to be able to calculate the interval between the two values. </p>
|
||
|
|
||
|
<p>After subsequent feed inputs, the node will output the corresponding energy used or generated within that interval. </p>
|
||
|
|
||
|
<p>The Timeout setting in the node's configuration, should be set to at least the maximum interval between successive readings. This is to avoid the situation where for example, a sensor is taken off line, develops a fault or there is a communication problem, resulting in a break of several hours between readings and the calculation - <strong>interval x power = energy</strong> would then be inaccurate.</p>
|
||
|
|
||
|
<p>For example flows - see the <a href="https://github.com/Paul-Reed/node-red-contrib-watt2kwh/">README</a></p>
|
||
|
</script>
|