Skip to content

Commit

Permalink
Merge pull request #26 from p0l0/master
Browse files Browse the repository at this point in the history
Fixed "TypeError: Cannot read property 'split' of undefined"
  • Loading branch information
SNoof85 authored Feb 15, 2021
2 parents ae4b906 + 03a4854 commit 8cd0d77
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tempometer-gauge-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@ class TempometerGaugeCard extends HTMLElement {
cardConfig.entity = entityParts.entity;
if (entityParts.attribute) cardConfig.attribute = entityParts.attribute;

const entityMinParts = this._splitEntityAndAttribute(cardConfig.entity_min);
cardConfig.entity_min = entityMinParts.entity;
if (entityMinParts.attribute) cardConfig.minAttribute = entityMinParts.attribute;

const entityMaxParts = this._splitEntityAndAttribute(cardConfig.entity_max);
cardConfig.entity_max = entityMaxParts.entity;
if (entityMaxParts.attribute) cardConfig.maxAttribute = entityMaxParts.attribute;
if (cardConfig.entity_min !== undefined) {
const entityMinParts = this._splitEntityAndAttribute(cardConfig.entity_min);
cardConfig.entity_min = entityMinParts.entity;
if (entityMinParts.attribute) cardConfig.minAttribute = entityMinParts.attribute;
}

if (cardConfig.entity_max !== undefined) {
const entityMaxParts = this._splitEntityAndAttribute(cardConfig.entity_max);
cardConfig.entity_max = entityMaxParts.entity;
if (entityMaxParts.attribute) cardConfig.maxAttribute = entityMaxParts.attribute;
}

let card_style = cardConfig.style;
const card = document.createElement('ha-card');
const content = document.createElement('div');
Expand Down

0 comments on commit 8cd0d77

Please sign in to comment.