Skip to content

Commit

Permalink
Fix colors of unavailable sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
Olen committed Aug 9, 2022
1 parent 73be16b commit 0a8e950
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions flower-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,16 @@ customElements.whenDefined("card-tools").then(() => {
}
}
const attribute = (attr) => {
const val = parseInt(curr[attr]);
const aval = curr[attr] !== "unknown" ? true : false;
var val = parseInt(curr[attr]);
const min = parseInt(limits["min_" + attr]);
const max = parseInt(limits["max_" + attr]);
const unit = uom[attr];
const icon = icons[attr] || "mdi:help-circle-outline";
const aval = val !== "unavailable" ? true : false;
const pct = 100 * Math.max(0, Math.min(1, (val - min) / (max - min)));

if (isNaN(val)) {
val = "";
}
return cardTools.LitHtml`
<div class="attribute tooltip" data-tooltip="${
aval
Expand Down

0 comments on commit 0a8e950

Please sign in to comment.