From c8fc3046d47e2dbdd2051a15b7a5d0daa8d9a8ac Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sat, 2 Jul 2022 16:10:01 +0200 Subject: [PATCH] owmweather - Read settings on every refresh --- apps/owmweather/boot.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/owmweather/boot.js b/apps/owmweather/boot.js index f7421720c..120cb6f65 100644 --- a/apps/owmweather/boot.js +++ b/apps/owmweather/boot.js @@ -4,7 +4,7 @@ enabled: false }; console.log("Settings", settings); - if (settings.enabled && settings.apikey) { + if (settings.enabled) { let location = require("Storage").readJSON("mylocation.json", 1) || { "lat": 51.50, "lon": 0.12, @@ -16,6 +16,7 @@ print("Waiting for response"); return; } + let settings = require("Storage").readJSON("owmweather.json", 1); let uri = "https://api.openweathermap.org/data/2.5/weather?lat=" + location.lat.toFixed(2) + "&lon=" + location.lon.toFixed(2) + "&exclude=hourly,daily&appid=" + settings.apikey; print("Calling uri " + uri); if (Bangle.http){ @@ -74,5 +75,6 @@ setInterval(() => { Bangle.pullOwmWeather(); }, settings.refresh * 1000 * 60); + delete settings; } })();