NorthernMan54 / node-red-contrib-homebridge-automation

Homebridge and Node-RED Integration
Apache License 2.0
107 stars 18 forks source link

Bug if device is removed #47

Open dxdc opened 4 years ago

dxdc commented 4 years ago

I had a flow set up with a device, and then later, removed this device from my homebridge configuration (had to purge it out of cachedAccessories). Node-RED then crashed (repeatedly) with this error:

May 18 10:19:19 raspberrypi Node-RED[16290]: 18 May 10:19:19 - TypeError: node.error is not a function
May 18 10:19:19 raspberrypi Node-RED[16290]:     at hbConf.<anonymous> (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/HAP-NodeRed.js:874:16)

Simply commenting out line 874 worked and allowed me to fix the problem in my flow, but not sure what caused the exception, maybe node was null in this case?

// node.error(device.host + ":" + device.port + " -> " + err);

Also, note that before this error, I saw these lines:

May 18 10:19:19 raspberrypi Node-RED[16290]: 18 May 10:19:19 - [error] [hb-status:Master Bedroom] 437:Can't find device HomebridgeXX:XX:XX....Belkin WeMoMaster Bedroom00000049
May 18 10:19:19 raspberrypi Node-RED[16290]: 2020-05-18T15:19:19.918Z hapNodeJSClient Homebridge auth failed, invalid PIN XXXXXXXXXXXX {"characteristics":[{"aid":39,"iid":9,"ev":true}]} null {"status":-70401}
NorthernMan54 commented 4 years ago

Tks for this, it also fix #48

dxdc commented 4 years ago

Thx @NorthernMan54! It would be great if it was somehow listed in the debug pane (not sure if it's possible) so the user knows those nodes are no longer connected.