-
-
-
-
- [[stateObj.attributes.temperature]]
[[getUnit('temperature')]]
+ .attributes,
+ .templow,
+ .precipitation { {
+ color: var(--secondary-text-color);
+ }
+
+
+
+
+
+
+
+
+
+ [[stateObj.attributes.temperature]][[getUnit('temperature')]]
+
+
+
+
+
+ [[localize('ui.card.weather.attributes.air_pressure')]]:
+ [[stateObj.attributes.pressure]] hPa
+
+
+
+
+ [[localize('ui.card.weather.attributes.humidity')]]:
+ [[stateObj.attributes.humidity]] %
+
+
+
+
+ [[localize('ui.card.weather.attributes.wind_speed')]]:
+ [[getWind(stateObj.attributes.wind_speed, stateObj.attributes.wind_bearing, localize)]]
+
+
-
-
-
- [[localize('ui.card.weather.attributes.air_pressure')]]:
- [[stateObj.attributes.pressure]] hPa
-
-
-
-
- [[localize('ui.card.weather.attributes.humidity')]]:
- [[stateObj.attributes.humidity]] %
-
-
-
-
- [[localize('ui.card.weather.attributes.wind_speed')]]:
- [[getWind(stateObj.attributes.wind_speed, stateObj.attributes.wind_bearing, localize)]]
-
-
+
+ [[computeState(stateObj.state, localize)]]
+
+
+
+
+
[[computeDateTime(item.datetime)]]
+
+
+
+
+
+
[[item.temperature]] [[getUnit('temperature')]]
+
+ [[item.templow]] [[getUnit('temperature')]]
+
+
+ [[item.precipitation]] [[getUnit('precipitation')]]
+
+
+
+
+
-
- [[computeState(stateObj.state, localize)]]
-
-
-
-
-
-
[[computeDateTime(item.datetime)]]
-
-
-
-
-
-
[[item.temperature]] [[getUnit('temperature')]]
-
- [[item.templow]] [[getUnit('temperature')]]
-
-
-
-
-
-
-
-`;
+
+ `;
}
static get properties() {
@@ -194,8 +198,11 @@ class HaWeatherCard extends
return forecast && forecast.slice(0, 5);
}
- getUnit(unit) {
- return this.hass.config.core.unit_system[unit] || '';
+ getUnit(measure) {
+ if (measure === 'precipitation') {
+ return this.getUnit('length') === 'km' ? 'mm' : 'in';
+ }
+ return this.hass.config.core.unit_system[measure] || '';
}
computeState(state, localize) {
@@ -226,6 +233,10 @@ class HaWeatherCard extends
return `${speed} ${this.getUnit('length')}/h`;
}
+ _showValue(item) {
+ return typeof item !== 'undefined' && item !== null;
+ }
+
computeDateTime(data) {
const date = new Date(data);
const provider = this.stateObj.attributes.attribution;