From 60e4594abd597451b257ec56b7303fd2eaf0d7d4 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 23 Feb 2021 15:07:45 +0100 Subject: [PATCH] Fix area picker with both entity and device filter (#8438) --- src/components/ha-area-picker.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/ha-area-picker.ts b/src/components/ha-area-picker.ts index 793a426e8f..0bf8fb199f 100644 --- a/src/components/ha-area-picker.ts +++ b/src/components/ha-area-picker.ts @@ -140,7 +140,7 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) { this._devices = devices; }), subscribeEntityRegistry(this.hass.connection!, (entities) => { - this._entities = entities; + this._entities = entities.filter((entity) => entity.area_id); }), ]; } @@ -193,11 +193,14 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) { deviceEntityLookup[entity.device_id].push(entity); } inputDevices = devices; - inputEntities = entities.filter((entity) => entity.area_id); - } else if (deviceFilter) { - inputDevices = devices; - } else if (entityFilter) { - inputEntities = entities.filter((entity) => entity.area_id); + inputEntities = entities; + } else { + if (deviceFilter) { + inputDevices = devices; + } + if (entityFilter) { + inputEntities = entities; + } } if (includeDomains) {