mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Leave climate humidity mode if entity stops supporting it (#21423)
* Leave climate humidity mode if entity stops supporting it * check changedProps
This commit is contained in:
parent
f05ddd3fcd
commit
bbb64870a1
@ -6,7 +6,14 @@ import {
|
|||||||
mdiTuneVariant,
|
mdiTuneVariant,
|
||||||
mdiWaterPercent,
|
mdiWaterPercent,
|
||||||
} from "@mdi/js";
|
} from "@mdi/js";
|
||||||
import { CSSResultGroup, LitElement, css, html, nothing } from "lit";
|
import {
|
||||||
|
CSSResultGroup,
|
||||||
|
LitElement,
|
||||||
|
PropertyValues,
|
||||||
|
css,
|
||||||
|
html,
|
||||||
|
nothing,
|
||||||
|
} from "lit";
|
||||||
import { property, state } from "lit/decorators";
|
import { property, state } from "lit/decorators";
|
||||||
import { stopPropagation } from "../../../common/dom/stop_propagation";
|
import { stopPropagation } from "../../../common/dom/stop_propagation";
|
||||||
import { supportsFeature } from "../../../common/entity/supports-feature";
|
import { supportsFeature } from "../../../common/entity/supports-feature";
|
||||||
@ -39,6 +46,17 @@ class MoreInfoClimate extends LitElement {
|
|||||||
|
|
||||||
@state() private _mainControl: MainControl = "temperature";
|
@state() private _mainControl: MainControl = "temperature";
|
||||||
|
|
||||||
|
protected willUpdate(changedProps: PropertyValues): void {
|
||||||
|
if (
|
||||||
|
changedProps.has("stateObj") &&
|
||||||
|
this.stateObj &&
|
||||||
|
this._mainControl === "humidity" &&
|
||||||
|
!supportsFeature(this.stateObj, ClimateEntityFeature.TARGET_HUMIDITY)
|
||||||
|
) {
|
||||||
|
this._mainControl = "temperature";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
if (!this.stateObj) {
|
if (!this.stateObj) {
|
||||||
return nothing;
|
return nothing;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user