diff --git a/src/components/entity/ha-entity-state-picker.ts b/src/components/entity/ha-entity-state-picker.ts index 21f83ae948..98b5640b67 100644 --- a/src/components/entity/ha-entity-state-picker.ts +++ b/src/components/entity/ha-entity-state-picker.ts @@ -8,6 +8,7 @@ import { HomeAssistant } from "../../types"; import "../ha-combo-box"; import type { HaComboBox } from "../ha-combo-box"; import { formatAttributeValue } from "../../data/entity_attributes"; +import { fireEvent } from "../../common/dom/fire_event"; export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean; @@ -70,7 +71,7 @@ class HaEntityStatePicker extends LitElement { return html` ) { this._opened = ev.detail.value; } private _valueChanged(ev: PolymerChangedEvent) { - this.value = ev.detail.value; + ev.stopPropagation(); + const newValue = ev.detail.value; + if (newValue !== this._value) { + this._setValue(newValue); + } + } + + private _setValue(value: string) { + this.value = value; + setTimeout(() => { + fireEvent(this, "value-changed", { value }); + fireEvent(this, "change"); + }, 0); } }