Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more info weather card - errant semi colon and zero degrees not displaying #4228

Merged
merged 1 commit into from
Nov 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/dialogs/more-info/controls/more-info-weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class MoreInfoWeather extends LitElement {
${this.stateObj.attributes.temperature} ${this.getUnit("temperature")}
</div>
</div>
${this.stateObj.attributes.pressure
${this._showValue(this.stateObj.attributes.pressure)
? html`
<div class="flex">
<iron-icon icon="hass:gauge"></iron-icon>
Expand All @@ -101,7 +101,7 @@ class MoreInfoWeather extends LitElement {
</div>
`
: ""}
${this.stateObj.attributes.humidity
${this._showValue(this.stateObj.attributes.humidity)
? html`
<div class="flex">
<iron-icon icon="hass:water-percent"></iron-icon>
Expand All @@ -112,7 +112,7 @@ class MoreInfoWeather extends LitElement {
</div>
`
: ""}
${this.stateObj.attributes.wind_speed
${this._showValue(this.stateObj.attributes.wind_speed)
? html`
<div class="flex">
<iron-icon icon="hass:weather-windy"></iron-icon>
Expand All @@ -128,7 +128,7 @@ class MoreInfoWeather extends LitElement {
</div>
`
: ""}
${this.stateObj.attributes.visibility
${this._showValue(this.stateObj.attributes.visibility)
? html`
<div class="flex">
<iron-icon icon="hass:eye"></iron-icon>
Expand Down Expand Up @@ -156,14 +156,14 @@ class MoreInfoWeather extends LitElement {
></iron-icon>
`
: ""}
${!item.templow
${!this._showValue(item.templow)
? html`
<div class="main">
${this.computeDateTime(item.datetime)}
</div>
`
: ""}
${item.templow
${this._showValue(item.templow)
? html`
<div class="main">
${this.computeDate(item.datetime)}
Expand All @@ -172,7 +172,7 @@ class MoreInfoWeather extends LitElement {
${item.templow} ${this.getUnit("temperature")}
</div>
`
: ""};
: ""}
<div class="temp">
${item.temperature} ${this.getUnit("temperature")}
</div>
Expand Down Expand Up @@ -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 {
Expand Down