iMicknl / ha-tahoma

Custom component for Home Assistant to interact with smart devices via Somfy TaHoma or other OverKiz based API's.
MIT License
156 stars 30 forks source link

Too many requests, try again later #435

Closed alexebner closed 3 years ago

alexebner commented 3 years ago

I have migrated the automation from my blinds over tahoma to Homassistant. Now i get very often "Too many requests, try again later".

I have tryed to take the HA offline over night but in the morning the second action does not work because too many request.

In my last home automation system (Homey) i had never problems with that. I know that i was getting an email fom somfy with the info that they implement a connection limit. Then the developer from the somfy addin makes some changes i his app and the problem never comes up.

I think that the connectionlimits are only for full device syncs with the api.

Here is the Repository from the othe app: https://github.com/AdyRock/com.somfy.tahoma

I think the fixes of the limit problems are arround 10,Oct,2020

iMicknl commented 3 years ago

Could you include a bit more information? Which hub do you use and what is your current configured update interval in Home Assistant?

And do you perhaps run the Homey version next to Home Assistant?

alexebner commented 3 years ago

Sorry!

I am using a Somfy Tahoma Premium Device with: 5x IO Venetian blinds 1x IO Shutter 5x RTS Venetian blinds

My update interval is now configured to 300 sec. But also the same problem as bevore. My last automation is turned off.

My first action in the morning ist to open all the Venetian blinds. Between the open.cover ations i have 1.5sec pause. My second action 5 minutes later to open the IO Shutter does not work becaue of "Too many requests, try again later"

When i wait soeme time than it work.

First Action

alias: Alle RAF auf
sequence:
  - service: cover.open_cover
    target:
      entity_id: cover.raffstor_bad
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - service: cover.open_cover
    target:
      entity_id: cover.raffstor_buro
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - service: cover.open_cover
    target:
      entity_id: cover.raffstor_kuche
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - service: cover.open_cover
    target:
      entity_id: cover.raffstor_wc
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - service: cover.open_cover
    target:
      entity_id: cover.raffstor_wohnzimmer
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - service: cover.open_cover
    target:
      entity_id: cover.wg_fenster_links
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - service: cover.open_cover
    target:
      entity_id: cover.wg_fenster_rechts
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - service: cover.open_cover
    target:
      entity_id: cover.wg_ture_rechts
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - service: cover.open_cover
    target:
      entity_id: cover.wg_ture_links
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 500
  - service: cover.open_cover
    target:
      entity_id: cover.wg_fenster_vorne
mode: single
iMicknl commented 3 years ago

Why do you use a 1.5sec pause in between all automations? I am not sure what is going wrong, but I will give it a look.

And do you perhaps run the Homey version next to Home Assistant? Or is this the only integration you are using?

alexebner commented 3 years ago

On homey it was a problem when i sent all action without a pause. Then it was not 100%sure that all blinds are triggered. I was thinking that this is a problem from tahoma so i have created it same in homeassistant. My Homey ist powerd off since 2 Days becaus that was my firs idea that 2 devices connecting to tahoma make this problem.

iMicknl commented 3 years ago

You should not need the pause, so I would start by simplifying it by removing the breaks. Too many requests, try again later can indeed happen when you do too many requests, but with one installation where you just execute some actions it should not happen.

Are there any other errors / warnings in your log?

tetienne commented 3 years ago

For such cases,I suggest you to create a scenario within Tahomalink.com and then call it from home assistant. It will perform only one request and you are guaranteed all your covers will be opened.

alexebner commented 3 years ago

Yes but i also have some logic in another action.

When closing blind and the windows is open then do tilt 50%. When windows is closed do tilt 100% That is not possible with a scene for all blinds.

Also the state of the RTS blinds will not be updated when i controll it by scenes.

iMicknl commented 3 years ago

@alexebner do you only have RTS devices? Or do you have at least one IO device as well?

alexebner commented 3 years ago

I am using a Somfy Tahoma Premium Device with: 5x IO Venetian blinds 1x IO Shutter 5x RTS Venetian blinds

all with cover.wg* are RTS the others are IO

alexebner commented 3 years ago

Now after 8h closed firewall I have opend the firewall for homeassistant.

First i made a "ha core reload" and then i see in the log.

2021-04-28 19:37:35 ERROR (MainThread) [custom_components.tahoma] Unexpected error fetching device events data: Too many requests, try again later : login with ******@*******
Traceback (most recent call last):
  File "/config/custom_components/tahoma/coordinator.py", line 67, in _async_update_data
    events = await self.client.fetch_events()
  File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 215, in fetch_events
    response = await self.__post(f"events/{self.event_listener_id}/fetch")
  File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 333, in __post
    await self.check_response(response)
  File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 371, in check_response
    raise NotAuthenticatedException(message)
pyhoma.exceptions.NotAuthenticatedException: Not authenticated

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 173, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/tahoma/coordinator.py", line 78, in _async_update_data
    await self.client.login()
  File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 95, in login
    response = await self.__post("login", data=payload)
  File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 333, in __post
    await self.check_response(response)
  File "/usr/local/lib/python3.8/site-packages/pyhoma/client.py", line 363, in check_response
    raise TooManyRequestsException(message)
pyhoma.exceptions.TooManyRequestsException: Too many requests, try again later : login with ******@*******
alexebner commented 3 years ago

Can i help you in any way to find the problem? The problem still exists that the half of the time the blinds are not on the position that they should be. Sometime it works and sometime not. And in the logs everytime the same entrys.

iMicknl commented 3 years ago

@alexebner is this still an issue?

alexebner commented 3 years ago

Now with a update interval from 600 it works most of the time. But i have still the same errors in the log.

github-actions[bot] commented 3 years ago

'There hasn't been any activity on this issue recently. Is this issue still present? Please make sure to update to the latest Home Assistant version and version of this integration to see if that solves the issue. Let us know if that works for you by adding a comment 👍. This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.'