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
73.31k stars 30.62k forks source link

Mill. Still getting "too many requests after 2023.9.1 #100060

Closed Bluhme1 closed 1 year ago

Bluhme1 commented 1 year ago

The problem

Mill. Still getting "too many requests after 2023.9.1

What version of Home Assistant Core has the issue?

2023.9.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Mill

Link to integration documentation on our website

No response

Diagnostics information

Logger: homeassistant.components.mill Source: helpers/update_coordinator.py:248 Integration: Mill (documentation, issues) First occurred: 08.51.38 (227 occurrences) Last logged: 13.52.53

Unexpected error fetching mill data: {"error":{"type":"Too Many Requests","message":"Too Many Requests from customer - 066e9e66-5370-42a6-87e3-288b5da637dc. Limit: 4000 requests per day for this endpoint"}} Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 293, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 248, in _async_update_data return await self.update_method() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/mill/init.py", line 323, in fetch_heater_and_sensor_data await self.update_devices() File "/usr/local/lib/python3.11/site-packages/mill/init.py", line 206, in update_devices await asyncio.gather(tasks) File "/usr/local/lib/python3.11/site-packages/mill/init.py", line 224, in _update_home await asyncio.gather(tasks) File "/usr/local/lib/python3.11/site-packages/mill/init.py", line 234, in _update_room await asyncio.gather(*tasks) File "/usr/local/lib/python3.11/site-packages/mill/init.py", line 250, in _update_device device_stats = await self.request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/mill/init.py", line 163, in request raise TooManyRequests(result) mill.TooManyRequests: {"error":{"type":"Too Many Requests","message":"Too Many Requests from customer - 066e9e66-5370-42a6-87e3-288b5da637dc. Limit: 4000 requests per day for this endpoint"}}

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.mill
Source: helpers/update_coordinator.py:248 
Integration: Mill (documentation, issues) 
First occurred: 08.51.38 (227 occurrences) 
Last logged: 13.52.53

Unexpected error fetching mill data: {"error":{"type":"Too Many Requests","message":"Too Many Requests from customer - 066e9e66-5370-42a6-87e3-288b5da637dc. Limit: 4000 requests per day for this endpoint"}}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 293, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 248, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mill/__init__.py", line 323, in fetch_heater_and_sensor_data
    await self.update_devices()
  File "/usr/local/lib/python3.11/site-packages/mill/__init__.py", line 206, in update_devices
    await asyncio.gather(*tasks)
  File "/usr/local/lib/python3.11/site-packages/mill/__init__.py", line 224, in _update_home
    await asyncio.gather(*tasks)
  File "/usr/local/lib/python3.11/site-packages/mill/__init__.py", line 234, in _update_room
    await asyncio.gather(*tasks)
  File "/usr/local/lib/python3.11/site-packages/mill/__init__.py", line 250, in _update_device
    device_stats = await self.request(
                   ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mill/__init__.py", line 163, in request
    raise TooManyRequests(result)
mill.TooManyRequests: {"error":{"type":"Too Many Requests","message":"Too Many Requests from customer - 066e9e66-5370-42a6-87e3-288b5da637dc. Limit: 4000 requests per day for this endpoint"}}

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @danielhiversen, mind taking a look at this issue as it has been labeled with an integration (mill) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `mill` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign mill` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


mill documentation mill source (message by IssueLinks)

Danielhiversen commented 1 year ago

It seems that Mill has made some changes to the rate limiting again. Really hard to fix since it is not documented and changes without any notice.

Bluhme1 commented 1 year ago

Just for your information. I get approximately 9 hours of data between 14.00 and 23.00. Then it turns unavailable again

Danielhiversen commented 1 year ago

How many heaters do you have?

Bluhme1 commented 1 year ago

I have 2 generation 2 and 2 generation 3 heaters in my summer cabin

Bluhme1 commented 1 year ago

Could we set a limit on the number of requests. Knowing that we loose on accuracy

Danielhiversen commented 1 year ago

Yes, that is what I am trying. Are you able to test these changes? https://github.com/Danielhiversen/pymill/compare/master...cache-1?quick_pull=1

Bluhme1 commented 1 year ago

How do I test that. Should I try to set Mill up as a custom_component? Or can I modify the files in HA directly?

MistaWu commented 1 year ago

Getting the same, 4 gen2 and 1 gen3 heaters. How do I test?

Danielhiversen commented 1 year ago

You need to modify the library locally, and that depends on how HA is installed. I only have one heater, but if it works fine here I push another fix .

MistaWu commented 1 year ago

Just got this mail from Mill:

Dear valued API user,

We have recently identified an issue with your account involving excessive utilization of our API endpoints. This heightened activity has placed a significant strain on our server resources, resulting in a noticeable degradation in performance for all other users of our application.

Several of our endpoints have been designed with a maximum request limit of 4000 requests per 24 hours. Regrettably, it has come to our attention that this threshold is being reached prematurely in the day, and despite reaching this limit, we continue to observe a considerable volume of spam-like activity originating from your account.

We are eager to understand whether this unusual usage pattern is intentional or if it may be attributed to a third-party integration you have implemented. If the latter is the case, it could signify a suboptimal integration that may require refinement.

If your integration employs the Homey Integration, we strongly recommend upgrading to the latest version, as initial releases were notably less optimized. Furthermore, if you utilize any third-party integrations apart from Tibber or Homey, we kindly request that you inform us so that we can initiate discussions with these providers to enhance their integration with our systems.

Soon, we will be introducing API call limits per account, which will encompass two key components:

The maximum number of API calls allowed per minute/hour.

The maximum number of API calls allowed within a 24-hour period.

This measure is being implemented to ensure equitable resource allocation for all users, preventing the actions of a few from adversely affecting the experience of many. We trust that you appreciate the necessity of this step, and should you have any inquiries or concerns, please do not hesitate to reach out to us.

For your convenience, the updated API quota limits will be published on our documentation website: http://mn-be-prod-documentation.s3-website.eu-central-1.amazonaws.com/#/. We anticipate further improvements and enhanced organization of this documentation page soon, complete with illustrative examples. Stay tuned for these enhancements.

Thank you for your understanding and cooperation.

fahlsen commented 1 year ago

I also spoke with Mill support on the phone now, and they say they will change the limit to 200 request pr hour.