From f22662091fb5725026a186149791c673b0bcd278 Mon Sep 17 00:00:00 2001 From: Earle Lowe Date: Wed, 8 Jan 2025 19:06:36 -0800 Subject: [PATCH] Allow setting which image to use --- MMM-WeatherBackground.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/MMM-WeatherBackground.js b/MMM-WeatherBackground.js index baa60f1..52f285d 100644 --- a/MMM-WeatherBackground.js +++ b/MMM-WeatherBackground.js @@ -31,6 +31,7 @@ Module.register("MMM-WeatherBackground", { externalCollections: "collections.json", // or null collections: {}, clientID: "", + unsplashSize: "full", sources: { weather: { notification: "CURRENTWEATHER_TYPE", @@ -208,6 +209,19 @@ Module.register("MMM-WeatherBackground", { const response = await fetch(baseUrl + "?query=" + query + "&client_id=" + this.config.clientID) const data = await response.json() - return data.urls.full + switch(this.config.unsplashSize) { + case "raw": + return data.urls.raw + case "full": + return data.urls.full + case "regular": + return data.urls.regular + case "small": + return data.urls.small + case "thumb": + return data.urls.thumb + default: + return data.urls.full + } } });