From e16ec863da6117cf8fbfc9371046909d78999f22 Mon Sep 17 00:00:00 2001 From: David Luhmer Date: Sun, 16 Aug 2020 16:04:57 +0200 Subject: [PATCH] fix issue with closed sunroof --- carnet-card.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/carnet-card.js b/carnet-card.js index c1d2f94..af494c5 100644 --- a/carnet-card.js +++ b/carnet-card.js @@ -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 ``; });