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
This commit is contained in:
Jérôme W 2019-07-06 00:22:29 +02:00 committed by Paulus Schoutsen
parent 4fdbec93b3
commit a9d221147f

View File

@ -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``;