diff --git a/pyproject.toml b/pyproject.toml index 6267bdc101..afea7e45d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20231208.1" +version = "20231208.2" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" diff --git a/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts index 5b13039385..4477359e1d 100644 --- a/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts @@ -1,11 +1,15 @@ +import { mdiThermostat } from "@mdi/js"; import { HassEntity } from "home-assistant-js-websocket"; import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; -import { customElement, property, state } from "lit/decorators"; +import { customElement, property, query, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; +import { stopPropagation } from "../../../common/dom/stop_propagation"; import { computeDomain } from "../../../common/entity/compute_domain"; import { stateColorCss } from "../../../common/entity/state_color"; import "../../../components/ha-control-select"; +import "../../../components/ha-control-select-menu"; import type { ControlSelectOption } from "../../../components/ha-control-select"; +import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; import { ClimateEntity, compareClimateHvacModes, @@ -35,6 +39,9 @@ class HuiClimateHvacModesCardFeature @state() _currentHvacMode?: HvacMode; + @query("ha-control-select-menu", true) + private _haSelect?: HaControlSelectMenu; + static getStubConfig( _, stateObj?: HassEntity @@ -66,8 +73,23 @@ class HuiClimateHvacModesCardFeature } } + protected updated(changedProps: PropertyValues) { + super.updated(changedProps); + if (this._haSelect && changedProps.has("hass")) { + const oldHass = changedProps.get("hass") as HomeAssistant | undefined; + if ( + this.hass && + this.hass.formatEntityAttributeValue !== + oldHass?.formatEntityAttributeValue + ) { + this._haSelect.layoutOptions(); + } + } + } + private async _valueChanged(ev: CustomEvent) { - const mode = (ev.detail as any).value as HvacMode; + const mode = + (ev.detail as any).value ?? ((ev.target as any).value as HvacMode); if (mode === this.stateObj!.state) return; @@ -111,6 +133,37 @@ class HuiClimateHvacModesCardFeature path: computeHvacModeIcon(mode), })); + if (this._config.style === "dropdown") { + return html` +
${this.hass.formatEntityState(this.stateObj)}
+ `; + } + return html`${this.hass.localize("ui.card.climate.humidity_target")} diff --git a/src/state-control/climate/ha-state-control-climate-temperature.ts b/src/state-control/climate/ha-state-control-climate-temperature.ts index 755b0ce6ab..0975b1bd99 100644 --- a/src/state-control/climate/ha-state-control-climate-temperature.ts +++ b/src/state-control/climate/ha-state-control-climate-temperature.ts @@ -164,14 +164,17 @@ export class HaStateControlClimateTemperature extends LitElement { } if ( - !supportsFeature( + (!supportsFeature( this.stateObj, ClimateEntityFeature.TARGET_TEMPERATURE - ) && - !supportsFeature( + ) || + this._targetTemperature.value === null) && + (!supportsFeature( this.stateObj, ClimateEntityFeature.TARGET_TEMPERATURE_RANGE - ) + ) || + this._targetTemperature.low === null || + this._targetTemperature.high === null) ) { return html`
${this.hass.formatEntityState(this.stateObj)}
diff --git a/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts b/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts index 9f9bf92605..648753ab66 100644 --- a/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts +++ b/src/state-control/humidifier/ha-state-control-humidifier-humidity.ts @@ -110,7 +110,9 @@ export class HaStateControlHumidifierHumidity extends LitElement {${action && action !== "off" && action !== "idle" ? actionLabel - : this.hass.localize("ui.card.humidifier.target")} + : this._targetHumidity + ? this.hass.localize("ui.card.humidifier.target") + : this.hass.formatEntityState(this.stateObj)}
`; } diff --git a/src/state-control/water_heater/ha-state-control-water_heater-temperature.ts b/src/state-control/water_heater/ha-state-control-water_heater-temperature.ts index bbcd5cdaad..4e52499618 100644 --- a/src/state-control/water_heater/ha-state-control-water_heater-temperature.ts +++ b/src/state-control/water_heater/ha-state-control-water_heater-temperature.ts @@ -107,7 +107,8 @@ export class HaStateControlWaterHeaterTemperature extends LitElement { !supportsFeature( this.stateObj, WaterHeaterEntityFeature.TARGET_TEMPERATURE - ) + ) || + !this._targetTemperature ) { return html`${this.hass.formatEntityState(this.stateObj)}
diff --git a/src/translations/en.json b/src/translations/en.json index 41ed918e23..af46f7f134 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -5280,7 +5280,12 @@ }, "climate-hvac-modes": { "label": "Climate HVAC modes", - "hvac_modes": "HVAC modes" + "hvac_modes": "HVAC modes", + "style": "[%key:ui::panel::lovelace::editor::features::types::climate-preset-modes::style%]", + "style_list": { + "dropdown": "[%key:ui::panel::lovelace::editor::features::types::climate-preset-modes::style_list::dropdown%]", + "icons": "[%key:ui::panel::lovelace::editor::features::types::climate-preset-modes::style_list::icons%]" + } }, "climate-preset-modes": { "label": "Climate preset modes",