Display area with only sensors in climate view in home dashboard (#26863)
* Display area with only sensors in climate view in home dashboard * Update home-climate-view-strategy.ts Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com> --------- Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>pull/26867/head
parent
ef8410e121
commit
2601b0d89c
|
@ -33,8 +33,28 @@ const processAreasForClimate = (
|
|||
area: area.area_id,
|
||||
});
|
||||
const areaEntities = entities.filter(areaFilter);
|
||||
const areaCards: LovelaceCardConfig[] = [];
|
||||
|
||||
if (areaEntities.length > 0) {
|
||||
const temperatureEntityId = area.temperature_entity_id;
|
||||
if (temperatureEntityId && hass.states[temperatureEntityId]) {
|
||||
areaCards.push({
|
||||
...computeTileCard(temperatureEntityId),
|
||||
features: [{ type: "trend-graph" }],
|
||||
});
|
||||
}
|
||||
const humidityEntityId = area.humidity_entity_id;
|
||||
if (humidityEntityId && hass.states[humidityEntityId]) {
|
||||
areaCards.push({
|
||||
...computeTileCard(humidityEntityId),
|
||||
features: [{ type: "trend-graph" }],
|
||||
});
|
||||
}
|
||||
|
||||
for (const entityId of areaEntities) {
|
||||
areaCards.push(computeTileCard(entityId));
|
||||
}
|
||||
|
||||
if (areaCards.length > 0) {
|
||||
cards.push({
|
||||
heading_style: "subtitle",
|
||||
type: "heading",
|
||||
|
@ -44,25 +64,7 @@ const processAreasForClimate = (
|
|||
navigation_path: `areas-${area.area_id}`,
|
||||
},
|
||||
});
|
||||
|
||||
const temperatureEntityId = area.temperature_entity_id;
|
||||
if (temperatureEntityId && hass.states[temperatureEntityId]) {
|
||||
cards.push({
|
||||
...computeTileCard(temperatureEntityId),
|
||||
features: [{ type: "trend-graph" }],
|
||||
});
|
||||
}
|
||||
const humidityEntityId = area.humidity_entity_id;
|
||||
if (humidityEntityId && hass.states[humidityEntityId]) {
|
||||
cards.push({
|
||||
...computeTileCard(humidityEntityId),
|
||||
features: [{ type: "trend-graph" }],
|
||||
});
|
||||
}
|
||||
|
||||
for (const entityId of areaEntities) {
|
||||
cards.push(computeTileCard(entityId));
|
||||
}
|
||||
cards.push(...areaCards);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,10 +32,15 @@ const processAreasForLights = (
|
|||
area: area.area_id,
|
||||
});
|
||||
const areaLights = entities.filter(areaFilter);
|
||||
const areaCards: LovelaceCardConfig[] = [];
|
||||
|
||||
const computeTileCard = computeAreaTileCardConfig(hass, "", false);
|
||||
|
||||
if (areaLights.length > 0) {
|
||||
for (const entityId of areaLights) {
|
||||
areaCards.push(computeTileCard(entityId));
|
||||
}
|
||||
|
||||
if (areaCards.length > 0) {
|
||||
cards.push({
|
||||
heading_style: "subtitle",
|
||||
type: "heading",
|
||||
|
@ -45,10 +50,7 @@ const processAreasForLights = (
|
|||
navigation_path: `areas-${area.area_id}`,
|
||||
},
|
||||
});
|
||||
|
||||
for (const entityId of areaLights) {
|
||||
cards.push(computeTileCard(entityId));
|
||||
}
|
||||
cards.push(...areaCards);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,14 @@ const processAreasForMediaPlayers = (
|
|||
area: area.area_id,
|
||||
});
|
||||
const areaEntities = entities.filter(areaFilter);
|
||||
const areaCards: LovelaceCardConfig[] = [];
|
||||
|
||||
for (const entityId of areaEntities) {
|
||||
cards.push({
|
||||
type: "media-control",
|
||||
entity: entityId,
|
||||
} satisfies MediaControlCardConfig);
|
||||
}
|
||||
|
||||
if (areaEntities.length > 0) {
|
||||
cards.push({
|
||||
|
@ -40,13 +48,7 @@ const processAreasForMediaPlayers = (
|
|||
navigation_path: `areas-${area.area_id}`,
|
||||
},
|
||||
});
|
||||
|
||||
for (const entityId of areaEntities) {
|
||||
cards.push({
|
||||
type: "media-control",
|
||||
entity: entityId,
|
||||
} satisfies MediaControlCardConfig);
|
||||
}
|
||||
cards.push(...areaCards);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,13 @@ const processAreasForSecurity = (
|
|||
const areaFilter = generateEntityFilter(hass, {
|
||||
area: area.area_id,
|
||||
});
|
||||
|
||||
const areaEntities = entities.filter(areaFilter);
|
||||
const areaCards: LovelaceCardConfig[] = [];
|
||||
|
||||
for (const entityId of areaEntities) {
|
||||
areaCards.push(computeTileCard(entityId));
|
||||
}
|
||||
|
||||
if (areaEntities.length > 0) {
|
||||
cards.push({
|
||||
|
@ -44,10 +50,7 @@ const processAreasForSecurity = (
|
|||
navigation_path: `areas-${area.area_id}`,
|
||||
},
|
||||
});
|
||||
|
||||
for (const entityId of areaEntities) {
|
||||
cards.push(computeTileCard(entityId));
|
||||
}
|
||||
cards.push(...areaCards);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue