mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-23 01:37:10 +00:00
Compare commits
2 Commits
add-device
...
dashboard_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc98dda62f | ||
|
|
b3eea77d1a |
@@ -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) {
|
||||||
|
|||||||
@@ -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)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user