node-red-contrib-nefit-easy2
Version:
The most extensive Nefit Easy node for Node RED
234 lines (220 loc) • 9.99 kB
HTML
<!--
Nefit Easy Node for Node-RED
-------------------------------------------------------------------------------------------------------------------
Copyright (c) 2016 Pepijn Goossens
Copyright (c) 2018 Raimond Brookman
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/x-red" data-template-name="nefit-easy">
<div class="form-row">
<label for="node-input-easyconfig"><i class="fa fa-globe"></i> Nefit Easy</label>
<input type="text" id="node-input-easyconfig">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder="Topic">
</div>
<div class="form-row">
<label for="node-input-command"><i class="fa fa-cogs"></i> Command</label>
<select type="text" id="node-input-command" >
<option value="status">Get Status</option>
<option value="pressure">Get Pressure</option>
<option value="location">Get Location</option>
<option value="program">Get Program data</option>
<option value="display-code">Get Display boiler statuscode</option>
<option value="flow-temperature">Flow temperature</option>
<option value="set-temperature">Set temperature</option>
<option value="set-fireplacemode">Set Fireplace Mode</option>
<option value="get-usermode">Get User Mode</option>
<option value="set-usermode">Set User Mode</option>
<option value="getval-gasusage">Get Gas Usage</option>
<option value="gasusagepage">Get Max Gas Usage PageNr</option>
<option value="get-hotwatersupply">Get Hot Water Supply</option>
<option value="set-hotwatersupply">Set Hot Water Supply</option>
</select>
</div>
<div class="form-row">
<label for="node-input-value"><i class="fa fa-tasks"></i> Value</label>
<input type="text" id="node-input-value" placeholder="Value">
</div>
</script>
<script type="text/x-red" data-help-name="nefit-easy">
<p>This node uses the Nefit Easy Client Library to connect to your Nefit Easy thermostat.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">string | number | boolean</span>
</dt>
<dd> The value to be passed to the selected Command (only for Set Commands) </dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>Returned JSON data from the selected command</dd>
</dl>
<h3>Details</h3>
<p><code>msg.payload</code> consist of JSON returned by the selected command.
<ul>
<li><b>Get Status</b></li>
<pre><code>{
'user mode' : UMD,
'clock program' : CPM,
'in house status' : IHS,
'in house temp' : IHT (Number),
'hot water active' : DHW (Boolean),
'boiler indicator' : BAI ( 'central heating', 'hot water', 'off' ),
'control' : CTR,
'temp override duration' : TOD (Number),
'current switchpoint' : CSP (Number),
'ps active' : ESI (Boolean),
'powersave mode' : ESI (Boolean),
'fp active' : FPA (Boolean),
'fireplace mode' : FPA (Boolean),
'temp override' : TOR (Boolean),
'holiday mode' : HMD (Boolean),
'boiler block' : BBE (Boolean),
'boiler lock' : BLE (Boolean),
'boiler maintenance' : BMR (Boolean),
'temp setpoint' : TSP (Number),
'temp override temp setpoint' : TOT (Number),
'temp manual setpoint' : MMT (Number),
'hed enabled' : HED_EN (Boolean),
'hed device at home' : HED_DEV (Boolean),
}</code></pre>
<a href="https://github.com/marcelrv/nefit_easy_protocol/blob/master/uiStatus.md">Field description by the three letter codes</a>
<li><b>Get Pressure</b></li>
<pre><code>{
pressure : [value],
unit : [unitOfMeasure]
}</code></pre>
<li><b>Get Location</b></li>
<pre><code>{
lat : [latitude(Number)],
lng: [longitude(Number)]
}</code></pre>
<li><b>Get Program data</b></li>
<pre><code>{
active : [activeProgram],
program1 : programDataType,
program2 : programDataType
}</code></pre>
programDataType: array of switchpoints of the following structure
<pre><code>{
dow : [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ],
time : [00:00],
temp : [setpoint(Number)]
}</code></pre>
<li><b>Get Display boiler statuscode</b></li>
<pre><code>{
code : [displayCode],
cause : [causeCode],
description : (string),
action : (string),
}</code></pre>
<li><b>Flow temperature</b></li>
Get Actual Supply temperature
<pre><code>{
temperature : r.value,
unit : r.unitOfMeasure
}</code></pre>
<li><b>Set temperature</b></li>
Set the setpoint to the desired temperature.
<p><i>Input:</i></p>
<dl class="message-properties">
<dt>value
<span class="property-type">string | number</span>
</dt>
<dd>can be a number, or as a string can be prefixed with a specifier to add a bit of logic to changing the setpoint.</dd>
</dl>
<p>The specifier can contain a base for relative changes:</p>
<ul>
<li><code>setpoint</code> : this is the current target temperature;</li>
<li><code>in house temp</code> : this is the current measured temperature;</li>
</ul>
<p>Valid specifiers:</p>
<ul>
<li><code>> VALUE</code> : only change setpoint to "VALUE" if it's larger than the current setpoint;</li>
<li><code>< VALUE</code> : only change setpoint to "VALUE" if it's smaller than the current setpoint;</li>
<li><code>setpoint + VALUE</code> : increase the setpoint by "VALUE"</li>
<li><code>setpoint - VALUE</code> : decrease the setpoint by "VALUE"</li>
<li><code>in house temp + VALUE</code> : change the setpoint to in house temperature + "VALUE"</li>
<li><code>in house temp - VALUE</code> : change the setpoint to in house temperature - "VALUE"</li>
</ul>
<i>Output:</i>
<pre><code>{ status : 'ok' }</code></pre>
<li><b>Set Fireplace Mode</b></li>
<p><i>Input:</i></p>
<p>Boolean (True, False)</p>
<p><i>Output:</i>
<pre><code>{ status : 'ok' }</code></pre>
</p>
<li><b>Get User Mode</b></li>
Gets the current mode of operation
<p><i>Output:</i>
<pre><code>{ value : 'manual' | 'clock' }</code></pre>
</p>
<li><b>Set User Mode</b></li>
<p><i>Input:</i></p>
<p>String ('manual', 'clock')</p>
<p><i>Output:</i>
<pre><code>{ status : 'ok' }</code></pre>
</p>
<li><b>Get Gas Usage</b></li>
<p><i>Input:</i></p>
<p>String (PageNr, latest page if left empty)</p>
<p><i>Output:</i>
array of objects for each day (max 32 entries per page):
<pre><code>[{ date: Date,
hot water: Number (in kwH)
central heating: Number (in kwH)
average outdoor temperature: Number (in degrees Ceclius)
},
{...}
]</code></pre>
</p>
<li><b>Get Latest Gas Usage PageNr</b></li>
<p><i>Output:</i>
<pre><code>Number (latest page of 32 entries)</code></pre>
</p>
<li><b>Get Hot Water Supply</b></li>
<p><i>Output:</i>
<pre><code>{ value : "on" | "off" }</code></pre>
</p>
<li><b>Set Hot Water Supply</b></li>
<p><i>Input:</i></p>
<pre><code>"on", "off"</code></pre>
<p><i>Output:</i>
<pre><code>{ status : 'ok' }</code></pre>
</p>
<li>
</ul>
</script>
<script type="text/javascript">
RED.nodes.registerType('nefit-easy',{
category: 'function',
color:"#999999",
defaults: {
easyconfig: {value:"", type:"nefit-easy-config"},
name: {value:""},
topic: {value:"nefit-easy", required:true},
command: {value:""},
value: {value:""}
},
inputs:1,
outputs:1,
icon: "nefit_easy_icon.png", // saved in icons/myicon.png
label: function() { // sets the default label contents
return this.name||this.topic||"Nefit Easy";
},
paletteLabel: "nefit easy",
labelStyle: function() { // sets the class to apply to the label
return this.name?"node_label_italic":"";
}
});
</script>