mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Don't disable thermostat when state is unknown (#5720)
This commit is contained in:
parent
786da25b9f
commit
bc68e20041
@ -24,7 +24,7 @@ import {
|
||||
compareClimateHvacModes,
|
||||
HvacMode,
|
||||
} from "../../../data/climate";
|
||||
import { UNAVAILABLE_STATES } from "../../../data/entity";
|
||||
import { UNAVAILABLE } from "../../../data/entity";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
import { actionHandler } from "../common/directives/action-handler-directive";
|
||||
import { findEntities } from "../common/find-entites";
|
||||
@ -125,20 +125,21 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
||||
? stateObj.attributes.temperature
|
||||
: stateObj.attributes.min_temp;
|
||||
|
||||
const slider = UNAVAILABLE_STATES.includes(stateObj.state)
|
||||
? html` <round-slider disabled="true"></round-slider> `
|
||||
: html`
|
||||
<round-slider
|
||||
.value=${targetTemp}
|
||||
.low=${stateObj.attributes.target_temp_low}
|
||||
.high=${stateObj.attributes.target_temp_high}
|
||||
.min=${stateObj.attributes.min_temp}
|
||||
.max=${stateObj.attributes.max_temp}
|
||||
.step=${this._stepSize}
|
||||
@value-changing=${this._dragEvent}
|
||||
@value-changed=${this._setTemperature}
|
||||
></round-slider>
|
||||
`;
|
||||
const slider =
|
||||
stateObj.state === UNAVAILABLE
|
||||
? html` <round-slider disabled="true"></round-slider> `
|
||||
: html`
|
||||
<round-slider
|
||||
.value=${targetTemp}
|
||||
.low=${stateObj.attributes.target_temp_low}
|
||||
.high=${stateObj.attributes.target_temp_high}
|
||||
.min=${stateObj.attributes.min_temp}
|
||||
.max=${stateObj.attributes.max_temp}
|
||||
.step=${this._stepSize}
|
||||
@value-changing=${this._dragEvent}
|
||||
@value-changed=${this._setTemperature}
|
||||
></round-slider>
|
||||
`;
|
||||
|
||||
const currentTemperature = !isNaN(stateObj.attributes.current_temperature)
|
||||
? svg`
|
||||
@ -322,7 +323,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
|
||||
}
|
||||
|
||||
private _getSetTemp(stateObj: HassEntity) {
|
||||
if (UNAVAILABLE_STATES.includes(stateObj.state)) {
|
||||
if (stateObj.state === UNAVAILABLE) {
|
||||
return this.hass!.localize("state.default.unavailable");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user