This commit is contained in:
Paulus Schoutsen 2022-03-12 11:56:25 -08:00 committed by GitHub
parent a993d3a753
commit fad8a27232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 21 deletions

View File

@ -108,7 +108,7 @@
"fuse.js": "^6.0.0",
"google-timezones-json": "^1.0.2",
"hls.js": "^1.1.5",
"home-assistant-js-websocket": "^6.0.1",
"home-assistant-js-websocket": "^6.1.1",
"idb-keyval": "^5.1.3",
"intl-messageformat": "^9.9.1",
"js-yaml": "^4.1.0",

View File

@ -15,11 +15,14 @@ import "../ha-icon-button";
import "../ha-svg-icon";
import "./state-badge";
interface HassEntityWithCachedName extends HassEntity {
friendly_name: string;
}
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
// eslint-disable-next-line lit/prefer-static-styles
const rowRenderer: ComboBoxLitRenderer<HassEntity & { friendly_name: string }> =
(item) =>
const rowRenderer: ComboBoxLitRenderer<HassEntityWithCachedName> = (item) =>
html`<mwc-list-item graphic="avatar" .twoline=${!!item.entity_id}>
${item.state
? html`<state-badge slot="graphic" .stateObj=${item}></state-badge>`
@ -96,7 +99,7 @@ export class HaEntityPicker extends LitElement {
private _initedStates = false;
private _states: HassEntity[] = [];
private _states: HassEntityWithCachedName[] = [];
private _getStates = memoizeOne(
(
@ -107,8 +110,8 @@ export class HaEntityPicker extends LitElement {
entityFilter: this["entityFilter"],
includeDeviceClasses: this["includeDeviceClasses"],
includeUnitOfMeasurement: this["includeUnitOfMeasurement"]
) => {
let states: HassEntity[] = [];
): HassEntityWithCachedName[] => {
let states: HassEntityWithCachedName[] = [];
if (!hass) {
return [];
@ -122,7 +125,7 @@ export class HaEntityPicker extends LitElement {
state: "",
last_changed: "",
last_updated: "",
context: { id: "", user_id: null },
context: { id: "", user_id: null, parent_id: null },
friendly_name: this.hass!.localize(
"ui.components.entity.entity-picker.no_entities"
),
@ -190,7 +193,7 @@ export class HaEntityPicker extends LitElement {
state: "",
last_changed: "",
last_updated: "",
context: { id: "", user_id: null },
context: { id: "", user_id: null, parent_id: null },
friendly_name: this.hass!.localize(
"ui.components.entity.entity-picker.no_match"
),

View File

@ -84,7 +84,7 @@ export class BrowserMediaPlayer {
last_changed: now,
last_updated: now,
attributes: {},
context: { id: "", user_id: null },
context: { id: "", user_id: null, parent_id: null },
};
}

View File

@ -9128,7 +9128,7 @@ fsevents@^1.2.7:
gulp-rename: ^2.0.0
gulp-zopfli-green: ^3.0.1
hls.js: ^1.1.5
home-assistant-js-websocket: ^6.0.1
home-assistant-js-websocket: ^6.1.1
html-minifier: ^4.0.0
husky: ^1.3.1
idb-keyval: ^5.1.3
@ -9198,10 +9198,10 @@ fsevents@^1.2.7:
languageName: unknown
linkType: soft
"home-assistant-js-websocket@npm:^6.0.1":
version: 6.0.1
resolution: "home-assistant-js-websocket@npm:6.0.1"
checksum: 566d6de6a4eb0e05ca434a45433cfe6fdd6b5cb2008e9a165709e08335df1c9b70903564c479ab8d48c6f5468a9784f47697192f9023170d2d86d43a461d6126
"home-assistant-js-websocket@npm:^6.1.1":
version: 6.1.1
resolution: "home-assistant-js-websocket@npm:6.1.1"
checksum: b46dd44ac1b393ecfdda152743fe44dcd6534463d1df631c448a71e71166c04d4fea2a0827dbb2e55c85fcd8d9ccdea4f168713bf18e832c7f688b9b2fdc8d72
languageName: node
linkType: hard