jfarmer08 / homebridge-wyze-smart-home

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

WyzeHMS.js TypeError: this.getCharacteristic is not a function #207

Open bunnyc1986 opened 5 months ago

bunnyc1986 commented 5 months ago

Describe The Bug: Inifinte crash and restart loop.

Expected behavior: Should not crash.

Logs:

[1/31/2024, 7:29:16 PM] Homebridge v1.7.0 (HAP v0.11.1) (Wyze) is running on port 55859.

/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeHMS.js:46
      this.getCharacteristic(Characteristic.On).updateValue(noResponse);
           ^
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/31/2024, 7:29:17 PM] [Wyze] Child bridge process ended

Plugin Config:

{
    "name": "Wyze",
    "username": "....",
    "password": "...",
    "keyId": "...",
    "apiKey": "...",
    "mfaCode": "...",
    "refreshInterval": 60000,
    "entryExitDelay": 30,
    "showAdvancedOptions": true,
    "logging": "none",
    "excludeMacAddress": true,
    "filterByMacAddressList": [
        "..."
    ],
    "excludedeviceType": false,
    "_bridge": {
        "username": "...",
        "port": ...
    },
    "platform": "WyzeSmartHome"
}

Screenshots:

Environment:

chris001 commented 5 months ago

Seems this crash bug's related to the /homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeHMS.js:46 = Wyze Home Monitoring Service?

bunnyc1986 commented 4 months ago

Seems this crash bug's related to the /homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeHMS.js:46 = Wyze Home Monitoring Service?

yes, I believe so.

jfarmer08 commented 4 months ago

Do you have any active account for HMS?

jfarmer08 commented 4 months ago

if you don't use HMS or you don't have subscription then add "hms": false to your config.

chris001 commented 4 months ago

if you don't use HMS or you don't have subscription then add "hms": false to your config.

Thanks. However, using HMS with HMS subscription.

bunnyc1986 commented 4 months ago

yes. I have active HMS subscription and am using the HMS. This used to happen occasionally in the past, but recently became consistently, besides the on going authentication issue.

asachs01 commented 4 months ago

Same here. Neither enabling or disabling fixes the issue:

[2/10/2024, 1:12:19 PM] TypeError: this.getCharacteristic is not a function
    at WyzeHMS.updateCharacteristics (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeHMS.js:46:12)
    at WyzeHMS.update (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:133:12)
    at WyzeSmartHome.loadDevice (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:158:15)
    at WyzeSmartHome.loadDevices (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:118:36)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeSmartHome.refreshDevices (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:107:7)
    at WyzeSmartHome.runLoop (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:91:9)
[2/10/2024, 1:12:19 PM] Got SIGTERM, shutting down Homebridge...

FWIW,

Version: v0.5.42 OS: Ubuntu 22.04 Node: 20.5.1

jfarmer08 commented 4 months ago

Try clearing the accessory cache for it.

chris001 commented 4 months ago

Try clearing the accessory cache for it.

How? Commands? Menu item?

bunnyc1986 commented 4 months ago

I found this error shown up when the HMS is offline. My HMS became offline often recently.

bunnyc1986 commented 4 months ago

Try clearing the accessory cache for it.

How? Commands? Menu item?

it's in Homebridge settings. "Remove Single Cached Accessory".

image
asachs01 commented 4 months ago

That seems to have done it for me.

chris001 commented 4 months ago

Can wyze-smart-home detect when this error happens (WyzeHMS.js TypeError: this.getCharacteristic is not a function), and automatically do the "remove single cached accessory" thru code?

bunnyc1986 commented 4 months ago

I still see this error after removing the cached accessory. the timing corelates when HMS is offline in the wyze app.

jfarmer08 commented 4 months ago

If you can change the code for WyzeHMS.js at line 46 until I can put out an update for it. All you need to do is comment out the line 46 like this //this.getCharacteristic(Characteristic.On).updateValue(noResponse); and restart.

jfarmer08 commented 4 months ago

hopefully this helps https://github.com/jfarmer08/homebridge-wyze-smart-home/releases/tag/v0.5.44

carTloyal123 commented 4 months ago

@bunnyc1986 is this resolved or are there still issues?

bunnyc1986 commented 4 months ago

@bunnyc1986 is this resolved or are there still issues?

I no longer see the error after upgrading to v0.5.44. Thank you!

bunnyc1986 commented 4 months ago

this issue just came back:

[2/18/2024, 3:58:35 PM] [Wyze] Restarting Process...
[2/18/2024, 3:58:35 PM] [Wyze] Launched child bridge with PID 2440
[2/18/2024, 3:58:35 PM] Registering platform 'homebridge-wyze-smart-home.WyzeSmartHome'
[2/18/2024, 3:58:35 PM] [Wyze] Loaded homebridge-wyze-smart-home v0.5.44 child bridge successfully
[2/18/2024, 3:58:35 PM] Loaded 9 cached accessories from cachedAccessories.xxxxxx
[2/18/2024, 3:58:35 PM] Homebridge v1.7.0 (HAP v0.11.1) (Wyze) is running on port xxxxxx.

/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeHMS.js:46
      this.getCharacteristic(Characteristic.SecuritySystemCurrentState).updateValue(noResponse);
           ^
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:133:12)
    at WyzeSmartHome.loadDevice (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:158:15)
    at WyzeSmartHome.loadDevices (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:118:36)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeSmartHome.refreshDevices (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:107:7)
    at WyzeSmartHome.runLoop (/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:91:9)
[2/18/2024, 3:58:36 PM] [Wyze] Child bridge process ended
[2/18/2024, 3:58:36 PM] [Wyze] Process Ended. Code: 1, Signal: null
jfarmer08 commented 4 months ago

You can comment out that line until i can get a fix.

//this.getCharacteristic(Characteristic.SecuritySystemCurrentState).updateValue(noResponse);