node-red-contrib-homebridge-automation icon indicating copy to clipboard operation
node-red-contrib-homebridge-automation copied to clipboard

Bug if device is removed

Open dxdc opened this issue 5 years ago • 2 comments

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}

dxdc avatar May 18 '20 15:05 dxdc

Tks for this, it also fix #48

NorthernMan54 avatar May 20 '20 21:05 NorthernMan54

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.

dxdc avatar May 20 '20 23:05 dxdc