Skip to content
Permalink
Browse files

Allow empty weather to be specified

This fixes the bug not allowing to ignore the weather entity.
  • Loading branch information...
postlund committed Apr 28, 2019
1 parent 7af9fd3 commit c4527bdc8066c1e3128dfd3079dae7234802e9c9
Showing with 15 additions and 12 deletions.
  1. +15 −12 home-card.js
@@ -84,20 +84,23 @@ class HomeCard extends LitElement {
}

make_content() {
var weatherObj = this.stateObject('weather', this.config.weather);
var weather = "";

if (this.config.weather) {
var weatherObj = this.stateObject('weather', this.config.weather);
weather = html `
<div id="weather">
<img id="weather-icon" src="${this.imgPath("weather-" + weatherObj.state + ".png")}" />
<span id="weather-info">
${weatherObj.attributes.friendly_name}
${weatherObj.attributes.temperature}${this.hass.config.unit_system.temperature}
</span>
</div>`;
}

return html `
<div id="root">
${this.config.weather ?
html `
<div id="weather">
<img id="weather-icon" src="${this.imgPath("weather-" + weatherObj.state + ".png")}" />
<span id="weather-info">
${weatherObj.attributes.friendly_name}
${weatherObj.attributes.temperature}${this.hass.config.unit_system.temperature}
</span>
</div>`
: ""
}
${weather}
<div id="house">
<img id="house-image" src="${this.imgPath(this.theme.house)}" />
${this.make_entities()}

0 comments on commit c4527bd

Please sign in to comment.
You can’t perform that action at this time.