NorthernMan54 / node-red-contrib-homebridge-automation

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

HA crashes node-red #111

Open Falfango opened 1 year ago

Falfango commented 1 year ago

After deploying with my first hb-event node with configured hap-config, node-red restarts permanently after it crashes. In the log I found the following error messages

14 Jan 18:53:08 - [red] Uncaught Exception: 14 Jan 18:53:08 - [error] TypeError: Cannot read properties of undefined (reading 'includes') at Service.toList (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/lib/Service.js:129:83) at Accessory.toList (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/lib/Accessory.js:52:40) at Homebridge.toList (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/lib/Homebridge.js:60:34) at Homebridges.toList (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/lib/Homebridges.js:33:35) at HAPNodeJSClient. (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/HAP-NodeRed.js:58:56) at HAPNodeJSClient.emit (node:events:513:28) at HAPNodeJSClient. (/home/pi/.node-red/node_modules/hap-node-client/HAPNodeJSClient.js:119:10) at Timeout._onTimeout (/home/pi/.node-red/node_modules/hap-node-client/HAPNodeJSClient.js:199:7) at listOnTimeout (node:internal/timers:559:17) at processTimers (node:internal/timers:502:7) nodered.service: Main process exited, code=exited, status=1/FAILURE

looking into Service.js the following line produce this error

if (characteristic.type !== '00000023' && (context.opt ? characteristic.perms.includes(context.opt.perms) : true)) {
  // debug("Yes", context.name, characteristic.description, characteristic.perms);
  descriptions = (descriptions ? descriptions + ', ' : '') + characteristic.description.replace(/ /g, "").replace(/\./g, "_");
  getCharacteristics = (getCharacteristics ? getCharacteristics + ',' : '') + characteristic.getCharacteristic;
  // characteristics = (characteristics ? characteristics + ',' : '') + characteristic.characteristic;
  characteristics = Object.assign(characteristics, characteristic.characteristic);
  putCharacteristics = putCharacteristics.concat(characteristic.putCharacteristic);
  eventRegisters = eventRegisters.concat(characteristic.eventRegister);
} else {
  // debug("No", context.name, characteristic.description, characteristic.perms);
}
NorthernMan54 commented 1 year ago

If you update to the latest, I applied a workaround for the issue to no longer crash when a characteristic does not have perms.

If you're still having issues, will need to look into why or which accessory has this problematic characteristic as all should have a perms. And to look further will need a dump of the accessories from the problematic homebridge instance.

Falfango commented 1 year ago

I updated to 0.1.8 It still crashes, but with a different log.

15 Jan 17:54:13 - [red] Uncaught Exception: 15 Jan 17:54:13 - [error] TypeError: this.services[index].toList is not a function at Accessory.toList (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/lib/Accessory.js:52:40) at Homebridge.toList (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/lib/Homebridge.js:60:34) at Homebridges.toList (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/lib/Homebridges.js:33:35) at HAPNodeJSClient. (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/HAP-NodeRed.js:58:56) at HAPNodeJSClient.emit (node:events:513:28) at HAPNodeJSClient. (/home/pi/.node-red/node_modules/hap-node-client/HAPNodeJSClient.js:119:10) at Timeout._onTimeout (/home/pi/.node-red/node_modules/hap-node-client/HAPNodeJSClient.js:199:7) at listOnTimeout (node:internal/timers:559:17) at processTimers (node:internal/timers:502:7) nodered.service: Main process exited, code=exited, status=1/FAILURE nodered.service: Failed with result 'exit-code'.

cached Accessories (hope I got the right file) cachedAccessories.txt

NorthernMan54 commented 1 year ago

Damm I thought that would have been it. Unfortunately that isn’t the correct accessory dump, the one need is collected with thisNorthernMan54/homebridge-alexa: Expose your homebridge controlled devices to Amazon Alexa.github.comOn Jan 15, 2023, at 12:22 PM, Falfango @.***> wrote: I updated to 0.1.8 It still crashes, but with a different log. 15 Jan 17:54:13 - [red] Uncaught Exception: 15 Jan 17:54:13 - [error] TypeError: this.services[index].toList is not a function at Accessory.toList (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/lib/Accessory.js:52:40) at Homebridge.toList (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/lib/Homebridge.js:60:34) at Homebridges.toList (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/lib/Homebridges.js:33:35) at HAPNodeJSClient. (/home/pi/.node-red/node_modules/node-red-contrib-homebridge-automation/HAP-NodeRed.js:58:56) at HAPNodeJSClient.emit (node:events:513:28) at HAPNodeJSClient. (/home/pi/.node-red/node_modules/hap-node-client/HAPNodeJSClient.js:119:10) at Timeout._onTimeout (/home/pi/.node-red/node_modules/hap-node-client/HAPNodeJSClient.js:199:7) at listOnTimeout (node:internal/timers:559:17) at processTimers (node:internal/timers:502:7) nodered.service: Main process exited, code=exited, status=1/FAILURE nodered.service: Failed with result 'exit-code'. cached Accessories (hope I got the right file) cachedAccessories.txt

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>