mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Mark stream available on idle timeout (#68380)
Mark stream as available on idle timeout so that the frontend can still interact with it. In particular, the Frontend won't interact with camera objects that are not available e.g. from picture glance card. Issue #67922
This commit is contained in:
parent
8220817d47
commit
5027e1bcff
@ -371,17 +371,18 @@ class Stream:
|
||||
wait_timeout,
|
||||
redact_credentials(str(self.source)),
|
||||
)
|
||||
self._worker_finished()
|
||||
|
||||
def _worker_finished(self) -> None:
|
||||
"""Schedule cleanup of all outputs."""
|
||||
|
||||
@callback
|
||||
def remove_outputs() -> None:
|
||||
def worker_finished() -> None:
|
||||
# The worker is no checking availability of the stream and can no longer track
|
||||
# availability so mark it as available, otherwise the frontend may not be able to
|
||||
# interact with the stream.
|
||||
if not self.available:
|
||||
self._async_update_state(True)
|
||||
for provider in self.outputs().values():
|
||||
self.remove_provider(provider)
|
||||
|
||||
self.hass.loop.call_soon_threadsafe(remove_outputs)
|
||||
self.hass.loop.call_soon_threadsafe(worker_finished)
|
||||
|
||||
def stop(self) -> None:
|
||||
"""Remove outputs and access token."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user