Hi, https://bitbucket.org/ekarak/node-red-contrib-knxjs offers three nodes knx-in, knx-out, and a knx-device node. After upgrading node-red to 1.0, the knx-in is not working anymore. Instead of outputting knx telegram messages it only outputs an empty messages.
Is anyone using these nodes and experiencing the same behaviour?
Franz
I tried to identify the differences between NR 1.0.1 and 0.20.8.
There seems to be an extra KNXControllerNode.Node.emit in 1.0.1
Debug output from knxnetip.js / noficationHandler when issuing a read request on group address 0/6/1
====================================================================================================
var notificationHandler = function(evt, src, dest, value) {
console.trace(' evt=%s', this, evt);
// this.log(util.format('%s %s %s', src, dest, value));
// emit the event ourselves
this.emit('event', evt, src, dest, value);
var payload = {
'srcphy': src,
'dstgad': dest
};
var knxevent = evt.match(/GroupValue_(.*)/);
if (knxevent) {
if (evt == "GroupValue_Write" || evt == "GroupValue_Response") {
payload.value = value;
}
this.log(util.format('%s %j', evt, payload));
// set a temporary node status
setNodeStatus(this, {
color: 'green',
shape: 'dot',
text: knxevent[1] + ' ' + dest + ':' + value
});
// and send a Node-Red message
this.send({
'topic': 'knx: ' + knxevent[1].toLowerCase(),
'payload': payload
});
}
};
=== Debug output (alternating blocks for node-red 1.0.1 and 0.20.8) ===
*** NODERED 1.0.1
Okt 08 08:39:25 intel-nuc Node-RED[20900]: Trace: evt=[object Object] GroupValue_Read
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at KNXControllerNode.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:35:13)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.<anonymous> (/home/franz/.node-red/node_modules/machina/lib/machina.js:113:17)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at arrayEach (/home/franz/.node-red/node_modules/lodash/lodash.js:516:11)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at Function.forEach (/home/franz/.node-red/node_modules/lodash/lodash.js:9342:14)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.emit (/home/franz/.node-red/node_modules/machina/lib/machina.js:111:8)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.emitEvent (/home/franz/.node-red/node_modules/knx/src/FSM.js:437:10)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm._onEnter (/home/franz/.node-red/node_modules/knx/src/FSM.js:398:12)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.transition (/home/franz/.node-red/node_modules/machina/lib/machina.js:653:28)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.Fsm.(anonymous function) [as transition] (/home/franz/.node-red/node_modules/machina/lib/machina.js:466:63)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.inbound_TUNNELING_REQUEST_L_Data.ind (/home/franz/.node-red/node_modules/knx/src/FSM.js:259:16)
*** NODERED 0.20.8
Okt 08 10:42:25 intel-nuc Node-RED[29715]: Trace: evt=[object Object] GroupValue_Read
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at KNXControllerNode.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:35:13)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.<anonymous> (/home/franz/.node-red/node_modules/machina/lib/machina.js:113:17)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at arrayEach (/home/franz/.node-red/node_modules/lodash/lodash.js:516:11)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at Function.forEach (/home/franz/.node-red/node_modules/lodash/lodash.js:9342:14)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.emit (/home/franz/.node-red/node_modules/machina/lib/machina.js:111:8)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.emitEvent (/home/franz/.node-red/node_modules/knx/src/FSM.js:437:10)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm._onEnter (/home/franz/.node-red/node_modules/knx/src/FSM.js:398:12)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.transition (/home/franz/.node-red/node_modules/machina/lib/machina.js:653:28)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.Fsm.(anonymous function) [as transition] (/home/franz/.node-red/node_modules/machina/lib/machina.js:466:63)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.inbound_TUNNELING_REQUEST_L_Data.ind (/home/franz/.node-red/node_modules/knx/src/FSM.js:259:16)
*** NODERED 1.0.1
Okt 08 08:39:25 intel-nuc Node-RED[20900]: Trace: evt=[object Object] GroupValue_Read
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at KNXIn.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:35:13)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at KNXControllerNode.emit (events.js:198:13)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at KNXControllerNode.Node.emit (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:185:14)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at KNXControllerNode.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:38:10)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.<anonymous> (/home/franz/.node-red/node_modules/machina/lib/machina.js:113:17)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at arrayEach (/home/franz/.node-red/node_modules/lodash/lodash.js:516:11)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at Function.forEach (/home/franz/.node-red/node_modules/lodash/lodash.js:9342:14)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.emit (/home/franz/.node-red/node_modules/machina/lib/machina.js:111:8)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.emitEvent (/home/franz/.node-red/node_modules/knx/src/FSM.js:437:10)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm._onEnter (/home/franz/.node-red/node_modules/knx/src/FSM.js:398:12)
*** NODERED 0.20.8
Okt 08 10:42:25 intel-nuc Node-RED[29715]: Trace: evt=[object Object] GroupValue_Read
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at KNXIn.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:35:13)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at KNXControllerNode.emit (events.js:198:13)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at KNXControllerNode.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:38:10)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.<anonymous> (/home/franz/.node-red/node_modules/machina/lib/machina.js:113:17)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at arrayEach (/home/franz/.node-red/node_modules/lodash/lodash.js:516:11)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at Function.forEach (/home/franz/.node-red/node_modules/lodash/lodash.js:9342:14)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.emit (/home/franz/.node-red/node_modules/machina/lib/machina.js:111:8)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.emitEvent (/home/franz/.node-red/node_modules/knx/src/FSM.js:437:10)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm._onEnter (/home/franz/.node-red/node_modules/knx/src/FSM.js:398:12)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.transition (/home/franz/.node-red/node_modules/machina/lib/machina.js:653:28)
*** NODERED 1.0.1
Okt 08 08:39:25 intel-nuc Node-RED[20900]: 8 Oct 08:39:25 - [info] [knx-in:7c47d498.d56f7c] GroupValue_Read {}
Okt 08 08:39:25 intel-nuc Node-RED[20900]: 8 Oct 08:39:25 - [info] [knx-controller:c53eaaa4.2dff18] GroupValue_Read {"srcphy":"1.15.15","dstgad":"0/6/1"}
*** NODERED 0.20.8
Okt 08 10:42:25 intel-nuc Node-RED[29715]: 8 Oct 10:42:25 - [info] [knx-in:7c47d498.d56f7c] GroupValue_Read {"srcphy":"1.15.15","dstgad":"0/6/1"}
Okt 08 10:42:25 intel-nuc Node-RED[29715]: 8 Oct 10:42:25 - [info] [knx-controller:c53eaaa4.2dff18] GroupValue_Read {"srcphy":"1.15.15","dstgad":"0/6/1"}
*** NODERED 1.0.1
Okt 08 08:39:25 intel-nuc Node-RED[20900]: Trace: evt=[object Object] GroupValue_Response
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at KNXControllerNode.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:35:13)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.<anonymous> (/home/franz/.node-red/node_modules/machina/lib/machina.js:113:17)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at arrayEach (/home/franz/.node-red/node_modules/lodash/lodash.js:516:11)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at Function.forEach (/home/franz/.node-red/node_modules/lodash/lodash.js:9342:14)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.emit (/home/franz/.node-red/node_modules/machina/lib/machina.js:111:8)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.emitEvent (/home/franz/.node-red/node_modules/knx/src/FSM.js:437:10)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm._onEnter (/home/franz/.node-red/node_modules/knx/src/FSM.js:398:12)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.transition (/home/franz/.node-red/node_modules/machina/lib/machina.js:653:28)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.Fsm.(anonymous function) [as transition] (/home/franz/.node-red/node_modules/machina/lib/machina.js:466:63)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.inbound_TUNNELING_REQUEST_L_Data.ind (/home/franz/.node-red/node_modules/knx/src/FSM.js:259:16)
*** NODERED 0.20.8
Okt 08 10:42:25 intel-nuc Node-RED[29715]: Trace: evt=[object Object] GroupValue_Response
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at KNXControllerNode.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:35:13)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.<anonymous> (/home/franz/.node-red/node_modules/machina/lib/machina.js:113:17)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at arrayEach (/home/franz/.node-red/node_modules/lodash/lodash.js:516:11)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at Function.forEach (/home/franz/.node-red/node_modules/lodash/lodash.js:9342:14)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.emit (/home/franz/.node-red/node_modules/machina/lib/machina.js:111:8)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.emitEvent (/home/franz/.node-red/node_modules/knx/src/FSM.js:437:10)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm._onEnter (/home/franz/.node-red/node_modules/knx/src/FSM.js:398:12)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.transition (/home/franz/.node-red/node_modules/machina/lib/machina.js:653:28)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.Fsm.(anonymous function) [as transition] (/home/franz/.node-red/node_modules/machina/lib/machina.js:466:63)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.inbound_TUNNELING_REQUEST_L_Data.ind (/home/franz/.node-red/node_modules/knx/src/FSM.js:259:16)
*** NODERED 1.0.1
Okt 08 08:39:25 intel-nuc Node-RED[20900]: Trace: evt=[object Object] GroupValue_Response
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at KNXIn.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:35:13)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at KNXControllerNode.emit (events.js:198:13)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at KNXControllerNode.Node.emit (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:185:14)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at KNXControllerNode.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:38:10)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.<anonymous> (/home/franz/.node-red/node_modules/machina/lib/machina.js:113:17)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at arrayEach (/home/franz/.node-red/node_modules/lodash/lodash.js:516:11)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at Function.forEach (/home/franz/.node-red/node_modules/lodash/lodash.js:9342:14)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.emit (/home/franz/.node-red/node_modules/machina/lib/machina.js:111:8)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm.emitEvent (/home/franz/.node-red/node_modules/knx/src/FSM.js:437:10)
Okt 08 08:39:25 intel-nuc Node-RED[20900]: at fsm._onEnter (/home/franz/.node-red/node_modules/knx/src/FSM.js:398:12)
*** NODERED 0.20.8
Okt 08 10:42:25 intel-nuc Node-RED[29715]: Trace: evt=[object Object] GroupValue_Response
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at KNXIn.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:35:13)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at KNXControllerNode.emit (events.js:198:13)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at KNXControllerNode.notificationHandler (/home/franz/.node-red/node_modules/node-red-contrib-knxjs/knxnetip/knxnetip.js:38:10)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.<anonymous> (/home/franz/.node-red/node_modules/machina/lib/machina.js:113:17)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at arrayEach (/home/franz/.node-red/node_modules/lodash/lodash.js:516:11)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at Function.forEach (/home/franz/.node-red/node_modules/lodash/lodash.js:9342:14)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.emit (/home/franz/.node-red/node_modules/machina/lib/machina.js:111:8)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.emitEvent (/home/franz/.node-red/node_modules/knx/src/FSM.js:437:10)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm._onEnter (/home/franz/.node-red/node_modules/knx/src/FSM.js:398:12)
Okt 08 10:42:25 intel-nuc Node-RED[29715]: at fsm.transition (/home/franz/.node-red/node_modules/machina/lib/machina.js:653:28)
*** NODERED 1.0.1
Okt 08 08:39:25 intel-nuc Node-RED[20900]: 8 Oct 08:39:25 - [info] [knx-in:7c47d498.d56f7c] GroupValue_Response {}
Okt 08 08:39:25 intel-nuc Node-RED[20900]: 8 Oct 08:39:25 - [info] [knx-controller:c53eaaa4.2dff18] GroupValue_Response {"srcphy":"1.1.1","dstgad":"0/6/1","value":{"type":"Buffer","data":[1
*** NODERED 0.20.8
Okt 08 10:42:25 intel-nuc Node-RED[29715]: 8 Oct 10:42:25 - [info] [knx-in:7c47d498.d56f7c] GroupValue_Response {"srcphy":"1.1.1","dstgad":"0/6/1","value":{"type":"Buffer","data":[1]}}
Okt 08 10:42:25 intel-nuc Node-RED[29715]: 8 Oct 10:42:25 - [info] [knx-controller:c53eaaa4.2dff18] GroupValue_Response {"srcphy":"1.1.1","dstgad":"0/6/1","value":{"type":"Buffer","data":[1]}}
It seems that the override of emit in the Node.js module (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:185:14
) of node-red doesn’t handle mutiple arguments in the emit call (like emit from EventEmitter does). In node-red 0.20.8, a Node instance calls the original emit function.
The notifcationHandler in knxnetip.js calls emit with the following signature this.emit('event', evt, src, dest, value); in the context of the KNXControllerNode and thus will only add the evt variable and neglect src, dest, and value.
node-red 1.0.1 emit overide in /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:185:14
:
/**
* An internal reference to the original EventEmitter.emit() function
*/
Node.prototype._emit = Node.prototype.emit;
/**
* Emit an event to all registered listeners.
*/
Node.prototype.emit = function(event,arg) {
var node = this;
if (event === "input") {
// When Pluggable Message Routing arrives, this will be called from
// that and will already be sync/async depending on the router.
if (this._asyncDelivery) {
setImmediate(function() {
node._emitInput(arg);
});
} else {
this._emitInput(arg);
}
} else {
this._emit(event,arg);
}
}
Is this the intended behaviour of events for the Nodes?
Could somebody from the devs weigh in here please.
Franz
Please raise an issue - unintended regression as none of our nodes reuse the emitter API with multiple arguments. We should fix that and release 1.0.2
Thanks for fixing the issue. Waiting for th 1.0.2 release.