From acd506aeebc152676ab9d496d90ea202a6df07bb Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Mon, 29 Aug 2022 19:07:34 -0700 Subject: [PATCH] Only add the lights for an area --- custom_components/adaptive_lighting/switch.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index a8349f65..00555ef0 100755 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -1284,9 +1284,12 @@ class TurnOnOffListener: area_ids = cv.ensure_list_csv(service_data[ATTR_AREA_ID]) entity_ids = [] for area_id in area_ids: - entity_ids.extend(area_entities(self.hass, area_id)) + area_entity_ids = area_entities(self.hass, area_id) + for entity_id in area_entity_ids: + if entity_id.startswith(LIGHT_DOMAIN): + entity_ids.append(entity_id) _LOGGER.debug( - "Found entity_ids '%s' in area area_id %s: %s", entity_ids, area_id + "Found entity_ids '%s' for area_id '%s'", entity_ids, area_id ) if not any(eid in self.lights for eid in entity_ids):