SecKatie / ha-wyzeapi

Home Assistant Integration for Wyze devices.
722 stars 112 forks source link

Wyze Lock appears as Unavailable in Home Assistant #577

Closed minego closed 1 week ago

minego commented 2 months ago

Describe the bug Wyze Lock appears as Unavailable in Home Assistant

To Reproduce Steps to reproduce the behavior:

Follow the instructions in README.md to configure ha-wyzeapi through HACS in Home Assistant.

Expected behavior The entities for the lock should report the locked state, and should respond to requests to lock or unlock.

System configuration System: HAOS running in a VM with libvirt/qemu HA Version: 2024.4.4 WyzeApi Version: 0.1.24

home-assistant.log

2024-04-30 13:11:40.701 ERROR (MainThread) [wyzeapy.services.update_manager] Unknown error happened during updating device info Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/update_manager.py", line 44, in update self.device.callback_function(self.device) File "/config/custom_components/wyzeapi/climate.py", line 316, in async_update_callback self.async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1233, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 328, in getattribute return super().getattribute(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 464, in state return HVACMode(hvac_mode).value # type: ignore[unreachable] ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 744, in call return cls.new(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 1158, in new raise ve_exc ValueError: <HVACMode.AUTO: 'auto'> is not a valid HVACMode 2024-04-30 13:11:58.226 DEBUG (MainThread) [custom_components.wyzeapi.light] Creating new WyzeApi light component 2024-04-30 13:11:58.239 DEBUG (MainThread) [custom_components.wyzeapi.switch] Creating new WyzeApi light component 2024-04-30 13:11:58.274 DEBUG (MainThread) [custom_components.wyzeapi.lock] Creating new WyzeApi lock component 2024-04-30 13:11:58.276 DEBUG (MainThread) [custom_components.wyzeapi.climate] Creating new WyzeApi thermostat component 2024-04-30 13:11:58.280 DEBUG (MainThread) [custom_components.wyzeapi.alarm_control_panel] Creating new WyzeApi Home Monitoring System component 2024-04-30 13:11:58.281 DEBUG (MainThread) [custom_components.wyzeapi.sensor] Creating new WyzeApi sensor component 2024-04-30 13:11:58.289 DEBUG (MainThread) [custom_components.wyzeapi.siren] Creating new WyzeApi siren component 2024-04-30 13:11:58.580 ERROR (MainThread) [homeassistant.components.climate] Error adding entity climate.thermostat for domain climate with platform wyzeapi Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 890, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1334, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 328, in getattribute return super().getattribute(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 464, in state return HVACMode(hvac_mode).value # type: ignore[unreachable] ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 744, in call return cls.new(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 1158, in new raise ve_exc ValueError: <HVACMode.AUTO: 'auto'> is not a valid HVACMode 2024-04-30 13:12:16.375 ERROR (MainThread) [wyzeapy.services.update_manager] Unknown error happened during updating device info Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/update_manager.py", line 44, in update self.device.callback_function(self.device) File "/config/custom_components/wyzeapi/climate.py", line 316, in async_update_callback self.async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1233, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 328, in getattribute return super().getattribute(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 464, in state return HVACMode(hvac_mode).value # type: ignore[unreachable] ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 744, in call return cls.new(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 1158, in new raise ve_exc ValueError: <HVACMode.AUTO: 'auto'> is not a valid HVACMode 2024-04-30 13:12:26.581 DEBUG (MainThread) [custom_components.wyzeapi.switch] Camera: Living Room Cam has a new event 2024-04-30 13:13:27.019 ERROR (MainThread) [wyzeapy.services.update_manager] Unknown error happened during updating device info Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/update_manager.py", line 44, in update self.device.callback_function(self.device) File "/config/custom_components/wyzeapi/climate.py", line 316, in async_update_callback self.async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1233, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 328, in getattribute return super().getattribute(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 464, in state return HVACMode(hvac_mode).value # type: ignore[unreachable] ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 744, in call return cls.new(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 1158, in new raise ve_exc ValueError: <HVACMode.AUTO: 'auto'> is not a valid HVACMode 2024-04-30 13:13:27.519 DEBUG (MainThread) [custom_components.wyzeapi.light] Creating new WyzeApi light component 2024-04-30 13:13:27.532 DEBUG (MainThread) [custom_components.wyzeapi.switch] Creating new WyzeApi light component 2024-04-30 13:13:27.556 DEBUG (MainThread) [custom_components.wyzeapi.lock] Creating new WyzeApi lock component 2024-04-30 13:13:27.561 DEBUG (MainThread) [custom_components.wyzeapi.climate] Creating new WyzeApi thermostat component 2024-04-30 13:13:27.564 DEBUG (MainThread) [custom_components.wyzeapi.alarm_control_panel] Creating new WyzeApi Home Monitoring System component 2024-04-30 13:13:27.570 DEBUG (MainThread) [custom_components.wyzeapi.sensor] Creating new WyzeApi sensor component 2024-04-30 13:13:27.579 DEBUG (MainThread) [custom_components.wyzeapi.siren] Creating new WyzeApi siren component 2024-04-30 13:13:27.857 ERROR (MainThread) [homeassistant.components.climate] Error adding entity climate.thermostat for domain climate with platform wyzeapi Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 890, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1334, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 328, in getattribute return super().getattribute(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 464, in state return HVACMode(hvac_mode).value # type: ignore[unreachable] ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 744, in call return cls.new(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 1158, in new raise ve_exc ValueError: <HVACMode.AUTO: 'auto'> is not a valid HVACMode 2024-04-30 13:13:29.511 ERROR (MainThread) [wyzeapy.services.update_manager] Unknown error happened during updating device info Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/update_manager.py", line 44, in update self.device.callback_function(self.device) File "/config/custom_components/wyzeapi/climate.py", line 316, in async_update_callback self.async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1233, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 328, in getattribute return super().getattribute(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init__.py", line 464, in state return HVACMode(hvac_mode).value # type: ignore[unreachable] ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 744, in call return cls.new(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 1158, in new__ raise ve_exc ValueError: <HVACMode.AUTO: 'auto'> is not a valid HVACMode 2024-04-30 13:13:57.649 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140316852639552] {'code': '3005', 'ts': 1714504437623, 'msg': 'unauthorized operation', 'data': {}, 'traceId': '89e1759027a59193eeeca07fc8e2b6b5'} Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/wyzeapi/token_manager.py", line 45, in inner_function await func(*args, *kwargs) File "/config/custom_components/wyzeapi/switch.py", line 202, in async_turn_off await self._service.turn_off(self._device) File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/camera_service.py", line 108, in turn_off await self._run_action(camera, "power_off") File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/base_service.py", line 328, in _run_action check_for_errors_standard(response_json) File "/usr/local/lib/python3.12/site-packages/wyzeapy/utils.py", line 84, in check_for_errors_standard raise UnknownApiError(response_json) wyzeapy.exceptions.UnknownApiError: {'code': '3005', 'ts': 1714504437623, 'msg': 'unauthorized operation', 'data': {}, 'traceId': '89e1759027a59193eeeca07fc8e2b6b5'} 2024-04-30 13:14:00.959 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140316852639552] {'code': '3005', 'ts': 1714504440932, 'msg': 'unauthorized operation', 'data': {}, 'traceId': 'c157e7faa52881fc687d016cce5a7fdf'} Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/wyzeapi/token_manager.py", line 45, in inner_function await func(args, **kwargs) File "/config/custom_components/wyzeapi/switch.py", line 194, in async_turn_on await self._service.turn_on(self._device) File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/camera_service.py", line 105, in turn_on await self._run_action(camera, "power_on") File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/base_service.py", line 328, in _run_action check_for_errors_standard(response_json) File "/usr/local/lib/python3.12/site-packages/wyzeapy/utils.py", line 84, in check_for_errors_standard raise UnknownApiError(response_json) wyzeapy.exceptions.UnknownApiError: {'code': '3005', 'ts': 1714504440932, 'msg': 'unauthorized operation', 'data': {}, 'traceId': 'c157e7faa52881fc687d016cce5a7fdf'}

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

minego commented 1 month ago

Is this project abandoned?

brg468 commented 1 month ago

It’s not. The logs you provided have no reference to the lock, and without having one myself it’s pretty hard to troubleshoot.

minego commented 1 month ago

Apologies. I have been trying this morning to get a lock that does contain relevant info, and I'm not sure how to do that... I tried just now by enabling debug logging, reloading the integration and then disabling debug logging again.

The log I got just now from that has a single mention of a lock, and it doesn't appear to be an error:

2024-05-31 07:54:40.051 DEBUG (MainThread) [custom_components.wyzeapi.lock] Creating new WyzeApi lock component

The log does contain some errors from wyzeapy that may be related though:

2024-05-30 15:27:16.684 ERROR (MainThread) [wyzeapy.services.update_manager] Unknown error happened during updating device info
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/update_manager.py", line 42, in update
    self.device = await self.service.update(self.device)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/camera_service.py", line 53, in update
    state_response: List[Tuple[PropertyIDs, Any]] = await self._get_property_list(camera)
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/base_service.py", line 167, in _get_property_list
    check_for_errors_standard(self, response_json)
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/utils.py", line 85, in check_for_errors_standard
    raise UnknownApiError(response_json)
wyzeapy.exceptions.UnknownApiError: {'code': '1011', 'msg': 'system limit exceeded, please try again later.', 'traceId': '6e805682a9bc2c47d634b0cc051f04d8', 'data': {}}
2024-05-30 15:27:17.873 ERROR (MainThread) [wyzeapy.services.update_manager] Unknown error happened during updating device info
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/update_manager.py", line 42, in update
    self.device = await self.service.update(self.device)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/bulb_service.py", line 71, in update
    device_info = await self._get_property_list(bulb)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/base_service.py", line 167, in _get_property_list
    check_for_errors_standard(self, response_json)
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/utils.py", line 85, in check_for_errors_standard
    raise UnknownApiError(response_json)
wyzeapy.exceptions.UnknownApiError: {'code': '1011', 'msg': 'system limit exceeded, please try again later.', 'traceId': '260e75602035d0bf2a97bc7ae21f4481', 'data': {}}
2024-05-30 15:27:20.033 ERROR (MainThread) [wyzeapy.services.update_manager] Unknown error happened during updating device info
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/update_manager.py", line 42, in update
    self.device = await self.service.update(self.device)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/camera_service.py", line 44, in update
    response = await self._get_event_list(10)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/base_service.py", line 294, in _get_event_list
    check_for_errors_standard(self, response_json)
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/utils.py", line 85, in check_for_errors_standard
    raise UnknownApiError(response_json)
wyzeapy.exceptions.UnknownApiError: {'code': '1011', 'msg': 'system limit exceeded, please try again later.', 'traceId': '94c03d7d4a721560ff371d24ef1f6d98', 'data': {}}

The device appears but with a status of "Unavailable" and actions are disabled. Is there anything else that I can do help provide more useful information here?

brg468 commented 1 month ago

Thanks for the logs. Unfortunately those don’t provide any real mention of an issue either. Was this working for you previously and stopped or is this a new setup? I really have no idea how the lock works, although it does look like it was/is still supported through this setup. Also assuming it still works for you in the app. Maybe somebody else can chime in with some help.

minego commented 1 month ago

Thanks @brg468 !

The lock has never worked through the HA integration. It does report the battery status, but it doesn't appear to know the state of the lock (It shows it as locked regardless of the actual state) and it doesn't allow changing the state.

The README.md for this project says Lock, unlock, and view status of lock and door for the Wyze Lock so based on that I was expecting it to work.

If anyone has suggestions for what I can do to obtain more relevant logs, I'd love to hear it.

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 1 week ago

This issue was closed because it has been stalled for 5 days with no activity.