node-red-contrib-myhome-bticino-v2
Version:
Control Bticino / Legrand MyHome components from Node-RED
114 lines (111 loc) • 9.85 kB
HTML
<script type="text/x-red" data-help-name="myhome-thermo-central">
<style>
#mh-tableinfo {width: 95%;font-size: small;}
#mh-tableinfo td, #mh-tableinfo th {border: 1px solid #ddd; padding: 2px; text-align: left;}
#mh-tableinfo tr:nth-child(even) {background-color: #f2f2f2;}
#mh-tableinfo th {background-color: #A6BBCF; color: white;}
</style>
<p>Adds a MyHome Thermo Central Unit Node to monitor & apply changes using the 1-99 zones central unit</p>
<ul>
<li><strong>Name</strong> (mandatory) is the name of the node</li>
<li><strong>Topic</strong> is used on received payload to trigger the action on the node (see info in inputs definition)</li>
<li><strong>Gateway</strong> is the gateway to be configured in order to connect to MyHome system</li>
<li><strong>Ask for Central state refresh on connect</strong> : when enabled, current Central status is gathered when node is loaded (i.e. on deploy or when Node-RED server starts). Data collection will trigger flows accordingly, which can be used to (re)set depending values in your flow on load.
<li><strong>Only ask for current load status</strong> : when enabled, the received payload (being 'MANUAL:20.5', '21.5', 'OFF', or whatever) is ignored and a status request is sent to gather current central unit state without applying any change.</li>
<li><strong>Skip ALL incoming gateway events</strong> : when enabled, all MyHome status updates received from the gateway about this node will be ignored, which means only Node-RED received payloads will be processed.</li>
<li><strong>Filter incoming gateway events</strong> : when enabled, the node only triggers a new flow (aka output) when a state CHANGED after a MyHome BUS message was received. This is made to avoid multiple flows starting for the same info/command, because MyHome sends the same message multiple times (for status request, response,...)
<br>Note: SmartFilter is only applied for events received from the BUS (not the node-RED flows)
</li>
</ul>
<h3>Inputs</h3>
<p><code>msg.payload</code> can be of 2 types</p>
<ul>
<li>A simple value <em>[string]</em> being a valid central unit command</li>
<li>An Object where <code>payload.state</code> contains a valid central unit command</li>
</ul>
<br>
<p>A valid <strong>central unit command</strong> is :</p>
<table id="mh-tableinfo">
<tr> <th>Valid command (.state)</th> <th>.operationMode</th> <th>_ownValue</th> <th>Information</th>
<tr> <td>ANTIFREEZE</td> <td>Antifreeze</td> <td>102</td> <td>(1)</td>
<tr> <td>OFF_HEATING</td> <td>Off Heating</td> <td>103</td> <td>(1)</td>
<tr> <td>MANUAL_HEATING:xxxx</td> <td>Manual Heating</td> <td>110</td> <td>(1) xxxx : temperature in <strong>4 characters</strong> format : '06.5', '16.0',...</td>
<tr> <td>PROGRAM_HEATING:x</td> <td>Auto Heating Program</td> <td>110x</td> <td>(1) x : program number [1-3]</td>
<tr> <td>SCENARIO_HEATING:xx</td> <td>Auto Heating Scenario</td> <td>12xx</td> <td>(1) xx : scenario number [01-16]</td>
<tr> <td>THERMAL_PROTECT</td> <td>Thermal Protection</td> <td>202</td> <td>(2)</td>
<tr> <td>OFF_CONDITIONING</td> <td>Off Conditioning</td> <td>203</td> <td>(2)</td>
<tr> <td>MANUAL_CONDITIONING:xxxx</td> <td>Manual Conditioning</td> <td>210</td> <td>(2) xxxx : temperature in <strong>4 characters</strong> format : '06.5', '16.0',...</td>
<tr> <td>PROGRAM_CONDITIONING:x</td> <td>Auto Conditioning Program</td> <td>210x</td> <td>(2) x : program number [1-3]</td>
<tr> <td>SCENARIO_CONDITIONING:xx</td> <td>Auto Conditioning Scenario</td> <td>22xx</td> <td>(2) xx : scenario number [01-16]</td>
<tr> <td>OFF</td> <td>Off Generic</td> <td>303</td> <td></td>
<tr> <td>MANUAL:xxxx</td> <td>Manual Generic</td> <td>310</td> <td>xxxx : temperature in <strong>4 characters</strong> format : '06.5', '16.0',...</td>
<tr> <td>PROGRAM:x</td> <td>Auto Generic Program</td> <td>310x</td> <td>x : program number [1-3]</td>
<tr> <td>SCENARIO:xx</td> <td>Auto Generic Scenario</td> <td>32xx</td> <td>xx : scenario number [01-16]</td>
</table>
<span><i> (1) only valid when in heating mode</i></span>
<span><i> (2) only valid when in conditioning mode</i></span>
<p><code>msg.topic</code> is required on the received <code>msg</code> to trigger the node action: </p>
<ul>
<li>
in <strong>Write mode</strong> : <code>msg.topic</code> must be set to <code>cmd/xxxx</code> where xxxx is the value defined as Topic in node configuration.
<br>
Note : if the node is configured as being read-only, the content of the msg.payload is ignored and a refresh status will be processed.
</li>
<li>
in <strong>Read-only mode</strong> : <code>msg.topic</code> must be set to <code>state/xxxx</code> where xxxx is the value defined as Topic in node configuration.</li>
<br>
Note : even if the node is NOT configured as being read-only, the content of the msg.payload is ignored and a refresh status will be processed.
</ul>
<h3>Outputs</h3>
<p>The <strong>primary output</strong> is a JSON object <code>msg.payload</code> with</p>
<ul>
<li> <code>payload.state</code> <em>[string]</em> value is the same as a valid central unit command (see above 'inputs' table)</li>
<li> <code>payload.remoteControl</code> <em>[boolean]</em> indicates whether central unit has remote control enabled or not. When disabled, all sent commands will be refused.</li>
<li> <code>payload.operationMode</code> <em>[string]</em> the current operation mode set (see above 'inputs' table)</li>
<li> <code>payload.operationMode_ownValue </code> <em>[string]</em> (technical reference : the OpenWebNet value for the operation mode)</li>
<li> <code>payload.operationMode_setTemperature </code> <em>[string]</em> <i>(only when in manual mode)</i> the current temperature defined as set-point </li>
<li> <code>payload.operationMode_curProgram </code> <em>[string]</em> <i>(only when a weekly program is enabled)</i> the current weekly program set [1-3]</li>
<li> <code>payload.operationMode_curScenario</code> <em>[string]</em> <i>(only when a scenario is enabled)</i> the current scenario set [01-16]</li>
<li> <code>payload.command_sent</code> <em>[array of string]</em> when the node was triggered from Node-RED (i.e. commands were sent to the MyHome gateway), contains the commands which were sent in OpenWebNet protocol (e.g. <em>'*4*3102*#0##'</em> to switch central unit to weekly program #2 (generic mode))</li>
<li> <code>payload.command_received</code> <em>[string]</em> when the node was triggered from the gateway (i.e. a command was detected on the MyHome BUS for the configured load), contains the command which was read in OpenWebNet protocol (ex: <em>'*4*303*#0##'</em> means central unit was switched Off)</li>
<li> <code>payload.command_responses</code> <em>[array of strings]</em> when the node was triggered from Node-RED in read-only mode, will contain the returned response(s) from the MyHome BUS in OpenWebNet protocol</li>
<li> <code>payload.command_failed</code> <em>[array of strings]</em> will contain the commands which were refused by the MyHome gateway, in OpenWebNet protocol</li>
</ul>
<p>The <strong>secondary output</strong> can be configured to better suits the needs of other node types you use without having to use an extra function/switch node for each connector
<br>
<u>Samples:</u>
</p>
<ul>
<li><strong>HUEMagic</strong> nodes support :
<ul>
<li><code>payload</code> being a boolean (true/false)</li>
<li><code>payload</code> being a JSON object where <code>.ON</code> is a boolean (true/false)</li>
</ul>
</li>
<li><strong>Homekit-bridge</strong> nodes support :
<ul>
<li><code>payload</code> being a JSON object where <code>.On</code> is a boolean (true/false)</li>
</ul>
<p>(see: <a title="homekit bridged" href="https://www.npmjs.com/package/node-red-contrib-homekit-bridged" target="_blank" rel="noopener">https://www.npmjs.com/package/node-red-contrib-homekit-bridged</a>) allow managing iOS Home App.</p>
</li>
<li><strong>MyHome</strong> nodes support :
<ul>
<li><code>payload</code> being either a boolean (true/false) or a string (ON/OFF/OPEN/CLOSE/...)</li>
<li><code>payload</code> being a JSON object where <code>.state</code> is a string (ON/OFF/OPEN/CLOSE/...)</li>
<li><code>payload</code> being a JSON object where <code>.On</code> is a boolean (true/false)</li>
</ul>
</li>
</ul>
<p>
<strong>Both outputs</strong> also include an additional object <code>msg.mh_nodeConfigInfo</code> which includes data from node configuration.
This can be used in flows to redirect messages based on how (i.e. which node) they come from without having to include 'change nodes' at every stage.
</p>
<p>
The <code>msg.mh_nodeConfigInfo</code> contains node configuration values :
</p>
<ul>
<li> <code>mh_nodeConfigInfo.name</code> <em>[string]</em> : name</li>
<li> <code>mh_nodeConfigInfo.topic</code> <em>[string]</em> : topic</li>
<li> <code>mh_nodeConfigInfo.gateway</code> <em>[object]</em> : linked gateway info : name (<code>.name</code>), Host/IP (<code>.host</code>) and port (<code>.port</code>)</li>
</ul>
</script>