diff --git a/src/components/entity/ha-entity-picker.ts b/src/components/entity/ha-entity-picker.ts index 88353724f2..6401b6cd21 100644 --- a/src/components/entity/ha-entity-picker.ts +++ b/src/components/entity/ha-entity-picker.ts @@ -405,9 +405,9 @@ export class HaEntityPicker extends LitElement { this._opened = ev.detail.value; } - private _valueChanged(ev: ValueChangedEvent) { + private _valueChanged(ev: ValueChangedEvent) { ev.stopPropagation(); - const newValue = ev.detail.value.trim(); + const newValue = ev.detail.value?.trim(); if (newValue && newValue.startsWith(CREATE_ID)) { const domain = newValue.substring(CREATE_ID.length); @@ -433,7 +433,7 @@ export class HaEntityPicker extends LitElement { : this._states; } - private _setValue(value: string) { + private _setValue(value: string | undefined) { this.value = value; setTimeout(() => { fireEvent(this, "value-changed", { value });