From ac5d576c5b3b052e7d5c726f687e027cd0f9fad9 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 13 Mar 2024 18:00:05 +0100 Subject: [PATCH] Update demo --- .../src/pages/lovelace/entity-filter-card.ts | 23 ++++++++++++++++--- .../lovelace/common/validate-condition.ts | 4 ++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/gallery/src/pages/lovelace/entity-filter-card.ts b/gallery/src/pages/lovelace/entity-filter-card.ts index 14ea75f7b0..45dc70881d 100644 --- a/gallery/src/pages/lovelace/entity-filter-card.ts +++ b/gallery/src/pages/lovelace/entity-filter-card.ts @@ -85,7 +85,7 @@ const CONFIGS = [ `, }, { - heading: "Filtered entities (== on || home)", + heading: "On and home entities", config: ` - type: entity-filter entities: @@ -103,7 +103,24 @@ const CONFIGS = [ `, }, { - heading: 'With "entities" card config (== on || not_home)', + heading: "Same state as Bed Light", + config: ` +- type: entity-filter + entities: + - device_tracker.demo_anne_therese + - device_tracker.demo_home_boy + - device_tracker.demo_paulus + - light.bed_light + - light.ceiling_lights + - light.kitchen_lights + conditions: + - condition: state + state: + - light.bed_light + `, + }, + { + heading: 'With "entities" card config', config: ` - type: entity-filter entities: @@ -125,7 +142,7 @@ const CONFIGS = [ `, }, { - heading: 'With "glance" card config (== on || not_home)', + heading: 'With "glance" card config', config: ` - type: entity-filter entities: diff --git a/src/panels/lovelace/common/validate-condition.ts b/src/panels/lovelace/common/validate-condition.ts index 1769683a0a..00294ff9fe 100644 --- a/src/panels/lovelace/common/validate-condition.ts +++ b/src/panels/lovelace/common/validate-condition.ts @@ -200,8 +200,8 @@ export function extractConditionEntityIds( } } else if (condition.condition === "state") { [ - ...ensureArray(condition.state), - ...ensureArray(condition.state_not), + ...(ensureArray(condition.state) ?? []), + ...(ensureArray(condition.state_not) ?? []), ].forEach((state) => { if (!!state && isValidEntityId(state)) { entityIds.add(state);