mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Use heat or cool slider mode for auto if there is only one mode (#17748)
This commit is contained in:
parent
dfbaee1649
commit
fa788a8223
@ -280,15 +280,21 @@ export class HaMoreInfoClimateTemperature extends LitElement {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const activeModes = this.stateObj.attributes.hvac_modes.filter(
|
|
||||||
(m) => m !== "off"
|
|
||||||
);
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
supportsTargetTemperature &&
|
supportsTargetTemperature &&
|
||||||
this._targetTemperature.value != null &&
|
this._targetTemperature.value != null &&
|
||||||
this.stateObj.state !== UNAVAILABLE
|
this.stateObj.state !== UNAVAILABLE
|
||||||
) {
|
) {
|
||||||
|
const heatCoolModes = this.stateObj.attributes.hvac_modes.filter((m) =>
|
||||||
|
["heat", "cool", "heat_cool"].includes(m)
|
||||||
|
);
|
||||||
|
const sliderMode =
|
||||||
|
SLIDER_MODES[
|
||||||
|
heatCoolModes.length === 1 && ["off", "auto"].includes(mode)
|
||||||
|
? heatCoolModes[0]
|
||||||
|
: mode
|
||||||
|
];
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div
|
<div
|
||||||
class="container"
|
class="container"
|
||||||
@ -299,9 +305,7 @@ export class HaMoreInfoClimateTemperature extends LitElement {
|
|||||||
>
|
>
|
||||||
<ha-control-circular-slider
|
<ha-control-circular-slider
|
||||||
.inactive=${!active}
|
.inactive=${!active}
|
||||||
.mode=${mode === "off" && activeModes.length === 1
|
.mode=${sliderMode}
|
||||||
? SLIDER_MODES[activeModes[0]]
|
|
||||||
: SLIDER_MODES[mode]}
|
|
||||||
.value=${this._targetTemperature.value}
|
.value=${this._targetTemperature.value}
|
||||||
.min=${this._min}
|
.min=${this._min}
|
||||||
.max=${this._max}
|
.max=${this._max}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user