From a9d221147fad8f639bfdff060ab426dd6e5c06c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20W?= Date: Sat, 6 Jul 2019 00:22:29 +0200 Subject: [PATCH] Fix timer stops updating when changing views in LL (#3248) * Fix timer stops updating when changing views in LL * Test if _config exists in connectedCallback() * Update hui-timer-entity-row.ts --- .../lovelace/entity-rows/hui-timer-entity-row.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts b/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts index cd46bccae8..05508ad130 100644 --- a/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts @@ -40,6 +40,16 @@ class HuiTimerEntityRow extends LitElement { this._clearInterval(); } + public connectedCallback(): void { + super.connectedCallback(); + if (this._config && this._config.entity) { + const stateObj = this.hass!.states[this._config!.entity]; + if (stateObj) { + this._startInterval(stateObj); + } + } + } + protected render(): TemplateResult | void { if (!this._config || !this.hass) { return html``;