mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 21:37:21 +00:00
Fix zero degree in weather card (#1720)
* Fix zero degree display in weather card * Fix zero degree display in weather more-info dialog
This commit is contained in:
parent
f0619c7d13
commit
3d9d7d899d
@ -129,11 +129,11 @@ class HaWeatherCard extends
|
||||
<template is="dom-repeat" items="[[forecast]]">
|
||||
<div>
|
||||
<div class="weekday">[[computeDate(item.datetime)]]<br>
|
||||
<template is="dom-if" if="[[!item.templow]]">
|
||||
<template is="dom-if" if="[[!_showValue(item.templow)]]">
|
||||
[[computeTime(item.datetime)]]
|
||||
</template>
|
||||
</div>
|
||||
<template is="dom-if" if="[[item.condition]]">
|
||||
<template is="dom-if" if="[[_showValue(item.condition)]]">
|
||||
<div class="icon">
|
||||
<ha-icon icon="[[getWeatherIcon(item.condition)]]"></ha-icon>
|
||||
</div>
|
||||
|
@ -52,28 +52,28 @@ class MoreInfoWeather extends LocalizeMixin(PolymerElement) {
|
||||
<div class="main">[[localize('ui.card.weather.attributes.temperature')]]</div>
|
||||
<div>[[stateObj.attributes.temperature]] [[getUnit('temperature')]]</div>
|
||||
</div>
|
||||
<template is="dom-if" if="[[stateObj.attributes.pressure]]">
|
||||
<template is="dom-if" if="[[_showValue(stateObj.attributes.pressure)]]">
|
||||
<div class="flex">
|
||||
<iron-icon icon="hass:gauge"></iron-icon>
|
||||
<div class="main">[[localize('ui.card.weather.attributes.air_pressure')]]</div>
|
||||
<div>[[stateObj.attributes.pressure]] [[getUnit('air_pressure')]]</div>
|
||||
</div>
|
||||
</template>
|
||||
<template is="dom-if" if="[[stateObj.attributes.humidity]]">
|
||||
<template is="dom-if" if="[[_showValue(stateObj.attributes.humidity)]]">
|
||||
<div class="flex">
|
||||
<iron-icon icon="hass:water-percent"></iron-icon>
|
||||
<div class="main">[[localize('ui.card.weather.attributes.humidity')]]</div>
|
||||
<div>[[stateObj.attributes.humidity]] %</div>
|
||||
</div>
|
||||
</template>
|
||||
<template is="dom-if" if="[[stateObj.attributes.wind_speed]]">
|
||||
<template is="dom-if" if="[[_showValue(stateObj.attributes.wind_speed)]]">
|
||||
<div class="flex">
|
||||
<iron-icon icon="hass:weather-windy"></iron-icon>
|
||||
<div class="main">[[localize('ui.card.weather.attributes.wind_speed')]]</div>
|
||||
<div>[[getWind(stateObj.attributes.wind_speed, stateObj.attributes.wind_bearing, localize)]]</div>
|
||||
</div>
|
||||
</template>
|
||||
<template is="dom-if" if="[[stateObj.attributes.visibility]]">
|
||||
<template is="dom-if" if="[[_showValue(stateObj.attributes.visibility)]]">
|
||||
<div class="flex">
|
||||
<iron-icon icon="hass:eye"></iron-icon>
|
||||
<div class="main">[[localize('ui.card.weather.attributes.visibility')]]</div>
|
||||
@ -85,11 +85,11 @@ class MoreInfoWeather extends LocalizeMixin(PolymerElement) {
|
||||
<div class="section">[[localize('ui.card.weather.forecast')]]:</div>
|
||||
<template is="dom-repeat" items="[[stateObj.attributes.forecast]]">
|
||||
<div class="flex">
|
||||
<template is="dom-if" if="[[item.condition]]">
|
||||
<template is="dom-if" if="[[_showValue(item.condition)]]">
|
||||
<iron-icon icon="[[getWeatherIcon(item.condition)]]"></iron-icon>
|
||||
</template>
|
||||
<div class="main">[[computeDateTime(item.datetime)]]</div>
|
||||
<template is="dom-if" if="[[item.templow]]">
|
||||
<template is="dom-if" if="[[_showValue(item.templow)]]">
|
||||
<div class="templow">[[item.templow]] [[getUnit('temperature')]]</div>
|
||||
</template>
|
||||
<div class="temp">[[item.temperature]] [[getUnit('temperature')]]</div>
|
||||
@ -188,6 +188,10 @@ class MoreInfoWeather extends LocalizeMixin(PolymerElement) {
|
||||
getWeatherIcon(condition) {
|
||||
return this.weatherIcons[condition];
|
||||
}
|
||||
|
||||
_showValue(item) {
|
||||
return typeof item !== 'undefined' && item !== null;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('more-info-weather', MoreInfoWeather);
|
||||
|
Loading…
x
Reference in New Issue
Block a user