From 07fc2ef78a2b17c49a964eaf58857985e949bc36 Mon Sep 17 00:00:00 2001 From: St3v390 Date: Tue, 13 Jan 2026 15:17:56 +0100 Subject: [PATCH] Friendly name as label I dont't know if you like this, but i changed the labels to the friendly name with fallback. --- dist/homeassistant-lg-thinq-cards.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dist/homeassistant-lg-thinq-cards.js b/dist/homeassistant-lg-thinq-cards.js index e2838ad..7186761 100644 --- a/dist/homeassistant-lg-thinq-cards.js +++ b/dist/homeassistant-lg-thinq-cards.js @@ -1168,7 +1168,7 @@ _buildProgress() { } _renderChip(chip) { - const stateObj = this._stateObj(chip.key); + const stateObj = this._stateObj(chip.key); const value = stateObj?.state; if (value == null) { return null; @@ -1185,7 +1185,7 @@ _buildProgress() { return null; } - const label = isActive ? chip.active : chip.inactive; + const label = (isActive ? chip.active : chip.inactive); const variant = isActive ? "active" : "inactive"; const tone = chip.tone === "soft" ? "soft" : "solid"; @@ -1218,11 +1218,13 @@ _buildProgress() { if (!groups.has(group)) { groups.set(group, []); } + const stateObj = this._stateObj(detail.key); + const label = stateObj?.attributes.friendly_name ?? detail.label; groups.get(group).push( html`
${detail.icon ? html`` : null} - ${detail.label} + ${label} ${value ?? "—"}
` @@ -1250,7 +1252,11 @@ _buildProgress() { return html``; } - const header = this._config.title ?? this._config.name ?? this._definition.label; + const mainEntity = this._stateObj(this._config.appliance); + const header = this._config.title ?? + this._config.name ?? + mainEntity?.attributes.friendly_name ?? + this._definition.label; const accent = this._definition.accent ?? { start: "#8df427", end: "#4caf50" }; const statusValue = this._stateValue("status"); const statusNormalized = statusValue != null ? normalize(statusValue) : null; @@ -1703,4 +1709,4 @@ _buildProgress() { customElements.define("lg-thinq-fridge-card", LGThinQFridgeCard); } - export const homeAssistantLGThinQCardsVersion = VERSION; \ No newline at end of file + export const homeAssistantLGThinQCardsVersion = VERSION;