Fixed weather

pull/1269/head
David Peer 2022-01-12 07:20:08 +01:00
parent 1f06e6cfc5
commit dfd04df0f3
1 changed files with 15 additions and 9 deletions

View File

@ -138,7 +138,7 @@ function printData(key, y, c){
} else if (key == "TEMP"){
var weather = getWeather();
value = locale.temp(parseInt(weather.temp-273.15));
value = weather.temp;
} else if (key == "HUMIDITY"){
text = "HUM";
@ -423,14 +423,7 @@ function getSteps() {
function getWeather(){
var weather = {
temp: 0,
hum: 0,
txt: "",
wind: 0,
wdir: 0,
wrose: ""
};
var weather;
try {
weather = require('weather').get();
@ -438,6 +431,19 @@ function getWeather(){
// Return default
}
if (weather === undefined){
weather = {
temp: "-",
hum: "-",
txt: "-",
wind: "-",
wdir: "-",
wrose: "-"
};
} else {
weather.temp = locale.temp(parseInt(weather.temp-273.15))
}
return weather;
}