Show binary sensors with graphs on the security dashboard (#26738)

This commit is contained in:
Paulus Schoutsen 2025-08-28 01:26:44 -04:00 committed by Paul Bottein
parent 0dfc10af5f
commit e19413b6ca
No known key found for this signature in database
2 changed files with 10 additions and 4 deletions

View File

@ -65,7 +65,7 @@ export const HOME_SUMMARIES_FILTERS: Record<HomeSummaries, EntityFilter[]> = {
},
{
domain: "binary_sensor",
device_class: ["door", "garage_door"],
device_class: ["door", "garage_door", "motion"],
entity_category: "none",
},
],

View File

@ -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)
);
}
}
}