Closed SvenRtbg closed 7 months ago
Hey there @davet2001, mind taking a look at this issue as it has been labeled with an integration (generic
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
generic documentation generic source (message by IssueLinks)
Hi @SvenRtbg thanks for submitting this.
I fully agree with you. Yes, let's add a better message if possible to help people when there is a specific type of connection error.
I will work on a PR to address it this weekend.
Thanks!
I have reproduced this using a test url e.g. http://httpstat.us/403 as a still image url. In all cases when I tried
http://httpstat.us/403
http://httpstat.us/404
http://httpstat.us/500
I got the message
Unable to load valid image from still image URL (e.g. invalid host, URL or authentication failure). Review log for more info.
In the logs I see
2024-03-09 08:40:56.286 ERROR (MainThread) [homeassistant.components.generic.config_flow] Error getting camera image from http://httpstat.us/403: HTTPStatusError
2024-03-09 08:41:13.389 ERROR (MainThread) [homeassistant.components.generic.config_flow] Error getting camera image from http://httpstat.us/404: HTTPStatusError
2024-03-09 08:41:15.846 ERROR (MainThread) [homeassistant.components.generic.config_flow] Error getting camera image from http://httpstat.us/500: HTTPStatusError
Working on a PR now.
Can confirm this is the behaviour when adding a URL that isn't working from the beginning. And I don't like this message either, but at least it is pointing to the logs.
Consider that in my case, the URL initially worked, and then started to respond with 403.
Ok, just to clarify, the new behaviour after the PR is detailed here: https://github.com/home-assistant/core/pull/112814#issuecomment-1986985730
It displays more descriptive messages on the UI and the log messages include the error code.
The problem
I have created a working "still image" weather map using the generic camera. Some time ago it stoppen providing images.
Opening the configuration again, and without change saving it was not successful. It reads: "Error getting camera image from TheWeatherImageUrl: HTTPStatusError"
That's barely a sufficient error message, because there can be a ton of potential errors triggering this. I manually had to go into the config to increase the logger level to "info" to see that the server responded with 403 status.
I would very much like to see this kind of information already in the initial UI-based error display to explain "HTTPStatusError".
Alternative error situations I could imagine: Status 404, 500 or 503. It would speed up the error tracking process immensely if at least the error status code would be mentioned.
What version of Home Assistant Core has the issue?
core-2024.1.2
What was the last working version of Home Assistant Core?
core-2024.1.2
What type of installation are you running?
Home Assistant Container
Integration causing the issue
generic
Link to integration documentation on our website
https://www.home-assistant.io/integrations/generic
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response