Skip to content

Commit

Permalink
Use heat or cool slider mode for auto if there is only one mode (home…
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Aug 31, 2023
1 parent dfbaee1 commit fa788a8
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,21 @@ export class HaMoreInfoClimateTemperature extends LitElement {
);
}

const activeModes = this.stateObj.attributes.hvac_modes.filter(
(m) => m !== "off"
);

if (
supportsTargetTemperature &&
this._targetTemperature.value != null &&
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`
<div
class="container"
Expand All @@ -299,9 +305,7 @@ export class HaMoreInfoClimateTemperature extends LitElement {
>
<ha-control-circular-slider
.inactive=${!active}
.mode=${mode === "off" && activeModes.length === 1
? SLIDER_MODES[activeModes[0]]
: SLIDER_MODES[mode]}
.mode=${sliderMode}
.value=${this._targetTemperature.value}
.min=${this._min}
.max=${this._max}
Expand Down

0 comments on commit fa788a8

Please sign in to comment.