Better stability for weather
parent
a02e6d79c4
commit
058beeae94
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue