Fix undefined on plant/weather card (#2339)

This commit is contained in:
Paulus Schoutsen 2018-12-16 19:52:13 +01:00 committed by Zack Arnett
parent c46d04eaa6
commit e20a02c52c
2 changed files with 4 additions and 2 deletions

View File

@ -119,7 +119,7 @@ class HaPlantCard extends EventsMixin(PolymerElement) {
} }
computeTitle(stateObj) { computeTitle(stateObj) {
return this.config.name || computeStateName(stateObj); return (this.config && this.config.name) || computeStateName(stateObj);
} }
computeAttributes(data) { computeAttributes(data) {

View File

@ -39,6 +39,7 @@ class HaWeatherCard extends LocalizeMixin(EventsMixin(PolymerElement)) {
opacity: var(--dark-primary-opacity); opacity: var(--dark-primary-opacity);
padding: 24px 16px 16px; padding: 24px 16px 16px;
display: flex; display: flex;
align-items: baseline;
} }
.name { .name {
@ -195,6 +196,7 @@ class HaWeatherCard extends LocalizeMixin(EventsMixin(PolymerElement)) {
static get properties() { static get properties() {
return { return {
hass: Object, hass: Object,
config: Object,
stateObj: Object, stateObj: Object,
forecast: { forecast: {
type: Array, type: Array,
@ -274,7 +276,7 @@ class HaWeatherCard extends LocalizeMixin(EventsMixin(PolymerElement)) {
} }
computeName(stateObj) { computeName(stateObj) {
return this.config.name || computeStateName(stateObj); return (this.config && this.config.name) || computeStateName(stateObj);
} }
showWeatherIcon(condition) { showWeatherIcon(condition) {