Closed andy99288 closed 2 years ago
Same here, its not only unplugging. Its when in my case the raspberry loses the ethernet connection (due to restart of the router which I do on a nightly basis), HueJay creates a crash; Error: Huejay: connect ENETUNREACH 192.168.1.55:80 - Local (0.0.0.0:0)
Same here. Looks like every time there is any connection error it crashes nodered.
Aug 19 14:12:07 main Node-RED[31330]: HuejayError: Huejay: read ECONNRESET
Aug 19 14:12:07 main Node-RED[31330]: at /home/pi/.node-red/node_modules/huejay/lib/Transport.js:106:15
Aug 19 14:12:07 main Node-RED[31330]: at processTicksAndRejections (internal/process/task_queues.js:95:5) {
Aug 19 14:12:07 main Node-RED[31330]: type: undefined
Aug 19 14:12:07 main Node-RED[31330]: }
Aug 19 14:12:07 main Node-RED[31330]: HuejayError: Huejay: read ECONNRESET
Aug 19 14:12:07 main Node-RED[31330]: at /home/pi/.node-red/node_modules/huejay/lib/Transport.js:106:15
Aug 19 14:12:07 main Node-RED[31330]: at processTicksAndRejections (internal/process/task_queues.js:95:5) {
Aug 19 14:12:07 main Node-RED[31330]: type: undefined
Aug 19 14:12:07 main Node-RED[31330]: }
Aug 19 14:12:07 main Node-RED[31330]: 19 Aug 14:12:07 - [red] Uncaught Exception:
Aug 19 14:12:07 main Node-RED[31330]: 19 Aug 14:12:07 - abort(Error: Huejay: read ECONNRESET). Build with -s ASSERTIONS=1 for more info.
Aug 19 14:12:07 main systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE
Aug 19 14:11:33 main Node-RED[31001]: HuejayError: Huejay: connect ECONNREFUSED 192.168.178.115:80
Aug 19 14:11:33 main Node-RED[31001]: at /home/pi/.node-red/node_modules/huejay/lib/Transport.js:106:15
Aug 19 14:11:33 main Node-RED[31001]: at processTicksAndRejections (internal/process/task_queues.js:95:5) {
Aug 19 14:11:33 main Node-RED[31001]: type: undefined
Aug 19 14:11:33 main Node-RED[31001]: }
Aug 19 14:11:33 main Node-RED[31001]: HuejayError: Huejay: connect ECONNREFUSED 192.168.178.115:80
Aug 19 14:11:33 main Node-RED[31001]: at /home/pi/.node-red/node_modules/huejay/lib/Transport.js:106:15
Aug 19 14:11:33 main Node-RED[31001]: at processTicksAndRejections (internal/process/task_queues.js:95:5) {
Aug 19 14:11:33 main Node-RED[31001]: type: undefined
Aug 19 14:11:33 main Node-RED[31001]: }
Aug 19 14:11:33 main Node-RED[31001]: 19 Aug 14:11:33 - [red] Uncaught Exception:
Aug 19 14:11:33 main Node-RED[31001]: 19 Aug 14:11:33 - abort(Error: Huejay: connect ECONNREFUSED 192.168.178.115:80). Build with -s ASSERTIONS=1 for more info.
Aug 19 14:11:33 main systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE
So what I did as a hack to prevent this error is editing Transport.js in the Huejay module. Put a 'Return false;' at the latest catch to prevent the error being thrown. It works fine now. I might suggest a patch for Huemagic to have a try/catch in the Huejay call.
See hack in Transport.js below (I know its terrible).
return result;
})
.catch(error => {
// Prevent network failures to throw errors
return false;
if (error instanceof HuejayError) {
throw error;
}
throw new HuejayError({
message: error.message
});
});
}
}
module.exports = Transport;
Fixed with v4
For me the problem persists, on network loss, Node-red crashes, I have the following in the logs:
TypeError: Cannot read property 'length' of undefined at new HueBridgeMessage (/home/nodered/.node-red/node_modules/node-red-contrib-huemagic/huemagic/utils/messages.js:17:61) at HueBridge.get (/home/nodered/.node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:306:23) at /home/nodered/.node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge.js:84:30 at EventEmitter.<anonymous> (/home/nodered/.node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:556:7) at EventEmitter.emit (events.js:314:20) at HueBridge.pushUpdatedState (/home/nodered/.node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:275:16) at Timeout._onTimeout (/home/nodered/.node-red/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:177:13) at listOnTimeout (internal/timers.js:554:17) at processTimers (internal/timers.js:497:7)
Describe the bug When I unplug the power or the ethernet to my hue bridge, shortly thereafter node-red crashes, restarts, crashes, repeat. I've searched the issues section here, but couldn't find anything I recognized as relevant.
Flow to Reproduce I don't have any specific flows. As far as I know, my flows are great - things have been working really well. Recently I got the idea that I should place my 2 Hue Bridges on smart switches, in case I ever wanted to reboot them / cut their power I wouldn't have to pull out furniture. When playing with cutting their power, I noticed it completely took down node-red and put it in a restart loop until the hue bridge is available again. I've tried playing with the poll interval in the settings - placing it really high, but doesn't seem to make much of a difference. I have a lot of flows sending commands to the 2 hubs - they all seem to work well as long as the bridge is available.
Expected behavior If I lose a hub, either by me unplugging it or it dying, or even a network failure, I'm hoping to keep it from taking down all of node-red.
Screenshots None
Please complete the following information:
Additional context I don't really need to cut power to the hue bridges - they are pretty stable. But I'm concerned now that if one of them dies or loses network it will break node-red.