owmweather - Schedule the first update for 5s after boot

pull/2208/head
Martin Boonk 2022-10-30 15:52:06 +01:00
parent 6b5176c086
commit 0d145328a0
1 changed files with 8 additions and 5 deletions

View File

@ -12,11 +12,14 @@
let weather = require("Storage").readJSON('weather.json') || {};
let lastUpdate;
if (weather && weather.weather && weather.weather.time) lastUpdate = weather.weather.time;
if (!lastUpdate || lastUpdate + settings.refresh * 1000 * 60 < Date.now()){
setTimeout(() => {
if (!waiting){
waiting = true;
require("owmweather").pull(completion);
}
}, 5000);
}
setInterval(() => {
if (!waiting && NRF.getSecurityStatus().connected){