SecKatie / ha-wyzeapi

Home Assistant Integration for Wyze devices.
762 stars 116 forks source link

[Bug] Error when trying to lock or unlock "too fast" #633

Closed hitnrun30 closed 1 month ago

hitnrun30 commented 1 month ago

Describe the bug Whenever I try to lock or unlock right away after another call I get "the operation is too fast, please wait" (Translated)

To Reproduce Steps to reproduce the behavior:

  1. Click the lock to either lock or unlock
  2. Click again within a few seconds

Expected behavior Will lock or unlock with no error

System configuration System: HA Version: WyzeApi Version:

home-assistant.log

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:245
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: September 28, 2024 at 18:39:46 (32 occurrences)
Last logged: 11:13:53

[140042034465232] Unexpected exception
[140041484155728] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/lock/__init__.py", line 239, in async_handle_unlock_service
    await self.async_unlock(**self.add_default_code(kwargs))
  File "/config/custom_components/wyzeapi/token_manager.py", line 45, in inner_function
    await func(*args, **kwargs)
  File "/config/custom_components/wyzeapi/lock.py", line 102, in async_unlock
    await self._lock_service.unlock(self._lock)
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/lock_service.py", line 52, in unlock
    await self._lock_control(lock, "remoteUnlock")
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/base_service.py", line 492, in _lock_control
    check_for_errors_lock(self, response_json)
  File "/usr/local/lib/python3.12/site-packages/wyzeapy/utils.py", line 96, in check_for_errors_lock
    raise UnknownApiError(response_json)
wyzeapy.exceptions.UnknownApiError: {'ReqID': 'fe95b29314', 'ErrNo': 5034, 'ErrMsg': '操作太快,请稍后'}
brg468 commented 1 month ago

I would imagine that’s a limitation of the API. Probably not much we can do about that.