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`