Closed madsdyd closed 3 months ago
So, the above is a bald lie! :-) -- I have waited for the integration to resolve the issue automatically, but it hasn't. Today I found out that the energidataservice site was running as expected, but my energidataservice integration did not work (still unavailable). Restarting the integration from HA (Genindlæs) resolved the matter. Which is great and all, but perhaps the scope of this bug should be extended to implement "automatic" restart of the integration or retrying or whatever. This is probably too involved for me at this point.
The issue is with the API, they are running out of database connections and that makes the API fail with an Internal Server Error.
I have written to their support, which seems to have worked although I haven't received any response yet.
When this error happens it blocks the startup sequence of home assistant as modules are started sequentially.
I suggest that the 500 error is acknowledged, and not retried immediately but rather just let the normal update frequency pick the result up later.
I'm on the latest version (1.5.9), but there is unfortunately still an API error in my HA logs.
Logger: custom_components.energidataservice.connectors.nordpool
Source: custom_components/energidataservice/connectors/nordpool/__init__.py:105
integration: Energi Data Service ([documentation](https://github.com/MTrab/energidataservice/blob/master/README.md), [issues](https://github.com/MTrab/energidataservice/issues))
First occurred: 16:42:31 (3 occurrences)
Last logged: 16:42:31
API returned error 502
Will still be reported as errors (as it actually is) but shouldn't block anymore
Describe the feature you wish to make a request for
If energidataservice (the site) fails to respond with a 200, some cases are handled in energidataservice (the HA integration). These include 400 and 411. However, 500 is not specifically handled, and falls through to a generic message.
I would like eds to write a more informative log message, when 500 is returned.
Additionally, it seems that the current "failure" to handle 500 in some specific way, means that eds will time out during HA startup. Perhaps this could also be done "differently", such that eds does not delay HA restarts when energidataservice (the site) is non-functional.
Example of current log message:
If this error was changed to something like:
"Energidataservice API returned errorcode 500, which is an internal error at the energidataservice.dk site. This kind of error typically goes away in a couple of hours on weekdays, but can persist for some time during e.g. weekends. There is nothing this integration can do to work around this, so the sensor will be marked 'unknown' or 'unavailable' as long as this error code is returned. The sensor will return to normal eventually."
then it would be more userfriendly, and the user would know not to post e.g. bugs here on github or create posts on Facebook.
I think, but are unable to test, that this could be a simple change to https://github.com/MTrab/energidataservice/blob/43b1db334de0c4fb410dc2f20873a122106905d3/custom_components/energidataservice/connectors/energidataservice/__init__.py#L90 -- just adding a case for 500.
Describe alternatives you've considered
No response
Additional context
No response