Make camera source check faster ()

This commit is contained in:
Paulus Schoutsen 2021-05-24 09:27:13 -07:00 committed by GitHub
parent e964c607a3
commit 6a7968593d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -696,10 +696,13 @@ async def async_handle_play_stream_service(
# It is required to send a different payload for cast media players
entity_ids = service_call.data[ATTR_MEDIA_PLAYER]
sources = entity_sources(hass)
cast_entity_ids = [
entity
for entity, source in entity_sources(hass).items()
if entity in entity_ids and source["domain"] == "cast"
for entity in entity_ids
# All entities should be in sources. This extra guard is to
# avoid people writing to the state machine and breaking it.
if entity in sources and sources[entity]["domain"] == "cast"
]
other_entity_ids = list(set(entity_ids) - set(cast_entity_ids))