core: Broken live stream preview after a couple of hours since HA bootup - getting 'unauthorized' error while trying to see stream
The problem
The integration works fine for a few hours since HA bootup, then stops - instead of a live footage from my Synology camera - there is no preview and the logs show an error.
The weird thing is that the entity picture which changes ever 10 seconds is fine - it is still able to refresh it automatically. It’s the live preview which is broken. I observed this doesn’t happen (or rarely happens) for another camera which has the ‘Preload stream’ checkbox set. Maybe it keeps the connection to the camera - don’t know, but the one which fails has the preload checkbox unset.
This issue was described in https://github.com/home-assistant/core/issues/70414, but it was closed as the theoretical fix was delivered as part of HA 2022.5.5 but it didn’t fix the problem.
I also opened an issue for the stream integration specifically (https://github.com/home-assistant/core/issues/70416), but it was closed as well as I was told it will be tracked under #70414
The only woraround is to restart HA - then the live preview works fine. At least for a couple of hours.
What version of Home Assistant Core has the issue?
2022.5.5
What was the last working version of Home Assistant Core?
2021.12
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Stream / Synology DSM
Link to integration documentation on our website
https://www.home-assistant.io/integrations/stream
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Logger: homeassistant.components.stream.stream.camera.synology_dach
Source: components/stream/__init__.py:347
Integration: Stream (documentation, issues)
First occurred: 19 maja 2022, 09:36:13 (153 occurrences)
Last logged: 17:54:20
Error from stream worker: Error opening stream (HTTP_UNAUTHORIZED, Server returned 401 Unauthorized (authorization failed)) rtsp://****:****@192.168.0.13:554/Sms=9.unicast
Additional information
I enabled debug logging initially after opening #70416, but there was nothing relevant in logs. The only thing which indicates some problem is the ‘unathorized’ error I put above.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (6 by maintainers)
Looks like that was it! 17 hours passed and it’s still working! 😃 Thanks for fixing this! It’s a big relief, my HA is stable again and may run without restarts for long weeks as it used to be in the past.
ok, I guess your concern is that the integration wasn’t loaded as custom component. Indeed I made a mistake - forgot to put the
versionpiece in the manifest file. I saw there was an error in logs about this, so it wasn’t loaded as custom component apparently. I did this now, restarted HA, and now I see it was loaded as custom component. I’ll leave it running and let’s see what happens. Perhaps it’s fixed now. I’ll confirm this tomorrow. Usually it failed within 2 hours after bootup.This issue will be fixed with the linked PR
I see https://github.com/home-assistant/core/pull/70938 in 2022.05.05 was aimed at fixing this. I suspect a good next step could be to get some additional debug logs with the new log messages that show the lifecycle of the stream url being updated.