Better stability for weather

master
David Peer 2022-04-20 17:09:33 +02:00
parent a02e6d79c4
commit 058beeae94
1 changed files with 23 additions and 26 deletions

View File

@ -579,21 +579,6 @@ function getWeather(){
try { try {
weatherJson = storage.readJSON('weather.json'); weatherJson = storage.readJSON('weather.json');
} catch(ex) {
// Return default
}
if(weatherJson === undefined){
return {
temp: "-",
hum: "-",
txt: "-",
wind: "-",
wdir: "-",
wrose: "-"
};
}
var weather = weatherJson.weather; var weather = weatherJson.weather;
// Temperature // Temperature
@ -608,8 +593,20 @@ function getWeather(){
weather.wind = Math.round(wind[1] * speedFactor); weather.wind = Math.round(wind[1] * speedFactor);
return weather return weather
} catch(ex) {
// Return default
} }
return {
temp: " ? ",
hum: " ? ",
txt: " ? ",
wind: " ? ",
wdir: " ? ",
wrose: " ? "
};
}
/* /*
* Handle alarm * Handle alarm