🚫 render error-entity-row when state not available (#2352)

This commit is contained in:
Ian Richardson 2018-12-18 04:14:55 -06:00 committed by Paulus Schoutsen
parent b78c48ecec
commit 849ed80e78

View File

@ -31,12 +31,22 @@ class HuiClimateEntityRow extends LitElement implements EntityRow {
return html``;
}
const stateObj = this.hass.states[this._config.entity];
if (!stateObj) {
return html`
<hui-error-entity-row
.entity="${this._config.entity}"
></hui-error-entity-row>
`;
}
return html`
${this.renderStyle()}
<hui-generic-entity-row .hass="${this.hass}" .config="${this._config}">
<ha-climate-state
.hass="${this.hass}"
.stateObj="${this.hass.states[this._config.entity]}"
.stateObj="${stateObj}"
></ha-climate-state>
</hui-generic-entity-row>
`;