Don't disable thermostat when state is unknown (#5720)

This commit is contained in:
Bram Kragten 2020-05-02 17:23:00 +02:00 committed by GitHub
parent 786da25b9f
commit bc68e20041
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,7 @@ import {
compareClimateHvacModes, compareClimateHvacModes,
HvacMode, HvacMode,
} from "../../../data/climate"; } from "../../../data/climate";
import { UNAVAILABLE_STATES } from "../../../data/entity"; import { UNAVAILABLE } from "../../../data/entity";
import { HomeAssistant } from "../../../types"; import { HomeAssistant } from "../../../types";
import { actionHandler } from "../common/directives/action-handler-directive"; import { actionHandler } from "../common/directives/action-handler-directive";
import { findEntities } from "../common/find-entites"; import { findEntities } from "../common/find-entites";
@ -125,7 +125,8 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
? stateObj.attributes.temperature ? stateObj.attributes.temperature
: stateObj.attributes.min_temp; : stateObj.attributes.min_temp;
const slider = UNAVAILABLE_STATES.includes(stateObj.state) const slider =
stateObj.state === UNAVAILABLE
? html` <round-slider disabled="true"></round-slider> ` ? html` <round-slider disabled="true"></round-slider> `
: html` : html`
<round-slider <round-slider
@ -322,7 +323,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
} }
private _getSetTemp(stateObj: HassEntity) { private _getSetTemp(stateObj: HassEntity) {
if (UNAVAILABLE_STATES.includes(stateObj.state)) { if (stateObj.state === UNAVAILABLE) {
return this.hass!.localize("state.default.unavailable"); return this.hass!.localize("state.default.unavailable");
} }