node-red-contrib-samsung-tv-control
node-red-contrib-samsung-tv-control copied to clipboard
Node red crashes when I try to get list of apps from a TV that is switched off (Uncaught Exception)
From node red
Aug 2 11:56:38 hs14 Node-RED[25183]: TV is off or unavailable Aug 2 11:56:38 hs14 Node-RED[25183]: 2 Aug 11:56:38 - [warn] [samsung-tv-getapps:Get Apps] Error: connect EHOSTUNREACH 192.168.0.122:8002 Aug 2 11:56:38 hs14 Node-RED[25183]: 2 Aug 11:56:38 - [red] Uncaught Exception: Aug 2 11:56:38 hs14 Node-RED[25183]: 2 Aug 11:56:38 - TypeError: Cannot read property 'data' of null Aug 2 11:56:38 hs14 Node-RED[25183]: at /home/pi/.node-red/node_modules/node-red-contrib-samsung-tv-control/lib/samsung.js:166:26 Aug 2 11:56:38 hs14 Node-RED[25183]: at WebSocket.ws.on (/home/pi/.node-red/node_modules/samsung-tv-control/lib/samsung.js:289:17) Aug 2 11:56:38 hs14 Node-RED[25183]: at WebSocket.emit (events.js:198:13) Aug 2 11:56:38 hs14 Node-RED[25183]: at ClientRequest.req.on (/home/pi/.node-red/node_modules/samsung-tv-control/node_modules/ws/lib/websocket.js:688:15) Aug 2 11:56:38 hs14 Node-RED[25183]: at ClientRequest.emit (events.js:198:13) Aug 2 11:56:38 hs14 Node-RED[25183]: at TLSSocket.socketErrorListener (_http_client.js:392:9) Aug 2 11:56:38 hs14 Node-RED[25183]: at TLSSocket.emit (events.js:198:13) Aug 2 11:56:38 hs14 Node-RED[25183]: at emitErrorNT (internal/streams/destroy.js:91:8) Aug 2 11:56:38 hs14 Node-RED[25183]: at emitErrorAndCloseNT (internal/streams/destroy.js:59:3) Aug 2 11:56:38 hs14 Node-RED[25183]: at process._tickCallback (internal/process/next_tick.js:63:19) Aug 2 11:56:38 hs14 systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE Aug 2 11:56:38 hs14 systemd[1]: nodered.service: Failed with result 'exit-code'.
TV is off or unavailable HOST UNREACH
looks like TV is off or incorrect IP
The IP is correct but the TV is switched off. I realise that trying to get a list of the TVs apps is pointless if the TV is switched off, but I think maybe the code should just report an error rather that crash node red.
Same here. Since the isAlive node sometimes comes back with "on", while TV is turned off, I tried to use the getApps node to verify the on state. And because it is not turned on, the action fails and crashes node-red with an uncaught exception.