jfarmer08 / homebridge-wyze-smart-home

Wyze Smart Home plugin for Homebridge.
MIT License
94 stars 14 forks source link

TypeError this.getCharacteristic is not a function #108

Closed chris001 closed 1 year ago

chris001 commented 1 year ago

Describe The Bug:

After installing the homebridge-wyze-smart-home plugin, and login to Wyze acct, the Console fills with this error message. It appears to infinitely restart. NOTE: I'm running a very close fork of your plugin (by @zswuwing), it's only 2 commits ahead of this repo. Reporting here because the bug surely exist in both code bases. And because unfortunately, @zswuwing has no Issues tab in that repo... 😞

To Reproduce:

Install homebridge. Access the homebridge web login. Create login. Install this wyze plugin. Provide wyze login info. Save. Console will fill up with this error message!

TypeError: this.getCharacteristic is not a function
    at WyzeHMS.updateCharacteristics (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/accessories/WyzeHMS.js:24:12)
    at WyzeHMS.update (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:351:18)
    at WyzeSmartHome.loadDevice (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/WyzeSmartHome.js:126:17)
    at WyzeSmartHome.loadDevices (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/WyzeSmartHome.js:86:36)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeSmartHome.refreshDevices (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/WyzeSmartHome.js:75:7)
    at WyzeSmartHome.runLoop (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home

Expected behavior:

No error, no error message.

Logs:

Show the Homebridge logs here, remove any sensitive information.

Plugin Config:

Show your Homebridge config.json here, remove any sensitive information.

Screenshots:

Environment: Debian Linux 11, running inside LXC container. Homebridge IP address is a in the private LAN range 10.0.0.x

github-actions[bot] commented 1 year ago

Message that will be displayed on users' first issue

zswuwing commented 1 year ago

@chris001 feel free to try my new version, no guarantee to fix though

chris001 commented 1 year ago

@zswuwing I get this infinite crash error with your new version:

[6/27/2023, 11:48:21 PM] [Wyze] Child bridge process ended
[6/27/2023, 11:48:21 PM] [Wyze] Process Ended. Code: 1, Signal: null
[6/27/2023, 11:48:28 PM] [Wyze] Restarting Process...
[6/27/2023, 11:48:29 PM] [Wyze] Launched child bridge with PID 38855
[6/27/2023, 11:48:29 PM] Registering platform '@zswuwing/homebridge-wyze-smart-home.WyzeSmartHome'
[6/27/2023, 11:48:29 PM] [Wyze] Loaded @zswuwing/homebridge-wyze-smart-home v0.5.27 child bridge successfully
[6/27/2023, 11:48:29 PM] Loaded 15 cached accessories from cachedAccessories.0EB46409C789.
[6/27/2023, 11:48:29 PM] Homebridge v1.6.1 (HAP v0.11.1) (Wyze) is running on port 37496.

/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/accessories/WyzeHMS.js:24
      this.getCharacteristic(Characteristic.On).updateValue(noResponse)
                                                            ^
ReferenceError: noResponse is not defined
    at WyzeHMS.updateCharacteristics (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/accessories/WyzeHMS.js:24:61)
    at WyzeHMS.update (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:351:18)
    at WyzeSmartHome.loadDevice (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/WyzeSmartHome.js:126:17)
    at WyzeSmartHome.loadDevices (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/WyzeSmartHome.js:86:36)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeSmartHome.refreshDevices (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/WyzeSmartHome.js:75:7)
    at WyzeSmartHome.runLoop (/var/lib/homebridge/node_modules/@zswuwing/homebridge-wyze-smart-home/src/WyzeSmartHome.js:59:9)
[6/27/2023, 11:48:29 PM] [Wyze] Child bridge process ended
[6/27/2023, 11:48:29 PM] [Wyze] Process Ended. Code: 1, Signal: null
[6/27/2023, 11:48:29 PM] [Wyze] Restarting Process...
[6/27/2023, 11:48:29 PM] [Wyze] Launched child bridge with PID 38998

EDIT: I found this same bug in other code. Both WyzeLock.js and WyzeHMS.js are using the reference noResponse while it's undefined in their code! And noResponse is defined near the top of all of the other accessory js files!

zswuwing commented 1 year ago

@chris001 yes, looks like you already know how to fix it

zswuwing commented 1 year ago

@chris001 i have updated the code now, feel free to try

chris001 commented 1 year ago

@zswuwing Thanks. I installed the new version 0.5.28. This is the output of the logs:

[6/28/2023, 4:06:14 AM] Homebridge v1.6.1 (HAP v0.11.1) (Homebridge 3D8D) is running on port 51158.
[6/28/2023, 4:06:15 AM] [Ring] Found the following locations:
[6/28/2023, 4:06:15 AM] [Ring]   locationId: 272698eb-0346-43fa - xxMyCityxx
[6/28/2023, 4:06:15 AM] [Wyze] Launched child bridge with PID 41664
[6/28/2023, 4:06:16 AM] [Ring] Configuring 1 cameras and 1 devices for location "xxMyCityxx" - locationId: 272698eb-0346-43fa
[6/28/2023, 4:06:16 AM] [Ring] Hidden accessory 9c856f2d-b076-4338-a589-76af11ce8f80 doorbell_graham_cracker Bedroom
[6/28/2023, 4:06:16 AM] Registering platform '@zswuwing/homebridge-wyze-smart-home.WyzeSmartHome'
[6/28/2023, 4:06:16 AM] [Wyze] Loaded @zswuwing/homebridge-wyze-smart-home v0.5.28 child bridge successfully
[6/28/2023, 4:06:16 AM] Loaded 15 cached accessories from cachedAccessories.0EB46409C789.
[6/28/2023, 4:06:16 AM] Homebridge v1.6.1 (HAP v0.11.1) (Wyze) is running on port 37496.
[6/28/2023, 4:06:17 AM] [@zswuwing/homebridge-wyze-smart-home] This plugin generated a warning from the characteristic 'Security System Current State': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[6/28/2023, 4:06:17 AM] [@zswuwing/homebridge-wyze-smart-home] This plugin generated a warning from the characteristic 'Security System Target State': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[6/28/2023, 4:07:14 AM] [@zswuwing/homebridge-wyze-smart-home] This plugin generated a warning from the characteristic 'Security System Current State': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.
[6/28/2023, 4:07:14 AM] [@zswuwing/homebridge-wyze-smart-home] This plugin generated a warning from the characteristic 'Security System Target State': characteristic value expected valid finite number and received "undefined" (undefined). See https://homebridge.io/w/JtMGR for more info.

Is these This plugin generated a warning logs not supposed to happen?

EDIT: here's the page describing step by step how to fix this error. !!

jfarmer08 commented 1 year ago

@zswuwing Are you planning creating a pull request?

chris001 commented 5 months ago

In v0.5.37-alpha.7 (by jfarmer), this error "Type Error: this.getCharacteristic is not a function" has come back! A "regression" as it's called!

[1/22/2024, 10:56:39 PM] Homebridge v1.7.0 (HAP v0.11.1) (Homebridge 4D22) is running on port 51789.
[1/22/2024, 10:56:40 PM] TypeError: this.getCharacteristic is not a function
    at WyzeHMS.updateCharacteristics (/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeHMS.js:46:12)
    at WyzeHMS.update (/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:91:12)
    at WyzeSmartHome.loadDevice (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:157:15)
    at WyzeSmartHome.loadDevices (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:117:36)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeSmartHome.refreshDevices (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:106:7)
    at WyzeSmartHome.runLoop (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:90:9)
[1/22/2024, 10:56:40 PM] Got SIGTERM, shutting down Homebridge...
[1/22/2024, 10:56:54 PM] [Wyze] Initializing WyzeSmartHome platform...
[1/22/2024, 10:57:09 PM] [Wyze] Initializing WyzeSmartHome platform...

Starts up... Instant crash! Infinite restart!

bunnyc1986 commented 5 months ago

same error started on mine too. opened a new issue: https://github.com/jfarmer08/homebridge-wyze-smart-home/issues/207