home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.18k stars 31.15k forks source link

Abode integration attempting to login too frequently #132181

Open whereizben opened 16 hours ago

whereizben commented 16 hours ago

The problem

I believe that starting yesterday my Abode integration is attempting to login too frequently to Abode - controlling any Abode device results in the following error: Failed to perform the action switch/turn_on. (429, '{"code":429,"message":"Too many requests. Please try again later.","title":null,"detail":null,"errorCode":14068,"errorProperties":{},"titleCode":null,"titleProperties":{},"error":[]}')

If I reload the integration, it results in this error: Failed to set up: Invalid credentials: (429, '{"code":429,"message": "Too many requests. Please try again later.","title":null,"detail":null,"errorCode":14068,"errorProperties":{},"titleCode":null,"titleProperties":{},"error":[]}')

If I try to login using any device (phone, computer, etc) on my home network to Abode, I get an error on the Abode website that states "Too many requests. Please try again later."

As soon as I refresh my connection to obtain a new IP address for my home network, this error goes away, but within 30 minutes it starts happening again, and has happened 4 times now in the past 24 hours.

I have not recently updated HASS Core (2024.11.3) or OS (13.2)

What version of Home Assistant Core has the issue?

2024.11.3

What was the last working version of Home Assistant Core?

2024.11.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

abode

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

From log when debug logging was enabled:

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 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1687, in async_turn_on
    await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/abode/switch.py", line 50, in turn_on
    self._device.switch_on()
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/devices/switch.py", line 21, in switch_on
    self.set_status(int(STATUS.ON))
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/devices/base.py", line 36, in set_status
    response = self._client.send_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/client.py", line 298, in send_request
    return jaraco.functools.retry_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jaraco/functools/__init__.py", line 359, in retry_call
    cleanup()
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/client.py", line 103, in login
    AuthenticationException.raise_for(response)
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/exceptions.py", line 31, in raise_for
    raise cls((response.status_code, cls.best_message(response))) from exc
jaraco.abode.exceptions.AuthenticationException: (429, '{"code":429,"message":"Too many requests. Please try again later.","title":null,"detail":null,"errorCode":14068,"errorProperties":{},"titleCode":null,"titleProperties":{},"error":[]}')
2024-12-03 08:03:02.408 DEBUG (SocketIOThread) [lomond]  SRV <- CLI : <frame TEXT (1 bytes) fin=1>
2024-12-03 08:03:02.408 DEBUG (SocketIOThread) [jaraco.abode.socketio] Client Ping
2024-12-03 08:03:02.417 DEBUG (SocketIOThread) [lomond]  SRV -> CLI : <frame TEXT (1 bytes) fin=1>
2024-12-03 08:03:02.417 DEBUG (SocketIOThread) [jaraco.abode.socketio] Received: 3
2024-12-03 08:03:02.417 DEBUG (SocketIOThread) [jaraco.abode.socketio] Server Pong
2024-12-03 08:03:03.186 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [281471045805696] Unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/exceptions.py", line 29, in raise_for
    response.raise_for_status()
  File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://my.goabode.com/api/auth2/login

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/jaraco/functools/__init__.py", line 357, in retry_call
    return func()
           ^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/client.py", line 307, in _send_request
    self.login()
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/client.py", line 103, in login
    AuthenticationException.raise_for(response)
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/exceptions.py", line 31, in raise_for
    raise cls((response.status_code, cls.best_message(response))) from exc
jaraco.abode.exceptions.AuthenticationException: (429, '{"code":429,"message":"Too many requests. Please try again later.","title":null,"detail":null,"errorCode":14068,"errorProperties":{},"titleCode":null,"titleProperties":{},"error":[]}')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/exceptions.py", line 29, in raise_for
    response.raise_for_status()
  File "/usr/local/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://my.goabode.com/api/auth2/login

The above exception was the direct cause of the following 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 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1695, in async_turn_off
    await self.hass.async_add_executor_job(ft.partial(self.turn_off, **kwargs))
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/abode/switch.py", line 54, in turn_off
    self._device.switch_off()
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/devices/switch.py", line 26, in switch_off
    self.set_status(int(STATUS.OFF))
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/devices/base.py", line 36, in set_status
    response = self._client.send_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/client.py", line 298, in send_request
    return jaraco.functools.retry_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jaraco/functools/__init__.py", line 359, in retry_call
    cleanup()
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/client.py", line 103, in login
    AuthenticationException.raise_for(response)
  File "/usr/local/lib/python3.12/site-packages/jaraco/abode/exceptions.py", line 31, in raise_for
    raise cls((response.status_code, cls.best_message(response))) from exc
jaraco.abode.exceptions.AuthenticationException: (429, '{"code":429,"message":"Too many requests. Please try again later.","title":null,"detail":null,"errorCode":14068,"errorProperties":{},"titleCode":null,"titleProperties":{},"error":[]}')

Additional information

No response

whereizben commented 3 hours ago

@krx @tradel I see you’ve worked on the abode integration before - any thoughts on this issue?