SecKatie / ha-wyzeapi

Home Assistant Integration for Wyze devices.
751 stars 113 forks source link

[Bug] WyzeAPI fails to load in 2023.8.0 #501

Closed ejpenney closed 1 year ago

ejpenney commented 1 year ago

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. Go to Settings
  2. Click on Update to 2023.8.0 Core
  3. Restart
  4. Sensors aren't loaded
  5. Error below in logs

Expected behavior

System configuration System: HAOS (VM) HA Version: 2023.8.0 WyzeApi Version: 0.1.20

home-assistant.log

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:619
Integration: Sensor (documentation, issues)
First occurred: 7:44:03 PM (8 occurrences)
Last logged: 9:33:44 PM

Error adding entities for domain sensor with platform wyzeapi
Error while setting up wyzeapi platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'type'
ejpenney commented 1 year ago

Restarted this morning and I still see this issue. It seems to be preventing the battery entities for my door lock and keypad from loading. Everything else appears to be working.

Dee76 commented 1 year ago

Can confirm that battery entities for lock YD.L01 are no longer available. First noticed after upgrade to HA-WyzeAPI 0.1.20, before upgrading to 2023.8.0 core.

brg468 commented 1 year ago

It’s probably these 2 lines. Looks like type is no longer a valid key for device info. I’ll be able to get a PR in tomorrow probably. Or if you have time trying removing those lines. I don’t have these sensors so I can’t know for sure.

https://github.com/SecKatie/ha-wyzeapi/blob/c48a91f3aaa69e1a345d4d35a0369c25a8bd09b8/custom_components/wyzeapi/sensor.py#L138

https://github.com/SecKatie/ha-wyzeapi/blob/c48a91f3aaa69e1a345d4d35a0369c25a8bd09b8/custom_components/wyzeapi/sensor.py#L205

ejpenney commented 1 year ago

Just commented out those two lines and restarted, looks like that did the trick!

Dee76 commented 1 year ago

Worked here as well. 👍

brg468 commented 1 year ago

Thanks for testing guys. PR submitted.