diff --git a/src/dialogs/more-info/controls/more-info-fan.ts b/src/dialogs/more-info/controls/more-info-fan.ts index 96a3826cb5..8547df3846 100644 --- a/src/dialogs/more-info/controls/more-info-fan.ts +++ b/src/dialogs/more-info/controls/more-info-fan.ts @@ -11,7 +11,6 @@ import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { stateActive } from "../../../common/entity/state_active"; import { supportsFeature } from "../../../common/entity/supports-feature"; -import "../../../components/ha-attributes"; import "../../../components/ha-control-select-menu"; import "../../../components/ha-list-item"; import "../../../components/ha-outlined-icon-button"; diff --git a/src/dialogs/more-info/controls/more-info-light.ts b/src/dialogs/more-info/controls/more-info-light.ts index 8e2bc1342a..666d0f367b 100644 --- a/src/dialogs/more-info/controls/more-info-light.ts +++ b/src/dialogs/more-info/controls/more-info-light.ts @@ -8,35 +8,30 @@ import { mdiPower, } from "@mdi/js"; import { - css, CSSResultGroup, - html, LitElement, - nothing, PropertyValues, + css, + html, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; -import { - computeAttributeNameDisplay, - computeAttributeValueDisplay, -} from "../../../common/entity/compute_attribute_display"; import { supportsFeature } from "../../../common/entity/supports-feature"; import { blankBeforePercent } from "../../../common/translations/blank_before_percent"; import "../../../components/ha-attributes"; -import "../../../components/ha-button-menu"; +import "../../../components/ha-control-select-menu"; import "../../../components/ha-icon-button-group"; import "../../../components/ha-icon-button-toggle"; -import "../../../components/ha-outlined-button"; -import "../../../components/ha-select"; +import "../../../components/ha-list-item"; import { UNAVAILABLE } from "../../../data/entity"; import { ExtEntityRegistryEntry } from "../../../data/entity_registry"; import { forwardHaptic } from "../../../data/haptics"; import { - formatTempColor, LightColorMode, LightEntity, LightEntityFeature, + formatTempColor, lightSupportsBrightness, lightSupportsColor, lightSupportsColorMode, @@ -287,64 +282,46 @@ class MoreInfoLight extends LitElement { : nothing} ` : nothing} - ${supportsEffects && this.stateObj.attributes.effect_list - ? html` - - - - ${this._effect - ? computeAttributeValueDisplay( - this.hass.localize, - this.stateObj!, - this.hass.locale, - this.hass.config, - this.hass.entities, - "effect", - this._effect - ) - : computeAttributeNameDisplay( - this.hass.localize, - this.stateObj, - this.hass.entities, - "effect" - )} - - ${this.stateObj.attributes.effect_list.map( - (effect: string) => html` - - ${computeAttributeValueDisplay( - this.hass.localize, - this.stateObj!, - this.hass.locale, - this.hass.config, - this.hass.entities, - "effect", - effect - )} - - ` - )} - - ` - : nothing} - - +
+
+
+ ${supportsEffects && this.stateObj.attributes.effect_list + ? html` + + + ${this.stateObj.attributes.effect_list?.map( + (mode) => html` + + ${this.hass.formatEntityAttributeValue( + this.stateObj!, + "effect", + mode + )} + + ` + )} + + ` + : nothing} +
+
+ +
`; } @@ -363,12 +340,8 @@ class MoreInfoLight extends LitElement { }); }; - private _handleEffectButton(ev) { - ev.stopPropagation(); - ev.preventDefault(); - - const index = ev.detail.index; - const newVal = this.stateObj!.attributes.effect_list![index]; + private _handleEffect(ev) { + const newVal = ev.target.value; const oldVal = this._effect; if (!newVal || oldVal === newVal) return;