core: Forecast.Solar Rate Limiting Error (no API version)
The problem
I have been using Firecast.Solar for over a year and it’s been running fine (I use it to calculate whether or not to charge my home battery overnight). I can think of nothing in my local environment (e.g. network connection, hardware etc) that has changed.
Two days ago (9th April 2023) I started to receive a Rate Limit Error. This persists even after restarting the integration. When I deleted and reinstalled the integration the integration didn’t initialise and no devices or entities were created.
I am using the free tier API, without any API key.
[See attached images for details of the error messages and logs)

What version of Home Assistant Core has the issue?
core-2023.4.2
What was the last working version of Home Assistant Core?
core-2023.4.1
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Forecast.Solar
Link to integration documentation on our website
https://www.home-assistant.io/integrations/forecast_solar
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Logger: homeassistant.components.forecast_solar
Source: components/forecast_solar/coordinator.py:65
Integration: Forecast.Solar (documentation, issues)
First occurred: 10 April 2023 at 11:39:25 (1161 occurrences)
Last logged: 13:56:41
Unexpected error fetching forecast_solar data: 'X-Ratelimit-Limit'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 250, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/components/forecast_solar/coordinator.py", line 65, in _async_update_data
return await self.forecast.estimate()
File "/usr/local/lib/python3.10/site-packages/forecast_solar/__init__.py", line 148, in estimate
data = await self._request(
File "/usr/local/lib/python3.10/site-packages/forecast_solar/__init__.py", line 125, in _request
self.ratelimit = Ratelimit.from_response(response)
File "/usr/local/lib/python3.10/site-packages/forecast_solar/models.py", line 199, in from_response
limit = int(response.headers["X-Ratelimit-Limit"])
KeyError: 'X-Ratelimit-Limit'
Additional information
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 29 (7 by maintainers)
Changing something in the options flow will force a new request to the API, it will not reset the counter that is based on where the request is coming from (ip adres). I now know a bit more why the ratelimit header no longer appears with every request.
Perhaps changing the declination makes the service see the API call as a different call, and resets the call count?
Let’s see how it goes, but at least we appear to have a work around.
Yes, that’s interesting! Changing from 90 degrees to 89 degrees and restarting fixed it also for me. Until so far.
Interesting. I changed from 40 degrees to 39 degrees and then restarting also ‘fixed’ it for me - for now. We’ll see how it goes on.
Hopefully this is a useful clue for understanding the problem and making a permanent fix.