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