Compare commits

...

2 Commits

Author SHA1 Message Date
Paul Bottein
fc98dda62f Show 24h graph for sensor in climate view 2025-09-02 14:42:32 +02:00
Paul Bottein
b3eea77d1a Don't show binary sensor history in security view 2025-09-02 14:41:55 +02:00
2 changed files with 11 additions and 49 deletions

View File

@@ -12,30 +12,11 @@ import {
} from "../areas/helpers/areas-strategy-helper"; } from "../areas/helpers/areas-strategy-helper";
import { getHomeStructure } from "./helpers/home-structure"; import { getHomeStructure } from "./helpers/home-structure";
import { findEntities, HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries"; import { findEntities, HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries";
import { computeStateName } from "../../../../common/entity/compute_state_name";
import { computeObjectId } from "../../../../common/entity/compute_object_id";
export interface HomeClimateViewStrategyConfig { export interface HomeClimateViewStrategyConfig {
type: "home-climate"; type: "home-climate";
} }
const createTempHumidBadge = (hass: HomeAssistant, entityId: string) => {
const stateObj = hass.states[entityId];
return {
type: "tile",
entity: entityId,
name: stateObj
? computeStateName(stateObj)
: computeObjectId(entityId).replace(/_/g, " "),
features: [
{
type: "history-chart",
hours_to_show: 3,
},
],
};
};
const processAreasForClimate = ( const processAreasForClimate = (
areaIds: string[], areaIds: string[],
hass: HomeAssistant, hass: HomeAssistant,
@@ -64,15 +45,17 @@ const processAreasForClimate = (
}, },
}); });
if (hass.areas[areaId].temperature_entity_id) { if (area.temperature_entity_id) {
cards.push( cards.push({
createTempHumidBadge(hass, hass.areas[areaId].temperature_entity_id) ...computeTileCard(area.temperature_entity_id),
); features: [{ type: "history-chart" }],
});
} }
if (hass.areas[areaId].humidity_entity_id) { if (area.humidity_entity_id) {
cards.push( cards.push({
createTempHumidBadge(hass, hass.areas[areaId].humidity_entity_id) ...computeTileCard(area.humidity_entity_id),
); features: [{ type: "history-chart" }],
});
} }
for (const entityId of areaEntities) { for (const entityId of areaEntities) {

View File

@@ -12,9 +12,6 @@ import {
} from "../areas/helpers/areas-strategy-helper"; } from "../areas/helpers/areas-strategy-helper";
import { getHomeStructure } from "./helpers/home-structure"; import { getHomeStructure } from "./helpers/home-structure";
import { findEntities, HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries"; import { findEntities, HOME_SUMMARIES_FILTERS } from "./helpers/home-summaries";
import { computeDomain } from "../../../../common/entity/compute_domain";
import { computeStateName } from "../../../../common/entity/compute_state_name";
import { computeObjectId } from "../../../../common/entity/compute_object_id";
export interface HomeSecurityViewStrategyConfig { export interface HomeSecurityViewStrategyConfig {
type: "home-security"; type: "home-security";
@@ -49,25 +46,7 @@ const processAreasForSecurity = (
}); });
for (const entityId of areaEntities) { for (const entityId of areaEntities) {
const stateObj = hass.states[entityId]; cards.push(computeTileCard(entityId));
cards.push(
computeDomain(entityId) === "binary_sensor" &&
stateObj?.attributes.device_class === "motion"
? {
type: "tile",
entity: entityId,
name: stateObj
? computeStateName(stateObj)
: computeObjectId(entityId).replace(/_/g, " "),
features: [
{
type: "history-chart",
hours_to_show: 6,
},
],
}
: computeTileCard(entityId)
);
} }
} }
} }