From fe3d22d4f868ce7247f8772fcbe8d2f16c9579e8 Mon Sep 17 00:00:00 2001 From: Tobias Sauerwein Date: Wed, 3 Feb 2021 20:51:28 +0100 Subject: [PATCH] Only display current temp when not None (#8316) Co-authored-by: Bram Kragten --- .../lovelace/cards/hui-thermostat-card.ts | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/panels/lovelace/cards/hui-thermostat-card.ts b/src/panels/lovelace/cards/hui-thermostat-card.ts index d78318531f..64c0c54714 100644 --- a/src/panels/lovelace/cards/hui-thermostat-card.ts +++ b/src/panels/lovelace/cards/hui-thermostat-card.ts @@ -132,27 +132,30 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard { > `; - const currentTemperature = !isNaN(stateObj.attributes.current_temperature) - ? svg` - - - ${formatNumber( - stateObj.attributes.current_temperature, - this.hass!.language - )} - - ${this.hass.config.unit_system.temperature} - - - - ` - : ""; + const currentTemperature = svg` + + + ${ + stateObj.attributes.current_temperature !== null && + !isNaN(stateObj.attributes.current_temperature) + ? svg`${formatNumber( + stateObj.attributes.current_temperature, + this.hass!.language + )} + + ${this.hass.config.unit_system.temperature} + ` + : "" + } + + + `; const setValues = svg`