Skip to content

Commit

Permalink
feat: update Lovelace Wallpanel via HACS
Browse files Browse the repository at this point in the history
  • Loading branch information
aronnebrivio committed May 28, 2024
1 parent 13ac20c commit 6e715e5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions www/community/lovelace-wallpanel/wallpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class ScreenWakeLock {
}
}

const version = "4.25.0";
const version = "4.25.1";
const defaultConfig = {
enabled: false,
enabled_on_tabs: [],
Expand Down Expand Up @@ -1616,6 +1616,9 @@ class WallpanelView extends HuiView {
}
val = date.toLocaleDateString(elHass.__hass.locale.language, options);
}
if (typeof val === 'object') {
val = JSON.stringify(val);
}
return prefix + val + suffix;
});
infoElement.innerHTML = html;
Expand Down Expand Up @@ -1778,7 +1781,7 @@ class WallpanelView extends HuiView {
http.send();
}

updateImageFromUrl(img, url) {
fillPlaceholders(url) {
let width = this.screensaverContainer.clientWidth;
let height = this.screensaverContainer.clientHeight;
let timestamp_ms = Date.now();
Expand All @@ -1787,12 +1790,20 @@ class WallpanelView extends HuiView {
url = url.replace(/\${height}/g, height);
url = url.replace(/\${timestamp_ms}/g, timestamp_ms);
url = url.replace(/\${timestamp}/g, timestamp);
img.imageUrl = url;
logger.debug(`Updating image '${img.id}' from '${url}'`);
return url;
}

updateImageFromUrl(img, url) {
const realUrl = this.fillPlaceholders(url);
if (realUrl != url && imageInfoCache[url]) {
imageInfoCache[realUrl] = imageInfoCache[url];
}
img.imageUrl = realUrl;
logger.debug(`Updating image '${img.id}' from '${realUrl}'`);
if (imageSourceType() == "media-entity") {
this.updateImageUrlWithHttpFetch(img, url);
this.updateImageUrlWithHttpFetch(img, realUrl);
} else {
img.src = url;
img.src = realUrl;
}
}

Expand Down
Binary file modified www/community/lovelace-wallpanel/wallpanel.js.gz
Binary file not shown.

0 comments on commit 6e715e5

Please sign in to comment.