Skip to content

Commit

Permalink
fix issue with closed sunroof
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwetteronline committed Aug 16, 2020
1 parent 4207952 commit e16ec86
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions carnet-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ class CarnetCard extends HTMLElement {
return "";
}

const key = state.state === "on" ? sensor.on : sensor.off;
const url = `${sliceUrl}_${sensor.carnetId}_${key}@2x.png`;
let key = state.state === "on" ? sensor.on : sensor.off;
if (key !== "") {
key = `_${key}`; // add underscore in front of key
}
const url = `${sliceUrl}_${sensor.carnetId}${key}@2x.png`;
return `<img src="${url}" style="transform-origin: 50%; position: absolute; top: 0; left: 0; width: 100%" />`;
});

Expand Down

0 comments on commit e16ec86

Please sign in to comment.