Skip to content

Commit

Permalink
Fix for timestamp sensors with unit_of_measurement set
Browse files Browse the repository at this point in the history
  • Loading branch information
gadgetchnnel committed Jul 2, 2020
1 parent fbe614e commit ec734ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lovelace-home-feed-card.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/helpers/compute-state-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export function computeStateDisplay(localize, stateObj, language) {
return localize(`state.default.${stateObj.state}`);
}

if (stateObj.attributes.device_class == "timestamp") {
return `${stateObj.state}`;
}

if (stateObj.attributes.unit_of_measurement) {
return `${stateObj.state} ${stateObj.attributes.unit_of_measurement}`;
}
Expand Down

0 comments on commit ec734ff

Please sign in to comment.