pradeepmouli / homebridge-isy-js

Homebridge platform plugin for the ISY series of home controllers from Universal Devices.
MIT License
28 stars 9 forks source link

ISYGarageDoorAccessory error fixes #32

Closed cswelin closed 4 years ago

cswelin commented 4 years ago

Ran into a couple issues when trying to setup a garage door.

First is this.log was throwing the following error:

(node:68922) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'info' of undefined
    at new ISYGarageDoorAccessory (/usr/local/lib/node_modules/homebridge-isy/src/ISYGarageDoorAccessory.ts:25:13)
    at /usr/local/lib/node_modules/homebridge-isy/src/ISYPlatform.ts:280:7
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at ISYPlatform.createAccessories (/usr/local/lib/node_modules/homebridge-isy/src/ISYPlatform.ts:236:3)
    at HomebridgeAPI.<anonymous> (/usr/local/lib/node_modules/homebridge-isy/src/ISYPlatform.ts:69:4)
(node:68922) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:68922) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Changing this to logger like the rest resolves it, but then exposes:

(node:69082) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'isPrimaryService' of undefined
    at ISYGarageDoorAccessory.configure (/usr/local/lib/node_modules/homebridge-isy/src/ISYAccessory.ts:77:3)
    at /usr/local/lib/node_modules/homebridge-isy/src/ISYPlatform.ts:328:11
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at ISYPlatform.createAccessories (/usr/local/lib/node_modules/homebridge-isy/src/ISYPlatform.ts:236:3)
    at HomebridgeAPI.<anonymous> (/usr/local/lib/node_modules/homebridge-isy/src/ISYPlatform.ts:69:4)
(node:69082) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:69082) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This is because ISYAccessory is assuming the service is called platformAccessory but ISYGarageDoorAccessory still uses the old garageDoorService property.

Changing those two things allowed me to get the Garage door to show up in HomeKit.

pradeepmouli commented 4 years ago

Thanks sir!

cswelin commented 4 years ago

Thanks sir!

Np, interactions are still broken since sendLightCommand doesn't exist on parameter.