diff --git a/cast/src/receiver/layout/hc-lovelace.ts b/cast/src/receiver/layout/hc-lovelace.ts index 89ec9ef2e4..122ce510fd 100644 --- a/cast/src/receiver/layout/hc-lovelace.ts +++ b/cast/src/receiver/layout/hc-lovelace.ts @@ -15,7 +15,7 @@ class HcLovelace extends LitElement { @property() public viewPath?: string | number; - public urlPath?: string | null; + @property() public urlPath: string | null = null; protected render(): TemplateResult { const index = this._viewIndex; @@ -31,7 +31,7 @@ class HcLovelace extends LitElement { config: this.lovelaceConfig, rawConfig: this.lovelaceConfig, editMode: false, - urlPath: this.urlPath!, + urlPath: this.urlPath, enableFullEditMode: () => undefined, mode: "storage", locale: this.hass.locale, diff --git a/cast/src/receiver/layout/hc-main.ts b/cast/src/receiver/layout/hc-main.ts index 207d46bb4a..f74d9089cb 100644 --- a/cast/src/receiver/layout/hc-main.ts +++ b/cast/src/receiver/layout/hc-main.ts @@ -40,9 +40,9 @@ export class HcMain extends HassElement { @state() private _error?: string; - private _unsubLovelace?: UnsubscribeFunc; + @state() private _urlPath?: string | null; - private _urlPath?: string | null; + private _unsubLovelace?: UnsubscribeFunc; public processIncomingMessage(msg: HassMessage) { if (msg.type === "connect") { @@ -68,8 +68,10 @@ export class HcMain extends HassElement { !this._lovelaceConfig || this._lovelacePath === null || // Guard against part of HA not being loaded yet. - (this.hass && - (!this.hass.states || !this.hass.config || !this.hass.services)) + !this.hass || + !this.hass.states || + !this.hass.config || + !this.hass.services ) { return html` undefined; await this._generateLovelaceConfig(); @@ -215,8 +224,6 @@ export class HcMain extends HassElement { loadLovelaceResources(resources, this.hass!.auth.data.hassUrl); } } - this._showDemo = false; - this._lovelacePath = msg.viewPath; this._sendStatus(); } @@ -237,7 +244,7 @@ export class HcMain extends HassElement { } private _handleNewLovelaceConfig(lovelaceConfig: LovelaceConfig) { - castContext.setApplicationState(lovelaceConfig.title!); + castContext.setApplicationState(lovelaceConfig.title || ""); this._lovelaceConfig = lovelaceConfig; } diff --git a/src/components/map/ha-entity-marker.ts b/src/components/map/ha-entity-marker.ts index 946c9597c7..b917c29259 100644 --- a/src/components/map/ha-entity-marker.ts +++ b/src/components/map/ha-entity-marker.ts @@ -26,7 +26,9 @@ class HaEntityMarker extends LitElement { ? html`
` : this.entityName} diff --git a/src/panels/lovelace/cards/hui-media-control-card.ts b/src/panels/lovelace/cards/hui-media-control-card.ts index 28f279019d..f579172e9a 100644 --- a/src/panels/lovelace/cards/hui-media-control-card.ts +++ b/src/panels/lovelace/cards/hui-media-control-card.ts @@ -544,7 +544,9 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard { } try { - const { foreground, background } = await extractColors(this._image); + const { foreground, background } = await extractColors( + this.hass.hassUrl(this._image) + ); this._backgroundColor = background.hex; this._foregroundColor = foreground.hex; } catch (err: any) {