diff --git a/src/panels/lovelace/editor/config-elements/hui-picture-elements-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-picture-elements-card-editor.ts index 896f7d40cb..ef38779acf 100644 --- a/src/panels/lovelace/editor/config-elements/hui-picture-elements-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-picture-elements-card-editor.ts @@ -78,7 +78,8 @@ export class HuiPictureElementsCardEditor private _handlePositionClick(x: number, y: number): void { if ( !this._subElementEditorConfig?.elementConfig || - this._subElementEditorConfig.type !== "element" + this._subElementEditorConfig.type !== "element" || + this._subElementEditorConfig.elementConfig.type === "conditional" ) { return; } @@ -178,7 +179,8 @@ export class HuiPictureElementsCardEditor if (this._subElementEditorConfig) { return html` - ${this._subElementEditorConfig.type === "element" + ${this._subElementEditorConfig.type === "element" && + this._subElementEditorConfig.elementConfig?.type !== "conditional" ? html` ${this.hass.localize( diff --git a/src/panels/lovelace/editor/get-element-stub-config.ts b/src/panels/lovelace/editor/get-element-stub-config.ts index 46516c7698..fe5bd784f4 100644 --- a/src/panels/lovelace/editor/get-element-stub-config.ts +++ b/src/panels/lovelace/editor/get-element-stub-config.ts @@ -10,7 +10,9 @@ export const getElementStubConfig = async ( ): Promise => { let elementConfig: LovelaceElementConfig = { type }; - if (type !== "conditional") { + if (type === "conditional") { + elementConfig = { type, conditions: [], elements: [] }; + } else { elementConfig.style = { left: "50%", top: "50%" }; }