node-red-contrib-knx-easy
Version:
Use knx in node-red, just like the mqtt nodes
120 lines (110 loc) • 4.4 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('knxEasy-out', {
category: 'output',
color: '#a6bbcf',
defaults: {
server: { type: "knxEasy-config", required: true },
topic: { value: "" },
dpt: { value: "" },
name: { value: "" },
outputtype: { value: "write" }
},
inputs: 1,
outputs: 0,
align: "right",
icon: "knx.png",
label: function () {
return this.name || this.topic || "knx-out"
},
oneditprepare: function () {
$.getJSON('knxEasyDpts', (data) => {
data.forEach(dpt => {
$("#node-input-dpt").append($("<option></option>")
.attr("value", dpt.value)
.text(dpt.text))
});
$("#node-input-dpt").val(this.dpt)
})
// Add Write as default for existing nodes
if (typeof this.outputtype === 'undefined') {
this.outputtype = "write"
$("#node-input-outputtype").val("write")
}
}
})
</script>
<script type="text/x-red" data-template-name="knxEasy-out">
<div class="form-row">
<label for="node-input-server"><i class="fa fa-tag"></i> Gateway </label>
<input type="text" id="node-input-server">
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Group Address </label>
<input type="text" id="node-input-topic" placeholder="Group Address (1/1/1)">
</div>
<div class="form-row">
<label for="node-input-dpt"><i class="fa fa-tasks"></i> Datapoint </label>
<select id="node-input-dpt"></select>
</div>
<div class="form-row">
<label for="node-input-outputtype"> Output Type </label>
<select id="node-input-outputtype">
<option value="write">Write</option>
<option value="response">Response</option>
</select>
</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>
</script>
<script type="text/x-red" data-help-name="knxEasy-out">
<p> Node for transmission of KNX write requests to the configured group address. </p>
<h3>Properties</h3>
<dl class="message-properties">
<dt>Gateway</dt>
<dd> Selected KNX gateway. </dd>
<dt>Group Address
<span class="property-type">x/y/z</span>
</dt>
<dd> KNX group address to write. </dd>
<dt>Datapoint</dt>
<dd> KNX datapoint type (DPT). </dd>
<dt>Output Type</dt>
<dd> Choose if this output should be a write or respond event </dd>
</dl>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload</dt>
<dd>Value to transmit</dd>
<dt>knx</dt>
<dd> <p>The following parameters can be sent to override what is configured for the node:
<pre>
{ "knx": {
"event": "GroupValue_Write",
"dpt":"1.001",
"destination": "1/1/1"
}
} </pre>
(DPTs can be sent as 9 , "9" , "9.001" or "DPT9.001")</p>
<p>Example:
If you only want to override destination you would send only that, eventType and dpt will be taken from node config:
<pre>
{ "knx": {
"destination": "1/1/1"
}
} </pre>
</p>
</dd>
</dl>
<h3>Details</h3>
<p>
Based on configured DPT the <code>msg.payload</code> is automatically converted into the KNX on-wire
representation before transmission.
</p>
<h4>Example for DPT 10.001 (TimeOfDay)</h4>
<p>
The <code>msg.payload</code> with a logical time value <code>"07:15:32"</code> will be transmitted as
KNX telegram of type <code>GroupValue_Write</code> with the 3 payload bytes <code>0x07 0x0F 0x20</code>.
</p>
</script>