From 498d933c06bd5f1a6ab8e547703bab23eb09e090 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Tue, 29 Apr 2025 14:14:38 +0200 Subject: [PATCH] Add message in picker when no entities found --- src/components/entity/ha-entity-combo-box.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/entity/ha-entity-combo-box.ts b/src/components/entity/ha-entity-combo-box.ts index 8deb6abc29..92ad0b72a7 100644 --- a/src/components/entity/ha-entity-combo-box.ts +++ b/src/components/entity/ha-entity-combo-box.ts @@ -499,7 +499,20 @@ export class HaEntityComboBox extends LitElement { const results = fuse.multiTermsSearch(filterString); if (results) { - target.filteredItems = results.map((result) => result.item); + if (results.length === 0) { + target.filteredItems = [ + { + ...FAKE_ENTITY, + label: "", + primary: this.hass!.localize( + "ui.components.entity.entity-picker.no_match" + ), + icon_path: mdiMagnify, + }, + ] as EntityComboBoxItem[]; + } else { + target.filteredItems = results.map((result) => result.item); + } } else { target.filteredItems = this._items; }