Skip to content

Commit 9814533

Browse files
authored
Add service titles to automation action sidebar (#27831)
* Add service titles to automation action sidebar * Add split limit
1 parent bdb6c68 commit 9814533

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/panels/config/automation/sidebar/ha-automation-sidebar-action.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import "../../../../components/ha-md-divider";
2020
import "../../../../components/ha-md-menu-item";
2121
import { ACTION_BUILDING_BLOCKS } from "../../../../data/action";
2222
import type { ActionSidebarConfig } from "../../../../data/automation";
23-
import type { RepeatAction } from "../../../../data/script";
23+
import { domainToName } from "../../../../data/integration";
24+
import type { RepeatAction, ServiceAction } from "../../../../data/script";
2425
import type { HomeAssistant } from "../../../../types";
2526
import { isMac } from "../../../../util/is_mac";
2627
import type HaAutomationConditionEditor from "../action/ha-automation-action-editor";
@@ -83,11 +84,23 @@ export default class HaAutomationSidebarAction extends LitElement {
8384
"ui.panel.config.automation.editor.actions.action"
8485
);
8586

86-
const title =
87+
let title =
8788
this.hass.localize(
8889
`ui.panel.config.automation.editor.actions.type.${type}.label` as LocalizeKeys
8990
) || type;
9091

92+
if (type === "service" && (actionConfig as ServiceAction).action) {
93+
const [domain, service] = (actionConfig as ServiceAction).action!.split(
94+
".",
95+
2
96+
);
97+
title = `${domainToName(this.hass.localize, domain)}: ${
98+
this.hass.localize(`component.${domain}.services.${service}.name`) ||
99+
this.hass.services[domain][service]?.name ||
100+
title
101+
}`;
102+
}
103+
91104
const description = isBuildingBlock
92105
? this.hass.localize(
93106
`ui.panel.config.automation.editor.actions.type.${type}.description.picker` as LocalizeKeys

0 commit comments

Comments
 (0)