Only display current temp when not None (#8316)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Tobias Sauerwein 2021-02-03 20:51:28 +01:00 committed by GitHub
parent e06642e892
commit fe3d22d4f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,8 +132,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
></round-slider> ></round-slider>
`; `;
const currentTemperature = !isNaN(stateObj.attributes.current_temperature) const currentTemperature = svg`
? svg`
<svg viewBox="0 0 40 20"> <svg viewBox="0 0 40 20">
<text <text
x="50%" x="50%"
@ -142,17 +141,21 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
text-anchor="middle" text-anchor="middle"
style="font-size: 13px;" style="font-size: 13px;"
> >
${formatNumber( ${
stateObj.attributes.current_temperature !== null &&
!isNaN(stateObj.attributes.current_temperature)
? svg`${formatNumber(
stateObj.attributes.current_temperature, stateObj.attributes.current_temperature,
this.hass!.language this.hass!.language
)} )}
<tspan dx="-3" dy="-6.5" style="font-size: 4px;"> <tspan dx="-3" dy="-6.5" style="font-size: 4px;">
${this.hass.config.unit_system.temperature} ${this.hass.config.unit_system.temperature}
</tspan> </tspan>`
: ""
}
</text> </text>
</svg> </svg>
` `;
: "";
const setValues = svg` const setValues = svg`
<svg id="set-values"> <svg id="set-values">