From 4992007f1393e7d21a520e1192f01d6c5a3acf00 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 10 Aug 2023 14:12:07 +0200 Subject: [PATCH] Drop aux heat from more info climate (#17541) --- .../more-info/controls/more-info-climate.ts | 120 ++---------------- 1 file changed, 14 insertions(+), 106 deletions(-) diff --git a/src/dialogs/more-info/controls/more-info-climate.ts b/src/dialogs/more-info/controls/more-info-climate.ts index fd5769fba0..05323b45c8 100644 --- a/src/dialogs/more-info/controls/more-info-climate.ts +++ b/src/dialogs/more-info/controls/more-info-climate.ts @@ -15,14 +15,8 @@ import { nothing, } from "lit"; import { property, state } from "lit/decorators"; -import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../../../common/dom/fire_event"; import { stopPropagation } from "../../../common/dom/stop_propagation"; -import { - computeAttributeNameDisplay, - computeAttributeValueDisplay, -} from "../../../common/entity/compute_attribute_display"; -import { computeStateDisplay } from "../../../common/entity/compute_state_display"; import { supportsFeature } from "../../../common/entity/supports-feature"; import { formatNumber } from "../../../common/number/format_number"; import { blankBeforePercent } from "../../../common/translations/blank_before_percent"; @@ -43,11 +37,11 @@ import { computeSwingModeIcon, } from "../../../data/climate"; import { UNAVAILABLE } from "../../../data/entity"; +import { haOscillating } from "../../../data/icons/haOscillating"; import { HomeAssistant } from "../../../types"; import "../components/climate/ha-more-info-climate-humidity"; import "../components/climate/ha-more-info-climate-temperature"; import { moreInfoControlStyle } from "../components/ha-more-info-control-style"; -import { haOscillating } from "../../../data/icons/haOscillating"; type MainControl = "temperature" | "humidity"; @@ -68,14 +62,6 @@ class MoreInfoClimate extends LitElement { const hass = this.hass; const stateObj = this.stateObj; - const supportTargetTemperature = supportsFeature( - stateObj, - ClimateEntityFeature.TARGET_TEMPERATURE - ); - const supportTargetTemperatureRange = supportsFeature( - stateObj, - ClimateEntityFeature.TARGET_TEMPERATURE_RANGE - ); const supportTargetHumidity = supportsFeature( stateObj, ClimateEntityFeature.TARGET_HUMIDITY @@ -92,10 +78,6 @@ class MoreInfoClimate extends LitElement { stateObj, ClimateEntityFeature.SWING_MODE ); - const supportAuxHeat = supportsFeature( - stateObj, - ClimateEntityFeature.AUX_HEAT - ); const currentTemperature = this.stateObj.attributes.current_temperature; const currentHumidity = this.stateObj.attributes.current_humidity; @@ -106,10 +88,8 @@ class MoreInfoClimate extends LitElement { ? html`

- ${computeAttributeNameDisplay( - this.hass.localize, + ${this.hass.formatEntityAttributeName( this.stateObj, - this.hass.entities, "current_temperature" )}

@@ -124,10 +104,8 @@ class MoreInfoClimate extends LitElement { ? html`

- ${computeAttributeNameDisplay( - this.hass.localize, + ${this.hass.formatEntityAttributeName( this.stateObj, - this.hass.entities, "current_humidity" )}

@@ -194,7 +172,7 @@ class MoreInfoClimate extends LitElement { .value=${stateObj.state} fixedMenuPosition naturalMenuWidth - @selected=${this._handleOperationmodeChanged} + @selected=${this._handleOperationModeChanged} @closed=${stopPropagation} > - ${computeStateDisplay( - hass.localize, - stateObj, - hass.locale, - this.hass.config, - hass.entities, - mode - )} + ${this.hass.formatEntityState(stateObj, mode)} ` )} @@ -227,10 +198,8 @@ class MoreInfoClimate extends LitElement { ${supportPresetMode && stateObj.attributes.preset_modes ? html` - ${computeAttributeValueDisplay( - hass.localize, + ${this.hass.formatEntityAttributeValue( stateObj, - hass.locale, - hass.config, - hass.entities, "preset_mode", mode )} @@ -270,16 +235,14 @@ class MoreInfoClimate extends LitElement { ${supportFanMode && stateObj.attributes.fan_modes ? html` - ${computeAttributeValueDisplay( - hass.localize, + ${this.hass.formatEntityAttributeValue( stateObj, - hass.locale, - this.hass.config, - hass.entities, "fan_mode", mode )} @@ -313,10 +272,8 @@ class MoreInfoClimate extends LitElement { ${supportSwingMode && stateObj.attributes.swing_modes ? html` - ${computeAttributeValueDisplay( - hass.localize, + ${this.hass.formatEntityAttributeValue( stateObj, - hass.locale, - this.hass.config, - hass.entities, "swing_mode", mode )} @@ -355,41 +308,6 @@ class MoreInfoClimate extends LitElement { : nothing}
-
- ${supportAuxHeat - ? html` -
-
-
- ${computeAttributeNameDisplay( - hass.localize, - stateObj, - hass.entities, - "aux_heat" - )} -
- -
-
- ` - : ""} -
`; } @@ -413,17 +331,7 @@ class MoreInfoClimate extends LitElement { this._mainControl = ev.currentTarget.control; } - private _auxToggleChanged(ev) { - const newVal = ev.target.checked; - this._callServiceHelper( - this.stateObj!.attributes.aux_heat === "on", - newVal, - "set_aux_heat", - { aux_heat: newVal } - ); - } - - private _handleFanmodeChanged(ev) { + private _handleFanModeChanged(ev) { const newVal = ev.target.value; this._callServiceHelper( this.stateObj!.attributes.fan_mode, @@ -433,7 +341,7 @@ class MoreInfoClimate extends LitElement { ); } - private _handleOperationmodeChanged(ev) { + private _handleOperationModeChanged(ev) { const newVal = ev.target.value; this._callServiceHelper(this.stateObj!.state, newVal, "set_hvac_mode", { hvac_mode: newVal,