diff --git a/src/dialogs/more-info/controls/more-info-weather.ts b/src/dialogs/more-info/controls/more-info-weather.ts
index 8d14f80cac..8307ae37fd 100644
--- a/src/dialogs/more-info/controls/more-info-weather.ts
+++ b/src/dialogs/more-info/controls/more-info-weather.ts
@@ -87,7 +87,7 @@ class MoreInfoWeather extends LitElement {
${this.stateObj.attributes.temperature} ${this.getUnit("temperature")}
- ${this.stateObj.attributes.pressure
+ ${this._showValue(this.stateObj.attributes.pressure)
? html`
@@ -101,7 +101,7 @@ class MoreInfoWeather extends LitElement {
`
: ""}
- ${this.stateObj.attributes.humidity
+ ${this._showValue(this.stateObj.attributes.humidity)
? html`
@@ -112,7 +112,7 @@ class MoreInfoWeather extends LitElement {
`
: ""}
- ${this.stateObj.attributes.wind_speed
+ ${this._showValue(this.stateObj.attributes.wind_speed)
? html`
@@ -128,7 +128,7 @@ class MoreInfoWeather extends LitElement {
`
: ""}
- ${this.stateObj.attributes.visibility
+ ${this._showValue(this.stateObj.attributes.visibility)
? html`
@@ -156,14 +156,14 @@ class MoreInfoWeather extends LitElement {
>
`
: ""}
- ${!item.templow
+ ${!this._showValue(item.templow)
? html`
${this.computeDateTime(item.datetime)}
`
: ""}
- ${item.templow
+ ${this._showValue(item.templow)
? html`
${this.computeDate(item.datetime)}
@@ -172,7 +172,7 @@ class MoreInfoWeather extends LitElement {
${item.templow} ${this.getUnit("temperature")}
`
- : ""};
+ : ""}
${item.temperature} ${this.getUnit("temperature")}
@@ -279,6 +279,10 @@ class MoreInfoWeather extends LitElement {
}
return `${speed} ${this.getUnit("length")}/h`;
}
+
+ private _showValue(item: string): boolean {
+ return typeof item !== "undefined" && item !== null;
+ }
}
declare global {