From c5642c15b8d62c6b55081253e018028e5a45ef79 Mon Sep 17 00:00:00 2001 From: Wendelin <12148533+wendevlin@users.noreply.github.com> Date: Tue, 2 Dec 2025 15:17:55 +0100 Subject: [PATCH] Automation add TCA: fix narrow subtitles & icons (#28291) --- .../add-automation-element-dialog.ts | 35 ++++++++++++------- .../ha-automation-add-items.ts | 2 +- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index 527a5038f1..fa666bb444 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -726,15 +726,26 @@ class DialogAddAutomationElement ); if (targetId) { - if (targetType === "area" && this.hass.areas[targetId]?.floor_id) { - const floorId = this.hass.areas[targetId].floor_id; - subtitle = computeFloorName(this.hass.floors[floorId]) || floorId; - } - if (targetType === "device" && this.hass.devices[targetId]?.area_id) { - const areaId = this.hass.devices[targetId].area_id; - subtitle = computeAreaName(this.hass.areas[areaId]) || areaId; - } - if (targetType === "entity" && this.hass.states[targetId]) { + if (targetType === "area") { + const floorId = this.hass.areas[targetId]?.floor_id; + if (floorId) { + subtitle = computeFloorName(this.hass.floors[floorId]) || floorId; + } else { + subtitle = this.hass.localize( + "ui.panel.config.automation.editor.other_areas" + ); + } + } else if (targetType === "device") { + const areaId = this.hass.devices[targetId]?.area_id; + if (areaId) { + subtitle = computeAreaName(this.hass.areas[areaId]) || areaId; + } else { + const device = this.hass.devices[targetId]; + subtitle = this.hass.localize( + `ui.panel.config.automation.editor.${device?.entry_type === "service" ? "services" : "unassigned_devices"}` + ); + } + } else if (targetType === "entity" && this.hass.states[targetId]) { const entity = this.hass.entities[targetId]; if (entity && !entity.device_id && !entity.area_id) { const domain = targetId.split(".", 2)[0]; @@ -759,10 +770,10 @@ class DialogAddAutomationElement .join(computeRTL(this.hass) ? " ◂ " : " ▸ "); } } - } - if (subtitle) { - return html`${subtitle}`; + if (subtitle) { + return html`${subtitle}`; + } } } diff --git a/src/panels/config/automation/add-automation-element/ha-automation-add-items.ts b/src/panels/config/automation/add-automation-element/ha-automation-add-items.ts index 51657ff86c..acaac01b1d 100644 --- a/src/panels/config/automation/add-automation-element/ha-automation-add-items.ts +++ b/src/panels/config/automation/add-automation-element/ha-automation-add-items.ts @@ -372,7 +372,7 @@ export class HaAutomationAddItems extends LitElement { .selected-target ha-floor-icon { display: flex; height: 32px; - width: 24px; + width: 32px; align-items: center; } .selected-target ha-domain-icon {