mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 20:36:35 +00:00
Fix state picker (#13644)
This commit is contained in:
parent
7acf3a049e
commit
fd431f36f7
@ -239,10 +239,13 @@ export const getStates = (
|
||||
}
|
||||
break;
|
||||
case "light":
|
||||
if (attribute === "effect") {
|
||||
if (attribute === "effect" && state.attributes.effect_list) {
|
||||
result.push(...state.attributes.effect_list);
|
||||
} else if (attribute === "color_mode") {
|
||||
result.push(...state.attributes.color_modes);
|
||||
} else if (
|
||||
attribute === "color_mode" &&
|
||||
state.attributes.supported_color_modes
|
||||
) {
|
||||
result.push(...state.attributes.supported_color_modes);
|
||||
}
|
||||
break;
|
||||
case "media_player":
|
||||
|
@ -7,6 +7,7 @@ import { getStates } from "../../common/entity/get_states";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import "../ha-combo-box";
|
||||
import type { HaComboBox } from "../ha-combo-box";
|
||||
import { formatAttributeValue } from "../../data/entity_attributes";
|
||||
|
||||
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
|
||||
|
||||
@ -55,7 +56,7 @@ class HaEntityStatePicker extends LitElement {
|
||||
this.hass.locale,
|
||||
key
|
||||
)
|
||||
: key,
|
||||
: formatAttributeValue(this.hass, key),
|
||||
}))
|
||||
: [];
|
||||
}
|
||||
@ -69,16 +70,7 @@ class HaEntityStatePicker extends LitElement {
|
||||
return html`
|
||||
<ha-combo-box
|
||||
.hass=${this.hass}
|
||||
.value=${this.value
|
||||
? this.entityId && this.hass.states[this.entityId]
|
||||
? computeStateDisplay(
|
||||
this.hass.localize,
|
||||
this.hass.states[this.entityId],
|
||||
this.hass.locale,
|
||||
this.value
|
||||
)
|
||||
: this.value
|
||||
: ""}
|
||||
.value=${this.value}
|
||||
.autofocus=${this.autofocus}
|
||||
.label=${this.label ??
|
||||
this.hass.localize("ui.components.entity.entity-state-picker.state")}
|
||||
|
Loading…
x
Reference in New Issue
Block a user