mirror of
https://github.com/home-assistant/frontend.git
synced 2026-02-04 01:10:33 -06:00
Show binary sensors with graphs on the security dashboard (#26738)
This commit is contained in:
parent
0dfc10af5f
commit
e19413b6ca
@ -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",
|
||||
},
|
||||
],
|
||||
|
||||
@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user