weather fixed

This commit is contained in:
Neythen
2021-12-04 15:54:31 +00:00
parent b038a574d0
commit b9a1316a0e
4 changed files with 43 additions and 32 deletions

View File

@@ -343,9 +343,6 @@ def updateWeather():
for location in all_locations:
loc = gn.geocode(location)
current_weather = {}
lat = loc.latitude
@@ -370,8 +367,8 @@ def updateWeather():
current_weather['rain_chance'] = r.json()['hourly'][0]['pop']
current_weathers[location] = current_weather
if location in current_locations:
current_weathers[location] = current_weather
daily_weather = []
daily = r.json()['daily']
@@ -383,10 +380,20 @@ def updateWeather():
dct['min_temp'] = day['temp']['min']
dct['max_temp'] = day['temp']['max']
daily_weather.append(dct)
#add relevant urrent information to first day in daily
daily_weather[0]['temp'] = weather['temp']
daily_weather[0]['rain_chance'] = current_weather['rain_chance']
daily_weather[0]['humidity'] = current_weather['humidity']
daily_weather[0]['wind_speed'] = current_weather['wind_speed']
daily_weather[0]['uv'] = current_weather['uv']
daily_weather[0]['clouds'] = current_weather['clouds']
daily_weather[0]['wind_speed'] = current_weather['wind_speed']
daily_weather[0]['wind_direction'] = current_weather['wind_direction']
daily_weather[0]['visibility'] = current_weather['visibility']
daily_weathers[location] = daily_weather
if location in daily_locations:
daily_weathers[location] = daily_weather