diff --git a/src/components/ha-control-select-menu.ts b/src/components/ha-control-select-menu.ts
index 40ce91d979..ce119fcba1 100644
--- a/src/components/ha-control-select-menu.ts
+++ b/src/components/ha-control-select-menu.ts
@@ -13,6 +13,10 @@ import { classMap } from "lit/directives/class-map";
import { ifDefined } from "lit/directives/if-defined";
import { debounce } from "../common/util/debounce";
import { nextRender } from "../common/util/render-status";
+import "./ha-icon";
+import type { HaIcon } from "./ha-icon";
+import "./ha-svg-icon";
+import type { HaSvgIcon } from "./ha-svg-icon";
@customElement("ha-control-select-menu")
export class HaControlSelectMenu extends SelectBase {
@@ -66,9 +70,7 @@ export class HaControlSelectMenu extends SelectBase {
@touchend=${this.handleRippleDeactivate}
@touchcancel=${this.handleRippleDeactivate}
>
-
${this.label}
${this.selectedText
@@ -84,6 +86,25 @@ export class HaControlSelectMenu extends SelectBase {
`;
}
+ private renderIcon() {
+ const index = this.mdcFoundation?.getSelectedIndex();
+ const items = this.menuElement?.items ?? [];
+ const item = index != null ? items[index] : undefined;
+ const icon =
+ item?.querySelector("[slot='graphic']") ??
+ (null as HaSvgIcon | HaIcon | null);
+
+ return html`
+
+ ${icon && "path" in icon
+ ? html``
+ : icon && "icon" in icon
+ ? html``
+ : html``}
+
+ `;
+ }
+
protected onFocus() {
this.handleRippleFocus();
super.onFocus();
diff --git a/src/dialogs/more-info/controls/more-info-climate.ts b/src/dialogs/more-info/controls/more-info-climate.ts
index 9be1110210..95c6e37237 100644
--- a/src/dialogs/more-info/controls/more-info-climate.ts
+++ b/src/dialogs/more-info/controls/more-info-climate.ts
@@ -29,7 +29,6 @@ import "../../../components/ha-switch";
import {
ClimateEntity,
ClimateEntityFeature,
- HvacMode,
compareClimateHvacModes,
computeFanModeIcon,
computeHvacModeIcon,
@@ -176,11 +175,7 @@ class MoreInfoClimate extends LitElement {
@selected=${this._handleOperationModeChanged}
@closed=${stopPropagation}
>
-
+
${stateObj.attributes.hvac_modes
.concat()
.sort(compareClimateHvacModes)
@@ -212,9 +207,7 @@ class MoreInfoClimate extends LitElement {
>
${stateObj.attributes.preset_modes!.map(
(mode) => html`
@@ -248,12 +241,7 @@ class MoreInfoClimate extends LitElement {
@selected=${this._handleFanModeChanged}
@closed=${stopPropagation}
>
-
+
${stateObj.attributes.fan_modes!.map(
(mode) => html`
@@ -286,12 +274,7 @@ class MoreInfoClimate extends LitElement {
@selected=${this._handleSwingmodeChanged}
@closed=${stopPropagation}
>
-
+
${stateObj.attributes.swing_modes!.map(
(mode) => html`
diff --git a/src/dialogs/more-info/controls/more-info-fan.ts b/src/dialogs/more-info/controls/more-info-fan.ts
index dea7d2e0a2..dca3fb00dc 100644
--- a/src/dialogs/more-info/controls/more-info-fan.ts
+++ b/src/dialogs/more-info/controls/more-info-fan.ts
@@ -239,12 +239,7 @@ class MoreInfoFan extends LitElement {
@selected=${this._handleDirection}
@closed=${stopPropagation}
>
-
+
${stateObj.attributes.available_modes!.map(
(mode) => html`
@@ -196,6 +193,19 @@ class MoreInfoHumidifier extends LitElement {
);
}
+ private _handleModeChanged(ev) {
+ const newVal = ev.target.value || null;
+ this._mode = newVal;
+ this._callServiceHelper(
+ this.stateObj!.attributes.mode,
+ newVal,
+ "set_mode",
+ {
+ mode: newVal,
+ }
+ );
+ }
+
private async _callServiceHelper(
oldVal: unknown,
newVal: unknown,
@@ -234,23 +244,6 @@ class MoreInfoHumidifier extends LitElement {
}
}
- private _handleModeChanged(ev) {
- ev.stopPropagation();
- ev.preventDefault();
-
- const index = ev.detail.index;
- const newVal = this.stateObj!.attributes.available_modes![index];
- const oldVal = this._mode;
-
- if (!newVal || oldVal === newVal) return;
-
- this._mode = newVal;
- this.hass.callService("humidifier", "set_mode", {
- entity_id: this.stateObj!.entity_id,
- mode: newVal,
- });
- }
-
static get styles(): CSSResultGroup {
return [
moreInfoControlStyle,
diff --git a/src/dialogs/more-info/controls/more-info-water_heater.ts b/src/dialogs/more-info/controls/more-info-water_heater.ts
index 3441d5b41f..f4dec22235 100644
--- a/src/dialogs/more-info/controls/more-info-water_heater.ts
+++ b/src/dialogs/more-info/controls/more-info-water_heater.ts
@@ -7,7 +7,6 @@ import { formatNumber } from "../../../common/number/format_number";
import "../../../components/ha-control-select-menu";
import "../../../components/ha-list-item";
import {
- OperationMode,
WaterHeaterEntity,
WaterHeaterEntityFeature,
compareWaterHeaterOperationMode,
@@ -86,9 +85,7 @@ class MoreInfoWaterHeater extends LitElement {
>
${stateObj.attributes.operation_list
.concat()
@@ -121,12 +118,7 @@ class MoreInfoWaterHeater extends LitElement {
@selected=${this._handleAwayModeChanged}
@closed=${stopPropagation}
>
-
+