Add automations category to home dashboard area views (#27641)

This commit is contained in:
Tobias Bieniek
2025-10-29 12:21:17 +01:00
committed by GitHub
parent 1361fc36bf
commit 52eb3d8063
2 changed files with 26 additions and 2 deletions

View File

@@ -168,9 +168,17 @@ export class HomeAreaViewStrategy extends ReactiveElement {
const summaryEntities = Object.values(entitiesBySummary).flat();
// Automations section
const automationFilter = generateEntityFilter(hass, {
domain: "automation",
entity_category: "none",
});
const automations = areaEntities.filter(automationFilter);
// Rest of entities grouped by device
const otherEntities = areaEntities.filter(
(entityId) => !summaryEntities.includes(entityId)
(entityId) =>
!summaryEntities.includes(entityId) && !automations.includes(entityId)
);
const entitiesByDevice: Record<string, string[]> = {};
@@ -295,6 +303,21 @@ export class HomeAreaViewStrategy extends ReactiveElement {
sections.push(...deviceSections);
}
// Show automations last, if they exist
if (automations.length > 0) {
sections.push({
type: "grid",
cards: [
computeHeadingCard(
hass.localize("ui.panel.lovelace.strategy.home.automations"),
"mdi:robot",
"/config/automation/dashboard"
),
...automations.map(computeTileCard),
],
});
}
// Allow between 2 and 3 columns (the max should be set to define the width of the header)
const maxColumns = clamp(sections.length, 2, 3);

View File

@@ -6943,7 +6943,8 @@
"areas": "Areas",
"other_areas": "Other areas",
"unamed_device": "Unnamed device",
"others": "Others"
"others": "Others",
"automations": "Automations"
},
"common_controls": {
"not_loaded": "Usage Prediction integration is not loaded.",