Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API - daily limit exceeded #108175

Closed
Friedi1970 opened this issue Jan 16, 2024 · 27 comments · Fixed by #106477
Closed

API - daily limit exceeded #108175

Friedi1970 opened this issue Jan 16, 2024 · 27 comments · Fixed by #106477

Comments

@Friedi1970
Copy link

The problem

Today I got the error message that the daily limit exceeded: To be honest I really can't imagine why.
I installed the fix from @CFenner 2 days ago and it worked fine for me (till now or 2 hours ago). Is there again some trouble with the API?

What version of Home Assistant Core has the issue?

core-2024.1.3

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

Viessmann ViCare

Link to integration documentation on our website

https://www.home-assistant.io/integrations/vicare

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:238
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 18:32:10 (2 occurrences)
Last logged: 18:33:14

[546115360192] (PyViCareRateLimitError(...), 'API rate limit development portal "99f6f755-e18a-47c9-84aa-242a07cf9a0c" daily limit exceeded. Max 1450 calls in timewindow. Limit reset at 2024-01-17T00:00:03.760000.')
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 238, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 882, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 952, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 440, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 334, in async_set_temperature
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/vicare/water_heater.py", line 148, in set_temperature
    self._api.setDomesticHotWaterTemperature(temp)
  File "/usr/local/lib/python3.11/site-packages/PyViCare/PyViCareUtils.py", line 75, in feature_flag_wrapper
    return wrapper(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/PyViCare/PyViCareUtils.py", line 68, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/PyViCare/PyViCareHeatingDevice.py", line 179, in setDomesticHotWaterTemperature
    return self.service.setProperty("heating.dhw.temperature.main", "setTargetTemperature",
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/PyViCare/PyViCareCachedService.py", line 29, in setProperty
    response = super().setProperty(property_name, action, data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/PyViCare/PyViCareService.py", line 64, in setProperty
    return self.oauth_manager.post(url, post_data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 93, in post
    self.__handle_rate_limit(response)
  File "/usr/local/lib/python3.11/site-packages/PyViCare/PyViCareAbstractOAuthManager.py", line 59, in __handle_rate_limit
    raise PyViCareRateLimitError(response)
PyViCare.PyViCareUtils.PyViCareRateLimitError: (PyViCareRateLimitError(...), 'API rate limit development portal "99f6f755-e18a-47c9-84aa-242a07cf9a0c" daily limit exceeded. Max 1450 calls in timewindow. Limit reset at 2024-01-17T00:00:03.760000.')

Additional information

No response

@home-assistant
Copy link

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

Code owner commands

Code owners of vicare 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 vicare Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


vicare documentation
vicare source
(message by IssueLinks)

@CFenner
Copy link
Contributor

CFenner commented Jan 16, 2024

related to #96044

@Friedi1970 the API rate limit is very tight. Here in the message it says 1450. The ha integration is configured to poll every 60 seconds, which leads to 1440 calls per day. That leaves you 10 calls per day for any other interaction (setting temp, etc.). The PR above adjusts the poll interval to the number of devices, so you should only poll every 2 minutes with two devices.

Anyhow if the code doesn't work for you, you can also check this one: #107906
This gives you the ability to choose which device to use but it will still use only one device.

Hope that helps!

@Friedi1970
Copy link
Author

@CFenner ah, got you.
That means, when I do 10 restarts of home assistsant this will also lead to to that limit? Then everything is clear (I had to do more than ten times yesterday 😉 ).

Thanks for this explanation and of course for the codes (which I can't use because I have no clue about coding 🤷‍♂️).

@Friedi1970
Copy link
Author

@CFenner Again I had the problem that the daily limit exceeded. This is def. a problem since I installed the fixx you provided due to the API change of Viessmann.
My problem is that I don't know how to fix this 😕

@Quelbazar
Copy link

related to #96044

@Friedi1970 the API rate limit is very tight. Here in the message it says 1450. The ha integration is configured to poll every 60 seconds, which leads to 1440 calls per day. That leaves you 10 calls per day for any other interaction (setting temp, etc.). The PR above adjusts the poll interval to the number of devices, so you should only poll every 2 minutes with two devices.

Anyhow if the code doesn't work for you, you can also check this one: #107906 This gives you the ability to choose which device to use but it will still use only one device.

Hope that helps!

#107906 works fine and fixes the problem for me. Thanks @CFenner !

@Friedi1970
Copy link
Author

#107906 works fine and fixes the problem for me. Thanks @CFenner !

How should it help? I have only one device. And again, this problem exists since I installed the fix #107847 (comment)

I can't believe that this is pure coincidence. Before I never had this problem.

@CFenner
Copy link
Contributor

CFenner commented Jan 18, 2024

@Friedi1970 the one @Quelbazar mentioned is another fix that enables you to select a device instead of making all available.

Are you sure you have only one device? Then you should simply use the original integration and have no issue.

@Friedi1970
Copy link
Author

@Friedi1970 the one @Quelbazar mentioned is another fix that enables you to select a device instead of making all available.

Are you sure you have only one device? Then you should simply use the original integration and have no issue.

I use the original integration. Then I had the problems due to the API problem some days ago and used your fix (#107847 (comment)) which worked fine.
But since that I have the problem with the the daily limit.

@Quelbazar
Copy link

Quelbazar commented Jan 18, 2024

How should it help? I have only one device. And again, this problem exists since I installed the fix #107847 (comment)

I have only one heatpump too. However, Viessmann API changed some days ago and API shows now 2 devices : My heatpump + my "Vitoconnect".
Original integration polls "only the first device"
Fix #107847 polls all devices => too many calls per day
Fix #107906 polls 1 device of your choice.

Are you sure you have only one device? Then you should simply use the original integration and have no issue.

+1

You should try #107906

@Friedi1970
Copy link
Author

Ah. Got you.
I’ll give it a try tomorrow. Today’s not possible. I only get errors because of the daily limit 🤷‍♂️

image

@Friedi1970
Copy link
Author

Friedi1970 commented Jan 19, 2024

OK. I installed the fix (#107906) of @CFenner . I was surprised that there were two devices. I could only select one because the other one couldn't be selected due to missing serial number.
I restarted and now I am missing the Entities as before I installed #107847 (comment)

image

So, what shall I do now?

@CFenner
Copy link
Contributor

CFenner commented Jan 19, 2024

Please select the viessmann device and click on '...' and download diagnostic information.
Also have a look at the logs and post the lines that say something like "detected xzy asGasBoiler"

@Friedi1970
Copy link
Author

OK, here is all from the log:

2024-01-20 09:37:21.514 INFO (MainThread) [homeassistant.setup] Setting up vicare
2024-01-20 09:37:21.514 INFO (MainThread) [homeassistant.setup] Setup of domain vicare took 0.0 seconds
2024-01-20 09:37:21.576 INFO (SyncWorker_10) [ViCare] Token file exists
2024-01-20 09:37:21.577 INFO (SyncWorker_10) [ViCare] Token restored from file
2024-01-20 09:37:21.909 INFO (SyncWorker_10) [ViCare] Device found: Heatbox2_SRC
2024-01-20 09:37:21.909 INFO (SyncWorker_10) [ViCare] Device found: VScotHO1_72
2024-01-20 09:37:21.910 INFO (SyncWorker_10) [custom_components.vicare.utils] Found device: Heatbox2_SRC (online: True)
2024-01-20 09:37:21.910 INFO (SyncWorker_10) [custom_components.vicare.utils] Found device: VScotHO1_72 (online: True)
2024-01-20 09:37:21.914 INFO (SyncWorker_10) [ViCare] Could not auto detect Heatbox2_SRC. Use generic device.
2024-01-20 09:37:37.596 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up vicare.binary_sensor
2024-01-20 09:37:37.602 INFO (MainThread) [homeassistant.components.button] Setting up vicare.button
2024-01-20 09:37:37.629 INFO (MainThread) [homeassistant.components.sensor] Setting up vicare.sensor
2024-01-20 09:37:37.637 INFO (MainThread) [homeassistant.components.number] Setting up vicare.number
2024-01-20 09:37:37.638 INFO (MainThread) [homeassistant.components.climate] Setting up vicare.climate
2024-01-20 09:37:37.639 INFO (MainThread) [homeassistant.components.water_heater] Setting up vicare.water_heater
2024-01-20 09:40:50.531 WARNING (MainThread) [homeassistant.components.homeassistant.triggers.numeric_state] Error initializing 'count_days_cold' trigger: In 'numeric_state' condition: unknown entity sensor.vicare_outside_temperature_2
2024-01-20 09:40:50.532 WARNING (MainThread) [homeassistant.components.homeassistant.triggers.numeric_state] Error initializing 'count_days_warm' trigger: In 'numeric_state' condition: unknown entity sensor.vicare_outside_temperature_2
2024-01-20 09:40:50.532 WARNING (MainThread) [homeassistant.components.homeassistant.triggers.numeric_state] Error initializing 'switch_on_winter' trigger: In 'numeric_state' condition: unknown entity sensor.vicare_outside_temperature_2
2024-01-20 09:40:50.701 INFO (MainThread) [homeassistant.components.automation.vicare_disconnected] Initialized trigger vicare_disconnected

After I installed the fix I selected the device "VScotHO1_72".

As appendix you may see the diagnostic information.
config_entry-vicare.json.txt

@CFenner thanks in advance for your help. I really appreciate your work 👍

@Friedi1970
Copy link
Author

Additionally I add a screen what happens when I try to select the other device.

image

@Friedi1970
Copy link
Author

@CFenner any idea to solve my problem?

@Friedi1970
Copy link
Author

I tried now to reinstall the other fix which led to an error:

image

Therefore, I deleted the custom files and I tried to activate the standard add on and now I alwas get the migration error:

Logger: homeassistant.config_entries
Source: config_entries.py:649
First occurred: 06:56:46 (1 occurrences)
Last logged: 06:56:46

Migration handler not found for entry ViCare for vicare

Now I am completely lost. Nothing works :(

@CFenner
Copy link
Contributor

CFenner commented Jan 23, 2024

Hi, with the PR you tested you migrated the integration config to the next version. You can manually correct that or remove the integration and install it again.

To correct it, you need to decrease the version in the config/.storage/core.config_entriesfile, but be aware, that you need to know what you're doing there.

@Friedi1970
Copy link
Author

Well, I decided to resore yesterday's backup :)
But now I have (still) the missing entities :(

@CFenner
Copy link
Contributor

CFenner commented Jan 23, 2024

You can tryout this PR #106477 that would simply ignore your gateway and should show your heating again.

@Friedi1970
Copy link
Author

Friedi1970 commented Jan 23, 2024

You can tryout this PR #106477 that would simply ignore your gateway and should show your heating again.

What do you mean with "ignore your gateway"?
And: How can I install? For the last fixes I found a CURL but not here. For those things my knowledge is (unfortunately) insufficient :(

@CFenner
Copy link
Contributor

CFenner commented Jan 23, 2024

Yes, use the curl again, but this time with the number 106477 in the end instead of the other one.

curl -o- -L https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d vicare -p 106477

Viessmann changed something in their API. Now the device that is displayed in HA is the gateway and not the heating device. However the gateway exposes some of the data points of your heating leading to some gone missing in the UI.

@Friedi1970
Copy link
Author

@CFenner I did it and now I again have the migration error :(
image

Logger: homeassistant.config_entries
Source: config_entries.py:649
First occurred: 11:04:07 (1 occurrences)
Last logged: 11:04:07

Migration handler not found for entry ViCare for vicare

@CFenner
Copy link
Contributor

CFenner commented Jan 23, 2024

Can you join Discord to have a chat?

@Friedi1970
Copy link
Author

Friedi1970 commented Jan 23, 2024

Of course I can. But the channel is empty.
image

@CFenner
Copy link
Contributor

CFenner commented Jan 23, 2024

Maybe you need to join here first: https://github.com/somm15/PyViCare#help

@Friedi1970
Copy link
Author

I did. Still the same.

Btw. Meanwhile I restored again because I need the integration for automations.

@Friedi1970
Copy link
Author

now it works with discord

@github-actions github-actions bot locked and limited conversation to collaborators Mar 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants