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,27 +132,30 @@ 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%" dx="1"
dx="1" y="60%"
y="60%" text-anchor="middle"
text-anchor="middle" style="font-size: 13px;"
style="font-size: 13px;" >
> ${
${formatNumber( stateObj.attributes.current_temperature !== null &&
stateObj.attributes.current_temperature, !isNaN(stateObj.attributes.current_temperature)
this.hass!.language ? svg`${formatNumber(
)} stateObj.attributes.current_temperature,
<tspan dx="-3" dy="-6.5" style="font-size: 4px;"> this.hass!.language
${this.hass.config.unit_system.temperature} )}
</tspan> <tspan dx="-3" dy="-6.5" style="font-size: 4px;">
</text> ${this.hass.config.unit_system.temperature}
</svg> </tspan>`
` : ""
: ""; }
</text>
</svg>
`;
const setValues = svg` const setValues = svg`
<svg id="set-values"> <svg id="set-values">