1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Fix logic of entity id extraction (#49164)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
Tobias Sauerwein
2021-04-14 14:12:26 +02:00
committed by GitHub
parent fe1e57e76f
commit 9d4ad1821e
2 changed files with 52 additions and 3 deletions

View File

@@ -362,8 +362,16 @@ async def async_extract_referenced_entity_ids(
return selected
for ent_entry in ent_reg.entities.values():
if ent_entry.area_id in selector.area_ids or (
not ent_entry.area_id and ent_entry.device_id in selected.referenced_devices
if (
# when area matches the target area
ent_entry.area_id in selector.area_ids
# when device matches a referenced devices with no explicitly set area
or (
not ent_entry.area_id
and ent_entry.device_id in selected.referenced_devices
)
# when device matches target device
or ent_entry.device_id in selector.device_ids
):
selected.indirectly_referenced.add(ent_entry.entity_id)