Skip to content

Commit

Permalink
Merge pull request #15 from SNoof85/unit
Browse files Browse the repository at this point in the history
no unit if none in config & ha
  • Loading branch information
SNoof85 authored Dec 21, 2020
2 parents 788a5cc + bf5f9f4 commit f8663ce
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tempometer-gauge-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,15 @@ class TempometerGaugeCard extends HTMLElement {
}

let measurement = "";
if (config.measurement == null)
measurement = hass.states[config.entity].attributes.unit_of_measurement;
else
if (config.measurement == null) {
if (hass.states[config.entity].attributes.unit_of_measurement === undefined) {
measurement = '';
} else {
measurement = hass.states[config.entity].attributes.unit_of_measurement;
}
} else {
measurement = config.measurement;
}

root.getElementById("minval").innerHTML = config.min;
root.getElementById("maxval").innerHTML = config.max;
Expand Down

0 comments on commit f8663ce

Please sign in to comment.