parent
4cce359960
commit
e7dd31f37b
|
@ -359,7 +359,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
await component.async_setup(config)
|
await component.async_setup(config)
|
||||||
|
|
||||||
async def preload_stream(_event: Event) -> None:
|
async def preload_stream(_event: Event) -> None:
|
||||||
for camera in component.entities:
|
for camera in list(component.entities):
|
||||||
stream_prefs = await prefs.get_dynamic_stream_settings(camera.entity_id)
|
stream_prefs = await prefs.get_dynamic_stream_settings(camera.entity_id)
|
||||||
if not stream_prefs.preload_stream:
|
if not stream_prefs.preload_stream:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -90,7 +90,12 @@ class EntityComponent(Generic[_EntityT]):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def entities(self) -> Iterable[_EntityT]:
|
def entities(self) -> Iterable[_EntityT]:
|
||||||
"""Return an iterable that returns all entities."""
|
"""
|
||||||
|
Return an iterable that returns all entities.
|
||||||
|
|
||||||
|
As the underlying dicts may change when async context is lost, callers that
|
||||||
|
iterate over this asynchronously should make a copy using list() before iterating.
|
||||||
|
"""
|
||||||
return chain.from_iterable(
|
return chain.from_iterable(
|
||||||
platform.entities.values() # type: ignore[misc]
|
platform.entities.values() # type: ignore[misc]
|
||||||
for platform in self._platforms.values()
|
for platform in self._platforms.values()
|
||||||
|
|
Loading…
Reference in New Issue