UNPKG

node-red-contrib-knx-ultimate

Version:

Control your KNX intallation via Node-Red! A bunch of KNX nodes, with integrated Philips HUE control and ETS group address importer. Easy to use and highly configurable.

188 lines (149 loc) 7.08 kB
<script type="text/javascript" src="resources/node-red-contrib-knx-ultimate/htmlUtils.js"></script> <script type="text/javascript"> RED.nodes.registerType('knxUltimateAutoResponder', { category: "KNX Ultimate", color: '#C7E9C0', defaults: { //buttonState: {value: true}, server: { type: "knxUltimate-config", required: true }, name: { value: "Auto responder", required: false }, commandText: { value: `[{"ga":"2/7/1","default":true},{"note":"Virtual sensors coming from Hikvision AX-Pro","ga":"3/1/1..22","dpt":"1.001","default":false},{"note":"DALI garden virtual brightness %","ga":"2/2/5..21","dpt":"5.001","default":25},{"note":"Alarm armed status text","ga":"2/4/22","dpt":"16.001","default":"Unknown status!"}]`, required: false } }, inputs: 0, outputs: 0, icon: "node-knx-icon.svg", label: function () { return (this.name || "KNX Auto Responder"); }, paletteLabel: "KNX Auto Responder", // button: { // enabled: function() { // // return whether or not the button is enabled, based on the current // // configuration of the node // return !this.changed // }, // visible: function() { // // return whether or not the button is visible, based on the current // // configuration of the node // return this.hasButton // }, // //toggle: "buttonState", // onclick: function() {} // }, oneditprepare: function () { // Go to the help panel try { RED.sidebar.show("help"); } catch (error) { } $("#node-input-commandText").typedInput({ type: "json", types: ["json"] }) }, oneditsave: function () { // Return to the info tab try { RED.sidebar.show("info"); } catch (error) { } }, oneditcancel: function () { // Return to the info tab try { RED.sidebar.show("info"); } catch (error) { } } }) </script> <script type="text/html" data-template-name="knxUltimateAutoResponder"> <div class="form-row"> <b>Auto Responder</b>&nbsp&nbsp<span style="color:red" &nbsp &nbsp<i class="fa fa-youtube"></i></span>&nbsp<a target="_blank" href=""><u>Youtube sample coming soon...</u></a> <br /> <br /> <label for="node-input-server"> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAKnRFWHRDcmVhdGlvbiBUaW1lAEZyIDYgQXVnIDIwMTAgMjE6NTI6MTkgKzAxMDD84aS8AAAAB3RJTUUH3gYYCicNV+4WIQAAAAlwSFlzAAALEgAACxIB0t1+/AAAAARnQU1BAACxjwv8YQUAAACUSURBVHjaY2CgFZg5c+Z/ZEyWAZ8+f/6/ZsWs/xoamqMGkGrA6Wla/1+fVARjEBuGsSoGmY4eZSCNL59d/g8DIDbIAHR14OgFGQByKjIGKX5+6/T///8gGMQGiV1+/B0Fg70GIkD+RMYgxf/O5/7//2MSmAZhkBi6OrgB6Bg5DGB4ajr3f2xqsYYLSDE2THJUDg0AAAqyDVd4tp4YAAAAAElFTkSuQmCC"></img> Gateway </label> <input type="text" id="node-input-server" /> </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" data-i18n="[placeholder]knxUltimateAutoResponder.node-input-name" /> </div> <div class="form-row"> <label for="node-input-commandText"><i class="fa fa-tasks"></i> Respond to</label> <input type="text" id="node-input-commandText"> </div> </script> <script type="text/markdown" data-help-name="knxUltimateAutoResponder"> <p>This node will respond to read requests from the KNX BUS. The node records all telegrams transmitted to the KNX BUS and store the values in memory. It then responds to read requests by sending such memorized value back to the BUS as request. If the group address to be read has no value yet, the node will respond with a default value. The node will respond only to group addresses specified in the **Respond to** JSON field. By default, there is a pre-compiled **sample** "Respond to" JSON text, where you can simply change/delete things. Please make sure **not to use it as is**!!! **Configuration** |Property|Description| |--|--| | Gateway | Select the KNX gateway to be used | | Respond to | The node will respond to read requests coming from the group addresses specified in this JSON array. The format is specified below. | <br/> **JSON format** The JSON is **always** an array of object, containing each one directive. Each directive, tells to the node what do do. |Property|Description| |--|--| | note | **Optional** note key, for reminders. It will not be used anywhere. | | ga | The group address. You can also use the ".." wildchars, to specity a range of group addresses. The ".." can only be used with the third ga's level, ex: **1/1/0..257**. See the samples below. | | dpt | The group address data point, in the format "1.001". It's **optional** if the ETS CSV file has been imported. | | default | The value sent to the BUS in response to a read request, when the group address value has not yet been memorized by the node. | **Let's start with one directive** The AutoResponder node will respond to read requests for the group address 2/7/1. If no value is yet in memory, it will reply with *true*. The ETS CSV file must have been imported, otherwise you must add the **"dpt":"1.001"** key as well. ```json [ { "ga": "2/7/1", "default": true } ] ``` **A bit more complete directive** The AutoResponder node will respond to read requests for the group address starting from 3/1/1, to 3/1/22 included. If no value is yet in memory, it will reply with *false*. There is also a **note** key, merely as a reminder note. It will not be used anywhere. ```json [ { "note": "Virtual sensors coming from Hikvision AX-Pro", "ga": "3/1/1..22", "dpt": "1.001", "default": false } ] ``` **Concatenating directives** The AutoResponder node will respond to read requests for the group address starting from 2/2/5, to 2/2/21 included. If no value is yet in memory, it will reply with a value of 25. The AutoResponder node will also respond to read requests for the group address 2/4/22. If no value is yet in memory, it will reply with the string *Unknown status!*. Please note the **comma** between each directive's JSON object. ```json [ { "note": "DALI garden virtual brightness %", "ga": "2/2/5..21" "default": 25 }, { "note": "Alarm armed status text", "ga": "2/4/22", "dpt": "16.001", "default": "Unknown status!" } ] ``` <br/> [![Donate via PayPal](https://raw.githubusercontent.com/Supergiovane/node-red-contrib-knx-ultimate/master/img/CodiceQR.png)](https://www.paypal.com/donate/?hosted_button_id=S8SKPUBSPK758) </script>