diff --git a/src/components/live.ts b/src/components/live.ts index ab32b155..0b895dfe 100644 --- a/src/components/live.ts +++ b/src/components/live.ts @@ -139,14 +139,18 @@ export class FrigateCardLive extends LitElement { return; } - // Note use of liveConfig and not config below -- the carousel will - // independently override the liveconfig to reflect the camera in the - // carousel (not necessarily the selected camera). + // Notes: + // - See use of liveConfig and not config below -- the carousel will + // independently override the liveConfig to reflect the camera in the + // carousel (not necessarily the selected camera). + // - Fetching of thumbnails is disabled as long as live view is the + // background (preloaded) rather than foreground (not preloaded). return html` [ - this.hass, this.view, this.browseMediaParams, + this.fetch, ]); /** @@ -51,25 +53,25 @@ export class FrigateCardSurround extends LitElement { * @param param Task parameters. * @returns */ - protected async _fetchMedia([hass, view, browseMediaParams]: ( - | HomeAssistant + protected async _fetchMedia([view, browseMediaParams, fetch]: ( | Readonly | BrowseMediaQueryParameters | BrowseMediaQueryParameters[] + | boolean | undefined )[]): Promise { - hass = hass as HomeAssistant; view = view as Readonly; browseMediaParams = browseMediaParams as | BrowseMediaQueryParameters | BrowseMediaQueryParameters[]; + fetch = fetch as boolean; - if (!hass || !view || view.target || !browseMediaParams) { + if (!fetch || !this.hass || !view || view.target || !browseMediaParams) { return; } let parent: FrigateBrowseMediaSource | null; try { - parent = await BrowseMediaUtil.multipleBrowseMediaQueryMerged(hass, browseMediaParams); + parent = await BrowseMediaUtil.multipleBrowseMediaQueryMerged(this.hass, browseMediaParams); } catch (e) { return dispatchErrorMessageEvent(this, (e as Error).message); } diff --git a/src/types.ts b/src/types.ts index f754ab13..0187ce73 100644 --- a/src/types.ts +++ b/src/types.ts @@ -177,9 +177,9 @@ const noActionSchema = schemaForType< ); const frigateCardCustomactionsBaseSchema = customActionSchema.extend({ - // Syntactic sugar to avoid 'fire-dom-event' as part of an external API. action: z .literal('custom:frigate-card-action') + // Syntactic sugar to avoid 'fire-dom-event' as part of an external API. .transform((): 'fire-dom-event' => 'fire-dom-event') .or(z.literal('fire-dom-event')), });