|
|
|
@ -8,6 +8,7 @@ import collections
|
|
|
|
|
import rrdtool |
|
|
|
|
|
|
|
|
|
from weather_au import api |
|
|
|
|
from dateutil import tz |
|
|
|
|
|
|
|
|
|
# Grab current temps from sensors around the house |
|
|
|
|
#outside = rrdtool.fetch("/media/media/mqtt/ESP_b5952/temp/c.rrd", "AVERAGE") |
|
|
|
@ -72,9 +73,12 @@ if wdays_dict[0]['temp_min'] is None:
|
|
|
|
|
weather['day_after'] = wdays_dict[3] |
|
|
|
|
else: |
|
|
|
|
night = 0 |
|
|
|
|
weather['today'] = wdays_dict[1] |
|
|
|
|
weather['tomorrow'] = wdays_dict[2] |
|
|
|
|
weather['day_after'] = wdays_dict[3] |
|
|
|
|
weather['today'] = wdays_dict[0] |
|
|
|
|
weather['tomorrow'] = wdays_dict[1] |
|
|
|
|
weather['day_after'] = wdays_dict[2] |
|
|
|
|
|
|
|
|
|
utc_zone = tz.tzutc() |
|
|
|
|
local_zone = tz.tzlocal() |
|
|
|
|
|
|
|
|
|
if night: |
|
|
|
|
for day in weather.keys(): |
|
|
|
@ -84,7 +88,10 @@ if night:
|
|
|
|
|
new[day]['max'] = weather['tomorrow']['temp_min'] |
|
|
|
|
new[day]['icon'] = bom_icons[weather['today']['icon_descriptor']] |
|
|
|
|
else: |
|
|
|
|
new[day]['day'] = datetime.datetime.strptime(weather[day]['date'], "%Y-%m-%dT%H:%M:%S%z").strftime("%A") |
|
|
|
|
utc = datetime.datetime.strptime(weather[day]['date'], "%Y-%m-%dT%H:%M:%S%z") |
|
|
|
|
utc.replace(tzinfo=utc_zone) |
|
|
|
|
local_date = utc.astimezone(local_zone) |
|
|
|
|
new[day]['day'] = local_date.strftime("%A") |
|
|
|
|
new[day]['icon'] = bom_icons[weather[day]['icon_descriptor']] |
|
|
|
|
new[day]['max'] = weather[day]['temp_max'] |
|
|
|
|
|
|
|
|
@ -92,8 +99,10 @@ else:
|
|
|
|
|
|
|
|
|
|
for day in weather.keys(): |
|
|
|
|
new[day] = {} |
|
|
|
|
new[day]['day'] = datetime.datetime.strptime(weather[day]['date'], "%Y-%m-%dT%H:%M:%S%z").strftime("%A") |
|
|
|
|
|
|
|
|
|
utc = datetime.datetime.strptime(weather[day]['date'], "%Y-%m-%dT%H:%M:%S%z") |
|
|
|
|
utc.replace(tzinfo=utc_zone) |
|
|
|
|
local_date = utc.astimezone(local_zone) |
|
|
|
|
new[day]['day'] = local_date.strftime("%A") |
|
|
|
|
new[day]['icon'] = bom_icons[weather[day]['icon_descriptor']] |
|
|
|
|
new[day]['max'] = weather[day]['temp_max'] |
|
|
|
|
|
|
|
|
|