node-red-contrib-loxone
node-red-contrib-loxone copied to clipboard
Crash in plugin: Undefined variable
``As reported by someone (not me), on the Belgian Loxone users Facebook group, who has a crashing plugin:
25 May 13:34:26 - [red] Uncaught Exception:
25 May 13:34:26 - ReferenceError: data is not defined
at API.<anonymous> (/data/node_modules/node-red-contrib-loxone/loxone/loxone.js:262:21)
at API.emit (events.js:198:13)
at Connection.<anonymous> (/data/node_modules/node-lox-ws-api/lib/API.js:119:14)
at Connection.emit (events.js:198:13)
at Connection.handle_message (/data/node_modules/node-lox-ws-api/lib/Connection.js:174:18)
at WebSocketConnection.<anonymous> (/data/node_modules/node-lox-ws-api/lib/Connection.js:140:14)
at WebSocketConnection.emit (events.js:198:13)
at WebSocketConnection.processFrame (/data/node_modules/websocket/lib/WebSocketConnection.js:554:26)
at /data/node_modules/websocket/lib/WebSocketConnection.js:323:40
at process._tickCallback (internal/process/next_tick.js:61:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
And indeed, I see on receiving a message_text event, which is of type json or text(=default case), there is no data variable defined currently:
https://github.com/codmpm/node-red-contrib-loxone/blob/master/loxone/loxone.js#L213
and
https://github.com/codmpm/node-red-contrib-loxone/blob/master/loxone/loxone.js#L262
which was before: https://github.com/codmpm/node-red-contrib-loxone/blob/3acab1a4fe36b451d63dd1b66ac590577e80f64a/loxone/loxone.js#L126
This data structure should be re-introduced in the handling of a message_text (or at least handled differently):
var data = { type: message.type };
Thanks!
@codmdu could have a look into this?
I am the original submitter in that facebook group. Was unsure if I did something wrong, or if there was a technical issue. Appreciate the work on this plugin and am happy to test out potential solutions in my Loxone system here.
Hey @tbernaerd, could you test this with 0.10.12? Thanks!