fjhorrillo / homebridge-airzone-cloud

Homebridge Airzone Cloud
Apache License 2.0
21 stars 3 forks source link

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'humidity' of undefined #2

Closed matnoublanche closed 3 years ago

matnoublanche commented 3 years ago

Describe The Bug: Hi (again :) ),

When we start the homebrige daemon with the plugin activated, I have UnhandledPromiseRejectionWarning.

Do you know why ?

Below the log file.

Thank you !

Logs:

[2/7/2021, 9:52:50 AM] [AirzoneCloud] Adding new accessory Bureau (UUID: xxxxxx)
(node:28957) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'humidity' of undefined
    at Zone.get current_humidity [as current_humidity] (/usr/lib/node_modules/homebridge-airzone-cloud/src/AirzoneCloud/Zone.ts:74:40)
    at new AirzoneCloudPlatformAccessory (/usr/lib/node_modules/homebridge-airzone-cloud/src/platformAccessory.ts:72:19)
    at AirzoneCloudHomebridgePlatform.registerDevice (/usr/lib/node_modules/homebridge-airzone-cloud/src/platform.ts:174:7)
    at AirzoneCloudHomebridgePlatform.discoverDevices (/usr/lib/node_modules/homebridge-airzone-cloud/src/platform.ts:118:14)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:28957) 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:28957) [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.

Environment:

matnoublanche commented 3 years ago

I respond to myself, to resolve this bug you have to change line 74 of file AirzoneCloud/Zone.ts to :

return parseFloat(this._data.humidity);

fjhorrillo commented 3 years ago

I fixed it in version 0.0.2