BJReplay / ha-solcast-solar

Solcast Integration for Home Assistant
Apache License 2.0
124 stars 24 forks source link

Home assistant reverts all values to zero #52

Closed UK-JustinSmall closed 3 weeks ago

UK-JustinSmall commented 3 weeks ago

The problem

Home assistant appears to revert all values to zero and no idea why Snag_337883

What version of Solcast Integration has the issue?

4.0.25

What version of Home Assistant are you using?

2024.6.4

Diagnostics information

No response

Logs debug/info/error output

This error originated from a custom integration.
Logger: custom_components.solcast_solar.solcastapi
Source: custom_components/solcast_solar/solcastapi.py:188
integration: Solcast PV Forecast (documentation, issues)
First occurred: 05:06:06 (1 occurrences)
Last logged: 05:06:06

SOLCAST - sites_usage error: Traceback (most recent call last): File "/config/custom_components/solcast_solar/solcastapi.py", line 177, in sites_usage raise Exception(f"SOLCAST - sites_usage: gathering site data failed. request returned Status code: {status} - Responce: {resp_json}.") Exception: SOLCAST - sites_usage: gathering site data failed. request returned Status code: 429 - Responce: None.

This error originated from a custom integration.
Logger: custom_components.solcast_solar.solcastapi
Source: custom_components/solcast_solar/solcastapi.py:154
integration: Solcast PV Forecast (documentation, issues)
First occurred: 05:06:06 (1 occurrences)
Last logged: 05:06:06

SOLCAST - sites_data Exception error: Traceback (most recent call last): File "/config/custom_components/solcast_solar/solcastapi.py", line 144, in sites_data raise Exception(f"SOLCAST - HTTP sites_data error: Solcast Error gathering rooftop sites data.") Exception: SOLCAST - HTTP sites_data error: Solcast Error gathering rooftop sites data.

This error originated from a custom integration.
Logger: custom_components.solcast_solar.solcastapi
Source: custom_components/solcast_solar/solcastapi.py:141
integration: Solcast PV Forecast (documentation, issues)
First occurred: 05:06:06 (1 occurrences)
Last logged: 05:06:06

SOLCAST - sites_data Solcast.com http status Error 429 - Gathering rooftop sites data.

Additional information

No response

gieljnssns commented 3 weeks ago

Try to reload your integration.

In README.md

[!TIP] The Solcast Servers seem to occasionally be under some strain, and the servers return 429 return codes when they are busy. Changing your API Key is not a solution, nor is uninstalling and re-installing the Solcast PV Solar Integration. These "tricks" might appear to work, but all that has actually happened is that you have tried again later, and the integration has worked.

If you think that have problems in the integration, make sure that you have logging turned on, and capture logs to find out if you are getting messages indicating that the Solcast API is busy - these indicate that the Solcast API is under stress. Log capture instructions are in the Bug Issue Template - you will see them if you start creating a new issue - make sure you include logs if you want the assistance of the repository constributors.

autoSteve commented 3 weeks ago

In later versions much has been done to try and prevent this situation occurring, @UK-JustinSmall. We've built in retry mechanisms for three things: Rooftop sites gather (without this, the integration will see this symptom that you're hitting in 4.0.25, and cannot start cleanly), current API usage (this wasn't a thing in 4.0.25), and lastly forecast gather.

When any of these fail due to Solcast indicating they are too busy (with a 429 status response), then cached data is utilised. These caches obviously need to exist (they get re-written each restart/forecast gather), so until they do 429 issues may still be seen.

In later versions, restart of the Solcast integration can result in longer startup times being seen occasionally. This is being caused by 429 issue retries. Max 15 second delay if rooftop sites gather fails, plus another 15 seconds if get current API usage fails.

Note: Upgrading to 4.0.31, which should avoid this particular issue may currently result in the loss of long-term forecast statistics. So if those are important to you then I would hold off upgrading until 4.0.33 is released.