From 0d6db8b834208e64f59943920602b3544dcbf958 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Wed, 16 Jul 2025 23:01:42 -0700 Subject: [PATCH] Show picture-elements error messages for elements (#26196) --- src/panels/lovelace/cards/hui-picture-elements-card.ts | 9 +++++++++ src/panels/lovelace/cards/types.ts | 1 + src/panels/lovelace/elements/types.ts | 1 + 3 files changed, 11 insertions(+) diff --git a/src/panels/lovelace/cards/hui-picture-elements-card.ts b/src/panels/lovelace/cards/hui-picture-elements-card.ts index cea7d6824c..6b63b612e7 100644 --- a/src/panels/lovelace/cards/hui-picture-elements-card.ts +++ b/src/panels/lovelace/cards/hui-picture-elements-card.ts @@ -23,6 +23,8 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard { @property({ attribute: false }) public hass?: HomeAssistant; + @property({ type: Boolean }) public preview = false; + @state() private _elements?: LovelaceElement[]; public static getStubConfig( @@ -98,6 +100,12 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard { } } + if (this._elements && changedProps.has("preview")) { + for (const element of this._elements) { + element.preview = this.preview; + } + } + const oldHass = changedProps.get("hass") as HomeAssistant | undefined; const oldConfig = changedProps.get("_config") as | PictureElementsCardConfig @@ -180,6 +188,7 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard { if (this.hass) { element.hass = this.hass; } + element.preview = this.preview; element.addEventListener( "ll-rebuild", (ev) => { diff --git a/src/panels/lovelace/cards/types.ts b/src/panels/lovelace/cards/types.ts index 0902cf853e..53f65f86e4 100644 --- a/src/panels/lovelace/cards/types.ts +++ b/src/panels/lovelace/cards/types.ts @@ -228,6 +228,7 @@ export interface EntityFilterCardConfig extends LovelaceCardConfig { export interface ErrorCardConfig extends LovelaceCardConfig { error?: string; + message?: string; origConfig?: LovelaceCardConfig; severity?: "warning" | "error"; } diff --git a/src/panels/lovelace/elements/types.ts b/src/panels/lovelace/elements/types.ts index 5ca44d5027..09774fa88c 100644 --- a/src/panels/lovelace/elements/types.ts +++ b/src/panels/lovelace/elements/types.ts @@ -20,6 +20,7 @@ export type LovelaceElementConfig = export interface LovelaceElement extends HTMLElement { hass?: HomeAssistant; + preview?: boolean; setConfig(config: LovelaceElementConfig): void; }