Add actions section and add domains to other section in area dashboard (#25558)

* Add actions section and add domains to other section in area dashboard

* Add timer and input button

* Better grouping
pull/25596/head
Paul Bottein 2025-05-26 10:50:42 +02:00 committed by GitHub
parent 28fe60f02b
commit 7fa697a768
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 52 additions and 4 deletions

View File

@ -76,8 +76,15 @@ export class AreaViewStrategy extends ReactiveElement {
const computeTileCard = computeAreaTileCardConfig(hass, area.name, true);
const { lights, climate, covers, media_players, security, others } =
groupedEntities;
const {
lights,
climate,
covers,
media_players,
security,
actions,
others,
} = groupedEntities;
if (lights.length > 0) {
sections.push({
@ -146,6 +153,19 @@ export class AreaViewStrategy extends ReactiveElement {
});
}
if (actions.length > 0) {
sections.push({
type: "grid",
cards: [
computeHeadingCard(
hass.localize("ui.panel.lovelace.strategy.areas.groups.actions"),
AREA_STRATEGY_GROUP_ICONS.actions
),
...actions.map(computeTileCard),
],
});
}
if (others.length > 0) {
sections.push({
type: "grid",

View File

@ -54,6 +54,7 @@ export class AreasOverviewViewStrategy extends ReactiveElement {
...groups.climate,
...groups.media_players,
...groups.security,
...groups.actions,
...groups.others,
];

View File

@ -22,6 +22,7 @@ export const AREA_STRATEGY_GROUPS = [
"covers",
"media_players",
"security",
"actions",
"others",
] as const;
@ -31,6 +32,7 @@ export const AREA_STRATEGY_GROUP_ICONS = {
covers: "mdi:blinds-horizontal",
media_players: "mdi:multimedia",
security: "mdi:security",
actions: "mdi:robot",
others: "mdi:shape",
};
@ -121,6 +123,18 @@ export const getAreaGroupedEntities = (
entity_category: "none",
}),
],
actions: [
generateEntityFilter(hass, {
domain: ["script", "scene"],
area: area,
entity_category: "none",
}),
generateEntityFilter(hass, {
domain: ["automation"],
area: area,
entity_category: "none",
}),
],
others: [
generateEntityFilter(hass, {
domain: "vacuum",
@ -138,7 +152,19 @@ export const getAreaGroupedEntities = (
entity_category: "none",
}),
generateEntityFilter(hass, {
domain: ["switch", "select", "input_boolean", "input_select"],
domain: ["switch", "button", "input_boolean", "input_button"],
area: area,
entity_category: "none",
}),
generateEntityFilter(hass, {
domain: [
"select",
"number",
"input_select",
"input_number",
"counter",
"timer",
],
area: area,
entity_category: "none",
}),

View File

@ -6571,8 +6571,9 @@
"lights": "Lights",
"covers": "Covers",
"climate": "Climate",
"media_players": "Entertainment",
"media_players": "Media players",
"security": "Security",
"actions": "Actions",
"others": "Others"
}
}