dkerr64 / homebridge-yolink

Apache License 2.0
12 stars 2 forks source link

TypeError kills process #86

Closed NicholasB60 closed 9 months ago

NicholasB60 commented 9 months ago

Describe The Bug: Consistently seeing errors in Homebridge after updating to 1.4.1

To Reproduce: Update to 1.4.1, restart Homebridge with configured yolink plugin

Expected behavior: Error doesn't cause child bridge to restart

Logs:

[11/23/2023, 4:36:34 PM] [YoLink] MQTT subscribed: yl-home/f/+/report TypeError: Cannot read properties of undefined (reading 'updateCharacteristic') at /usr/lib/node_modules/homebridge-yolink/src/contactDevice.ts:61:26 at runNextTicks (node:internal/process/task_queues:60:5) at listOnTimeout (node:internal/timers:540:9) at processTimers (node:internal/timers:514:7) [11/23/2023, 4:36:35 PM] [YoLink] Child bridge process ended [11/23/2023, 4:36:35 PM] [YoLink] Process Ended. Code: 1, Signal: null [11/23/2023, 4:36:42 PM] [YoLink] Restarting Process... [11/23/2023, 4:36:43 PM] [YoLink] Launched child bridge with PID 27872 [11/23/2023, 4:36:43 PM] Registering platform 'homebridge-yolink.YoLink' [11/23/2023, 4:36:43 PM] [YoLink] Loaded homebridge-yolink v1.4.1 child bridge successfully [11/23/2023, 4:36:43 PM] Loaded 2 cached accessories from cachedAccessories.0E83AA37DE28. [11/23/2023, 4:36:43 PM] [YoLink] YoLink plugin for HomeBridge version 1.4.1 (c) 2022 David A. Kerr Please report all bugs at https://github.com/dkerr64/homebridge-yolink/issues

Plugin Config:

 "name": "YoLink",             "platform": "YoLink",             "tokenURL": "https://api.yosmart.com/open/yolink/token",             "apiURL": "https://api.yosmart.com/open/yolink/v2/api",             "mqttPort": 8003,             "userAccessId": “removed”,             "secretKey": “removed”,             "refreshAfter": 3600,             "verboseLog": false,             "liteLog": true,             "allDevices": true,             "excludeTypes": [                 "Hub"             ],             "enableExperimental": false,             "devices": [                 {                     "deviceId": “-“,                     "config": {                         "hide": "true",                         "name": "Pool Temperature",                         "refreshAfter": 1800                     }                 },                 {                     "deviceId": “-“,                     "config": {                         "name": "Benton Weather",                         "refreshAfter": 1800                     }                 },                 {                     "deviceId": “-“,                     "config": {                         "name": "Gate"                     }                 }             ],             "_bridge": {                 "username": “-“,                 "port": 31641             }         }     ],

Screenshots:

Environment:

dkerr64 commented 9 months ago

Thanks for reporting. I see the problem, will fix asap.

dkerr64 commented 9 months ago

Please try v1.4.2 that I just published. I believe that fixes this problem. Sorry for the bug, I had to make many changes because of new rate limits YoLink have on their servers. This was a copy/paste that went bad !!

Thanks for reporting it.

NicholasB60 commented 9 months ago

Ran all night and haven't seen the error again. Thanks for the quick fix!

dkerr64 commented 9 months ago

Thanks for reporting the error and confirming the fix.