diff --git a/src/data/ws-templates.ts b/src/data/ws-templates.ts index ace9115578..6d65e6ccbb 100644 --- a/src/data/ws-templates.ts +++ b/src/data/ws-templates.ts @@ -9,6 +9,7 @@ interface TemplateListeners { all: boolean; domains: string[]; entities: string[]; + time: boolean; } export const subscribeRenderTemplate = ( diff --git a/src/panels/developer-tools/template/developer-tools-template.ts b/src/panels/developer-tools/template/developer-tools-template.ts index 6f628c32df..8cfdcb5a95 100644 --- a/src/panels/developer-tools/template/developer-tools-template.ts +++ b/src/panels/developer-tools/template/developer-tools-template.ts @@ -151,6 +151,15 @@ class HaPanelDevTemplate extends LitElement { class="rendered ${classMap({ error: Boolean(this._error) })}" >${this._error}${this._templateResult ?.result} + ${this._templateResult?.listeners.time + ? html` +

+ ${this.hass.localize( + "ui.panel.developer-tools.tabs.templates.time" + )} +

+ ` + : ""} ${!this._templateResult?.listeners ? "" : this._templateResult.listeners.all diff --git a/src/panels/lovelace/cards/hui-markdown-card.ts b/src/panels/lovelace/cards/hui-markdown-card.ts index ba2aa6f901..3c7a361909 100644 --- a/src/panels/lovelace/cards/hui-markdown-card.ts +++ b/src/panels/lovelace/cards/hui-markdown-card.ts @@ -144,7 +144,7 @@ export class HuiMarkdownCard extends LitElement implements LovelaceCard { } catch (_err) { this._templateResult = { result: this._config!.content, - listeners: { all: false, domains: [], entities: [] }, + listeners: { all: false, domains: [], entities: [], time: false }, }; this._unsubRenderTemplate = undefined; } diff --git a/src/translations/en.json b/src/translations/en.json index 1885072109..3851273f9b 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2949,6 +2949,7 @@ "jinja_documentation": "Jinja2 template documentation", "template_extensions": "Home Assistant template extensions", "unknown_error_template": "Unknown error rendering template", + "time": "This template updates every 60 seconds after the last state changed event.", "all_listeners": "This template listens for all state changed events.", "no_listeners": "This template does not listen for any state changed events and will not update automatically.", "listeners": "This template listens for the following state changed events:",