mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-08 10:29:37 +00:00
Add automations category to home dashboard area views (#27641)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user