From ca325020d7be70a1beeb0b9390d9e841716abf3f Mon Sep 17 00:00:00 2001 From: Marcin Bauer Date: Thu, 15 Jan 2026 12:09:11 +0100 Subject: [PATCH] Add Labs feature note to automation element picker (#28874) Co-authored-by: Wendelin Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com> --- .../add-automation-element-dialog.ts | 23 +++++++++++++++++-- .../ha-automation-add-items.ts | 21 +++++++++++++++-- src/translations/en.json | 2 ++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/panels/config/automation/add-automation-element-dialog.ts b/src/panels/config/automation/add-automation-element-dialog.ts index 382ce6c8a4..5d0db1d5b4 100644 --- a/src/panels/config/automation/add-automation-element-dialog.ts +++ b/src/panels/config/automation/add-automation-element-dialog.ts @@ -436,6 +436,24 @@ class DialogAddAutomationElement // #region render + private _getEmptyNote(automationElementType: string) { + if ( + automationElementType !== "trigger" && + automationElementType !== "condition" + ) { + return undefined; + } + + return this.hass.localize( + `ui.panel.config.automation.editor.${automationElementType}s.no_items_for_target_note`, + { + labs_link: html`${this.hass.localize("ui.panel.config.labs.caption")}`, + } + ); + } + protected render() { if (!this._params) { return nothing; @@ -701,6 +719,7 @@ class DialogAddAutomationElement .emptyLabel=${this.hass.localize( `ui.panel.config.automation.editor.${automationElementType}s.no_items_for_target` )} + .emptyNote=${this._getEmptyNote(automationElementType)} .tooltipDescription=${this._tab === "targets"} .target=${(this._tab === "targets" && this._selectedTarget && @@ -1696,9 +1715,9 @@ class DialogAddAutomationElement // #region interaction - private _close() { + private _close = () => { this._open = false; - } + }; private _back() { mainWindow.history.back(); 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 da9b77e45f..e64f33a33f 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 @@ -1,5 +1,5 @@ import { mdiInformationOutline, mdiPlus } from "@mdi/js"; -import { LitElement, css, html, nothing } from "lit"; +import { LitElement, css, html, nothing, type TemplateResult } from "lit"; import { customElement, eventOptions, @@ -39,6 +39,8 @@ export class HaAutomationAddItems extends LitElement { @property({ attribute: "empty-label" }) public emptyLabel!: string; + @property({ attribute: false }) public emptyNote?: string | TemplateResult; + @property({ attribute: false }) public target?: Target; @property({ attribute: false }) public getLabel!: ( @@ -79,6 +81,9 @@ export class HaAutomationAddItems extends LitElement { ? html`${this.emptyLabel} ${this.target ? html`
${this._renderTarget(this.target)}
` + : nothing} + ${this.emptyNote + ? html`
${this.emptyNote}
` : nothing}` : repeat( this.items, @@ -199,6 +204,7 @@ export class HaAutomationAddItems extends LitElement { static styles = css` :host { display: flex; + flex-grow: 1; } :host([scrollable]) .items { overflow: auto; @@ -213,13 +219,24 @@ export class HaAutomationAddItems extends LitElement { background-color: var(--ha-color-surface-default); align-items: center; color: var(--ha-color-text-secondary); - padding: 0; + padding: var(--ha-space-4); margin: 0 var(--ha-space-4) max(var(--safe-area-inset-bottom), var(--ha-space-3)); line-height: var(--ha-line-height-expanded); justify-content: center; } + .empty-note { + color: var(--ha-color-text-secondary); + margin-top: var(--ha-space-2); + text-align: center; + } + + .empty-note a { + color: currentColor; + text-decoration: underline; + } + .items.error { background-color: var(--ha-color-fill-danger-quiet-resting); color: var(--ha-color-on-danger-normal); diff --git a/src/translations/en.json b/src/translations/en.json index 562c976d9d..ce0a9b0a54 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -4162,6 +4162,7 @@ "cut_to_clipboard": "Trigger cut to clipboard", "select": "Select a trigger", "no_items_for_target": "No triggers available for", + "no_items_for_target_note": "This is a {labs_link} feature. More triggers will be added in future updates.", "groups": { "device": { "label": "Device" @@ -4433,6 +4434,7 @@ "cut_to_clipboard": "Condition cut to clipboard", "select": "Select a condition", "no_items_for_target": "No conditions available for", + "no_items_for_target_note": "This is a {labs_link} feature. More conditions will be added in future updates.", "groups": { "device": { "label": "Device"