From a53424bb3496f9870921aa1b5ca6e7043457ae4c Mon Sep 17 00:00:00 2001 From: wrfz <77174685+wrfz@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:45:09 +0100 Subject: [PATCH] Fix js errror --- dist/hpsu-dashboard-card.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/dist/hpsu-dashboard-card.js b/dist/hpsu-dashboard-card.js index 021f33e..456bce9 100644 --- a/dist/hpsu-dashboard-card.js +++ b/dist/hpsu-dashboard-card.js @@ -68,7 +68,7 @@ class HPSUDashboardCard extends HTMLElement { const url = this.makeURL("hpsu.svg"); - console.log(url); + //console.log(url); let response = await fetch(url); if (!response.ok) { @@ -276,7 +276,7 @@ class HPSUDashboardCard extends HTMLElement { } updateOpacity() { - console.log(">> updateOpacity"); + //console.log(">> updateOpacity"); if (this.config && this.inititialized) { const flowArrows = this.shadowRoot.querySelector(`#DHW-Flow-Arrows`); const flowReturnArrows = this.shadowRoot.querySelector(`#DHW-Flow-Return-Arrows`); @@ -341,12 +341,12 @@ class HPSUDashboardCard extends HTMLElement { const urlParams = new URLSearchParams(scriptUrl.split('?')[1]); const hacsTag = urlParams.get('hacstag'); - console.log("hacsTag: " + hacsTag); - console.log("isNumeric: " + this.isNumeric(hacsTag)); + //console.log("hacsTag: " + hacsTag); + //console.log("isNumeric: " + this.isNumeric(hacsTag)); const url = this.isNumeric(hacsTag) ? `/hacsfiles/daikin-rotex-hpsu-dashboard/${filename}?${hacsTag}`: `/local/daikin-rotex-hpsu-dashboard/${filename}?${new Date().getTime()}`; - console.log(url); + //console.log(url); return url; } } @@ -419,7 +419,16 @@ class HpsuDashboardCardEditor extends LitElement { event.stopPropagation(); const entityId = event.target.getAttribute("data-id"); - this.config.entities[entityId] = event.detail.value; + + // make a copy => avoid entity is read-only error + const updatedEntities = { ...this.config.entities }; + updatedEntities[entityId] = event.detail.value; + + this.config = { + ...this.config, + entities: updatedEntities + }; + this.dispatchEvent(new CustomEvent('config-changed', { detail: { config: this.config } })); }