You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I update one of my binary sensors in home assistant, Node Red crashes with this error (for example when I open a door):
5 Dec 22:03:26 - [red] Uncaught Exception:
5 Dec 22:03:26 - TypeError: Cannot read property 'split' of null
at ServerStateChangedNode.getCastValue (/opt/node_modules/node-red-contrib-home-assistant-websocket/lib/base-node.js:299:30)
at ServerStateChangedNode.getComparatorResult (/opt/node_modules/node-red-contrib-home-assistant-websocket/lib/base-node.js:386:27)
at ServerStateChangedNode.onHaEventsStateChanged (/opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/events-state-changed/events-state-changed.js:90:36)
at HaWebsocket.emit (events.js:327:22)
at HaWebsocket.onClientEvents (/opt/node_modules/node-red-contrib-home-assistant-websocket/lib/ha-websocket.js:294:26)
at Object.callback (/opt/node_modules/node-red-contrib-home-assistant-websocket/lib/ha-websocket.js:229:31)
at Connection._handleMessage (/opt/node_modules/home-assistant-js-websocket/dist/haws.cjs:353:26)
at WebSocket. (/opt/node_modules/home-assistant-js-websocket/dist/haws.cjs:191:57)
at WebSocket.onMessage (/opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (/opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/websocket.js:797:20)
at Receiver.emit (events.js:315:20)
at Receiver.dataMessage (/opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/receiver.js:437:14)
at /opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/receiver.js:394:23
at /opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/permessage-deflate.js:306:9
at /opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/permessage-deflate.js:385:7
at afterWrite (_stream_writable.js:490:5)
at onwrite (_stream_writable.js:470:7)
at InflateRaw.afterTransform (_stream_transform.js:98:3)
at Zlib.processCallback (zlib.js:578:8)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
To Reproduce
Create an home assistant event node, set it to 'if state: in' and add some items to filter for.
Now remove the items clicking on 'x' to remove the contents for if state. It will look like this:
Now every time an event comes in for this sensor, the node red install will crash.
Expected behavior
I dont expect node red to crash based on an event from home assistant.
Environment (please complete the following information):
Node-RED version: v1.2.5
Node.js version: v12.18.4
Linux 5.4.72 x64 LE
node-red-contrib-home-assistant-websocket: 0.27.5
Is Node Red running in Docker:HA addon
Add-on: Node-RED
Flow-based programming for the Internet of Things
Add-on version: 7.2.11
You are running the latest version of this add-on.
System: HassOS 4.15 (amd64 / qemux86-64)
Home Assistant Core: 0.118.5
Home Assistant Supervisor: 2020.12.6
Other (please complete the following information):
I've searched for duplicate issues.
Ive looked up this line in the code, and it seems that its assuming the payload to be not null when its of type 'list' in the 'cast type' method.
The text was updated successfully, but these errors were encountered:
ernout
changed the title
TypeError: Cannot read property 'split' of null
Event from home assistant crashing node red with TypeError: Cannot read property 'split' of null
Dec 5, 2020
Ah i've figured it out. Looking through the code a bit more, I saw that its using the split call when the events node is configured with 'if state is in'.
I've adjusted this in my flows, and now the problem is gone.
I've updated my issue above to show when this happens. Maybe a small tweak can be made to check for null here.
When I update one of my binary sensors in home assistant, Node Red crashes with this error (for example when I open a door):
5 Dec 22:03:26 - [red] Uncaught Exception:
5 Dec 22:03:26 - TypeError: Cannot read property 'split' of null
at ServerStateChangedNode.getCastValue (/opt/node_modules/node-red-contrib-home-assistant-websocket/lib/base-node.js:299:30)
at ServerStateChangedNode.getComparatorResult (/opt/node_modules/node-red-contrib-home-assistant-websocket/lib/base-node.js:386:27)
at ServerStateChangedNode.onHaEventsStateChanged (/opt/node_modules/node-red-contrib-home-assistant-websocket/nodes/events-state-changed/events-state-changed.js:90:36)
at HaWebsocket.emit (events.js:327:22)
at HaWebsocket.onClientEvents (/opt/node_modules/node-red-contrib-home-assistant-websocket/lib/ha-websocket.js:294:26)
at Object.callback (/opt/node_modules/node-red-contrib-home-assistant-websocket/lib/ha-websocket.js:229:31)
at Connection._handleMessage (/opt/node_modules/home-assistant-js-websocket/dist/haws.cjs:353:26)
at WebSocket. (/opt/node_modules/home-assistant-js-websocket/dist/haws.cjs:191:57)
at WebSocket.onMessage (/opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (/opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/websocket.js:797:20)
at Receiver.emit (events.js:315:20)
at Receiver.dataMessage (/opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/receiver.js:437:14)
at /opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/receiver.js:394:23
at /opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/permessage-deflate.js:306:9
at /opt/node_modules/node-red-contrib-home-assistant-websocket/node_modules/ws/lib/permessage-deflate.js:385:7
at afterWrite (_stream_writable.js:490:5)
at onwrite (_stream_writable.js:470:7)
at InflateRaw.afterTransform (_stream_transform.js:98:3)
at Zlib.processCallback (zlib.js:578:8)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
To Reproduce
Create an home assistant event node, set it to 'if state: in' and add some items to filter for.
Now remove the items clicking on 'x' to remove the contents for if state. It will look like this:
Now every time an event comes in for this sensor, the node red install will crash.
Expected behavior
I dont expect node red to crash based on an event from home assistant.
Environment (please complete the following information):
Node-RED version: v1.2.5
Node.js version: v12.18.4
Linux 5.4.72 x64 LE
node-red-contrib-home-assistant-websocket: 0.27.5
Is Node Red running in Docker:HA addon
Add-on: Node-RED
Flow-based programming for the Internet of Things
Add-on version: 7.2.11
You are running the latest version of this add-on.
System: HassOS 4.15 (amd64 / qemux86-64)
Home Assistant Core: 0.118.5
Home Assistant Supervisor: 2020.12.6
Other (please complete the following information):
I've searched for duplicate issues.
Ive looked up this line in the code, and it seems that its assuming the payload to be not null when its of type 'list' in the 'cast type' method.
The text was updated successfully, but these errors were encountered: