mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Add support for displaying time listeners (#7220)
This commit is contained in:
parent
eec4a91ad8
commit
9f41f80a91
@ -9,6 +9,7 @@ interface TemplateListeners {
|
||||
all: boolean;
|
||||
domains: string[];
|
||||
entities: string[];
|
||||
time: boolean;
|
||||
}
|
||||
|
||||
export const subscribeRenderTemplate = (
|
||||
|
@ -151,6 +151,15 @@ class HaPanelDevTemplate extends LitElement {
|
||||
class="rendered ${classMap({ error: Boolean(this._error) })}"
|
||||
><!-- display: block -->${this._error}${this._templateResult
|
||||
?.result}</pre>
|
||||
${this._templateResult?.listeners.time
|
||||
? html`
|
||||
<h3>
|
||||
${this.hass.localize(
|
||||
"ui.panel.developer-tools.tabs.templates.time"
|
||||
)}
|
||||
</h3>
|
||||
`
|
||||
: ""}
|
||||
${!this._templateResult?.listeners
|
||||
? ""
|
||||
: this._templateResult.listeners.all
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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:",
|
||||
|
Loading…
x
Reference in New Issue
Block a user