parent
4cce359960
commit
e7dd31f37b
2 changed files with 7 additions and 2 deletions
|
@ -359,7 +359,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||
await component.async_setup(config)
|
||||
|
||||
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)
|
||||
if not stream_prefs.preload_stream:
|
||||
continue
|
||||
|
|
|
@ -90,7 +90,12 @@ class EntityComponent(Generic[_EntityT]):
|
|||
|
||||
@property
|
||||
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(
|
||||
platform.entities.values() # type: ignore[misc]
|
||||
for platform in self._platforms.values()
|
||||
|
|
Loading…
Add table
Reference in a new issue