node-red-contrib-knx-ultimate 3.0.7 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/nodes/knxUltimateAutoResponder.js +16 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
# CHANGELOG
|
|
8
8
|
|
|
9
|
+
**Version 3.0.9** - August 2024<br/>
|
|
10
|
+
- Warning: Node-Red version **equals or major than 3.1.1** is needed to run this node.<br/>
|
|
11
|
+
- KNX Auto Responder node (BETA): fixed issue with malformed responses. Please be aware that until the node exits beta, there can be breaking changes.<br/>
|
|
12
|
+
|
|
9
13
|
**Version 3.0.7** - August 2024<br/>
|
|
10
14
|
- Warning: Node-Red version **equals or major than 3.1.1** is needed to run this node.<br/>
|
|
11
15
|
- KNX Auto Responder node (BETA): at start, it loads the last states saved in a persistent file. Please be aware that until the node exits beta, there can be breaking changes.<br/>
|
|
@@ -99,7 +99,7 @@ module.exports = function (RED) {
|
|
|
99
99
|
node.server.csv.forEach(element => {
|
|
100
100
|
const curGa = node.exposedGAs.find(a => a.address === element.ga);
|
|
101
101
|
if (curGa === undefined) {
|
|
102
|
-
node.exposedGAs.push({ address: element.ga, dpt: element.dpt, default: undefined, payload: undefined });
|
|
102
|
+
node.exposedGAs.push({ address: element.ga, dpt: element.dpt, default: undefined, payload: undefined, enabled: false }); // "enabled" will be used to filter only the node.commandText directiver
|
|
103
103
|
}
|
|
104
104
|
})
|
|
105
105
|
node.status({ fill: 'green', shape: 'ring', text: 'ETS file loaded', payload: '', dpt: '', devicename: '' });
|
|
@@ -128,19 +128,24 @@ module.exports = function (RED) {
|
|
|
128
128
|
// Add also to the exposedGAs list, if not already present
|
|
129
129
|
let curGa = node.exposedGAs.find(a => a.address === decAdd);
|
|
130
130
|
if (curGa === undefined) {
|
|
131
|
-
node.exposedGAs.push({ address: decAdd, dpt: dpt, default: defaultVal, payload: undefined });
|
|
131
|
+
node.exposedGAs.push({ address: decAdd, dpt: dpt, default: defaultVal, payload: undefined, enabled: true });
|
|
132
132
|
} else {
|
|
133
133
|
if (dpt !== undefined) curGa.dpt = dpt; // Take the Datapoint from the commandText directive, replacing from ETS CSV file, if exists.
|
|
134
|
+
curGa.enabled = true;
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
} else {
|
|
137
138
|
let curGa = node.exposedGAs.find(a => a.address === element.ga);
|
|
138
139
|
if (curGa === undefined) {
|
|
139
|
-
node.exposedGAs.push({ address: element.ga, dpt: dpt, default: defaultVal, payload: undefined });
|
|
140
|
+
node.exposedGAs.push({ address: element.ga, dpt: dpt, default: defaultVal, payload: undefined, enabled: true });
|
|
140
141
|
} else {
|
|
141
142
|
if (dpt !== undefined) curGa.dpt = dpt; // Take the Datapoint from the commandText directive, replacing from ETS CSV file, if exists.
|
|
143
|
+
curGa.enabled = true;
|
|
142
144
|
}
|
|
143
145
|
}
|
|
146
|
+
// Delete all not wanted GAs, that aren't in the node.commandText directive list.
|
|
147
|
+
node.exposedGAs = node.exposedGAs.filter(a => a.enabled === true || a.enabled === undefined);
|
|
148
|
+
|
|
144
149
|
node.status({ fill: 'green', shape: 'ring', text: 'JSON parsed: ' + node.commandText.length + " directive(s).", payload: '', dpt: '', devicename: '' });
|
|
145
150
|
} else {
|
|
146
151
|
// Error
|
|
@@ -162,10 +167,11 @@ module.exports = function (RED) {
|
|
|
162
167
|
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(`knxUltimateAutoResponder: var oGa = node.exposedGAs.find(ga => ga.address === msg.knx.destination) ${error.stack}`);
|
|
163
168
|
}
|
|
164
169
|
if (oGa !== undefined) {
|
|
170
|
+
let decodedPayload;
|
|
165
171
|
try {
|
|
166
172
|
// Don't care about the decoded payload, because knxUltimate-config could pass a TryToFindDatapoint from raw data
|
|
167
173
|
// Take only RAW data and decode it with the dpt specified by the commandText directive
|
|
168
|
-
|
|
174
|
+
decodedPayload = dptlib.fromBuffer(msg.knx.rawValue, dptlib.resolve(oGa.dpt));
|
|
169
175
|
} catch (error) {
|
|
170
176
|
node.status({ fill: 'red', shape: 'dot', text: 'const decodedPayload = dptlib.fromBuffer(msg.knx.rawValue, dptlib.resolve(oGa.dpt)); ' + error.message, payload: '', dpt: '', devicename: '' });
|
|
171
177
|
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(`knxUltimateAutoResponder: const decodedPayload = dptlib.fromBuffer(msg.knx.rawValue, dptlib.resolve(oGa.dpt)); ${error.stack}`);
|
|
@@ -185,8 +191,12 @@ module.exports = function (RED) {
|
|
|
185
191
|
}
|
|
186
192
|
if (retVal !== undefined) {
|
|
187
193
|
const dDate = new Date()
|
|
188
|
-
|
|
189
|
-
|
|
194
|
+
if (oFoundGA.address !== undefined && oFoundGA.dpt !== undefined && retVal !== undefined) {
|
|
195
|
+
node.server.writeQueueAdd({ grpaddr: oFoundGA.address, payload: retVal, dpt: oFoundGA.dpt, outputtype: 'response', nodecallerid: node.id });
|
|
196
|
+
node.status({ fill: 'blue', shape: 'dot', text: 'Respond ' + oFoundGA.address + ' => ' + retVal + ' (' + dDate.getDate() + ', ' + dDate.toLocaleTimeString() + ')' })
|
|
197
|
+
} else {
|
|
198
|
+
node.status({ fill: 'yellow', shape: 'ring', text: 'Issue responding ' + oFoundGA.address + ' => ' + retVal + ' (' + dDate.getDate() + ', ' + dDate.toLocaleTimeString() + ')' })
|
|
199
|
+
}
|
|
190
200
|
}
|
|
191
201
|
} catch (error) {
|
|
192
202
|
if (node.sysLogger !== undefined && node.sysLogger !== null) node.sysLogger.error(`knxUltimateAutoResponder: after bFound ${error.stack}`);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"engines": {
|
|
4
4
|
"node": ">=16.0.0"
|
|
5
5
|
},
|
|
6
|
-
"version": "3.0.
|
|
6
|
+
"version": "3.0.9",
|
|
7
7
|
"description": "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.",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"binary-parser": "2.2.1",
|