jfarmer08 / homebridge-wyze-smart-home

Wyze Smart Home plugin for Homebridge.
MIT License
103 stars 17 forks source link

TypeError: Cannot convert undefined or null to object when reading lockKeypadProperties #86

Closed bmcclure closed 1 year ago

bmcclure commented 1 year ago

Describe The Bug:

I have the newer Wyze Lock that has a built-in keypad. I'm not sure if that's significant, but that's the only lock in my Wyze account, and it uses Bluetooth to actually connect to the lock.

When I set this plugin up in Homebridge, and don't exclude the Lock type, the Wyze plugin container keeps restarting indefinitely with the following error:

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at WyzeLock.lockGetProperty (/homebridge/node_modules/.pnpm/homebridge-wyze-smart-home@0.5.2-5.1/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:422:32)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

If I uninstall the plugin, then reinstall it and exclude the "lock" type, it seems to work OK.

To Reproduce:

  1. Set up a Wyze Lock (the model with a built-in keypad that uses Bluetooth)
  2. Install this plugin in Homebridge and don't exclude the "lock" type

Expected behavior:

The plugin should fully load instead of crashing and restarting from this error.

Logs:

[3/12/2023, 4:34:26 PM] [Wyze] Launched child bridge with PID 2776
[3/12/2023, 4:34:26 PM] Registering platform 'homebridge-wyze-smart-home.WyzeSmartHome'
[3/12/2023, 4:34:26 PM] [Wyze] Loaded homebridge-wyze-smart-home v0.5.25.1 child bridge successfully
[3/12/2023, 4:34:26 PM] Loaded 34 cached accessories from cachedAccessories.0E3A31761B28.
[3/12/2023, 4:34:27 PM] Homebridge v1.6.0 (HAP v0.11.0) (Wyze) is running on port 30351.

/homebridge/node_modules/.pnpm/homebridge-wyze-smart-home@0.5.2-5.1/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:422
    const prop_keypad = Object.keys(lockKeypadProperties)
                               ^
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at WyzeLock.lockGetProperty (/homebridge/node_modules/.pnpm/homebridge-wyze-smart-home@0.5.2-5.1/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:422:32)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
[3/12/2023, 4:34:27 PM] [Wyze] Child bridge process ended
[3/12/2023, 4:34:27 PM] [Wyze] Process Ended. Code: 1, Signal: null

Plugin Config:

{
    "name": "Wyze",
    "username": "",
    "password": "",
    "refreshInterval": 60000,
    "entryExitDelay": 30,
    "mfaCode": "",
    "showAdvancedOptions": false,
    "excludeMacAddress": false,
    "excludedeviceType": false,
    "_bridge": {
        "username": "",
        "port": 30351
    },
    "platform": "WyzeSmartHome"
}

Screenshots:

Environment:

github-actions[bot] commented 1 year ago

Message that will be displayed on users' first issue

JohnSeals commented 1 year ago

I am also seeing this. New install of Homebridge and the plugin.

xenonaxel commented 1 year ago

I am also seeing the same error.

jfarmer08 commented 1 year ago

This is good to know. I will have to exclude this lock by default.

kvoth1 commented 1 year ago

I see this error too. I have the standalone lock with no keypad and get this error which causes restart. It was working fine until a couple weeks or so ago. I want to be able to use the lock and don't want to exclude the lock. Any way to fix this?

I've tried most of the recent versions of the plugin, and they all have this issue.

jfarmer08 commented 1 year ago

Can we confirm if version 0.5.28 fixes the issue?

kvoth1 commented 1 year ago

It fixed it for me. I can now add my lock again.