From e19413b6ca0cbe513bd479a38ef8f85d809a4705 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 28 Aug 2025 01:26:44 -0400 Subject: [PATCH] Show binary sensors with graphs on the security dashboard (#26738) --- .../strategies/home/helpers/home-summaries.ts | 2 +- .../strategies/home/home-security-view-strategy.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/panels/lovelace/strategies/home/helpers/home-summaries.ts b/src/panels/lovelace/strategies/home/helpers/home-summaries.ts index a9dbd1f7ee..974560762e 100644 --- a/src/panels/lovelace/strategies/home/helpers/home-summaries.ts +++ b/src/panels/lovelace/strategies/home/helpers/home-summaries.ts @@ -65,7 +65,7 @@ export const HOME_SUMMARIES_FILTERS: Record = { }, { domain: "binary_sensor", - device_class: ["door", "garage_door"], + device_class: ["door", "garage_door", "motion"], entity_category: "none", }, ], diff --git a/src/panels/lovelace/strategies/home/home-security-view-strategy.ts b/src/panels/lovelace/strategies/home/home-security-view-strategy.ts index b80fd9f5ad..759df98206 100644 --- a/src/panels/lovelace/strategies/home/home-security-view-strategy.ts +++ b/src/panels/lovelace/strategies/home/home-security-view-strategy.ts @@ -12,6 +12,7 @@ import { } from "../areas/helpers/areas-strategy-helper"; import { getHomeStructure } from "./helpers/home-structure"; import { findEntities, HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries"; +import { computeDomain } from "../../../../common/entity/compute_domain"; export interface HomeSecurityViewStrategyConfig { type: "home-security"; @@ -23,6 +24,8 @@ const processAreasForSecurity = ( entities: string[] ): LovelaceCardConfig[] => { const cards: LovelaceCardConfig[] = []; + const computeTileCard = computeAreaTileCardConfig(hass, "", false); + const computeTileCardWithFeature = computeAreaTileCardConfig(hass, "", true); for (const areaId of areaIds) { const area = hass.areas[areaId]; @@ -33,8 +36,6 @@ const processAreasForSecurity = ( }); const areaEntities = entities.filter(areaFilter); - const computeTileCard = computeAreaTileCardConfig(hass, "", false); - if (areaEntities.length > 0) { cards.push({ heading_style: "subtitle", @@ -47,7 +48,12 @@ const processAreasForSecurity = ( }); for (const entityId of areaEntities) { - cards.push(computeTileCard(entityId)); + cards.push( + computeDomain(entityId) === "binary_sensor" && + hass.states[entityId]?.attributes.device_class === "motion" + ? computeTileCardWithFeature(entityId) + : computeTileCard(entityId) + ); } } }