daytime bugfixes for bom_rrd2

This commit is contained in:
Paul Warren 2022-01-29 06:54:49 +11:00
parent e657df2203
commit 5966c6249e
2 changed files with 11 additions and 12 deletions

View file

@ -18,25 +18,26 @@ from weather_au import api
# break
outside_temp = 0
bedroom = rrdtool.fetch("/media/media/mqtt/ESP_4c7682/temp.rrd", "AVERAGE")
bedroom = rrdtool.fetch("/media/media/mqtt/ESP_b3fe20/temp.rrd", "AVERAGE")
rows = bedroom[2][::-1]
for data in rows:
if data[0] is not None:
bedroom_temp = int(data[0])
break
bedroom_temp = 0
lounge = rrdtool.fetch("/media/media/mqtt/ESP_b3fe20/temp.rrd", "AVERAGE")
lounge = rrdtool.fetch("/media/media/mqtt/ESP_4c7682/temp.rrd", "AVERAGE")
rows = lounge[2][::-1]
for data in rows:
if data[0] is not None:
lounge_temp = data[0]
lounge_temp = int(data[0])
break
lounge_temp = 0
bom_icons = {
'sunny': 'SUNNY.JPG',
'clear': 'CLEAR.JPG',
'partly_cloudy': 'PCLOUD.JPG',
'mostly_sunny': 'PCLOUD.JPG',
'cloudy': 'CLOUDY.JPG',
'haze': 'HAZE.JPG',
'light_rain': 'LRAIN.JPG',
@ -61,19 +62,19 @@ wdays_dict = w.forecasts_daily()
new = {}
weather = {}
weather['today'] = wdays_dict[0]
weather['tomorrow'] = wdays_dict[1]
weather['day_after'] = wdays_dict[2]
# The first forecast period doesn't always have the temperature and other bits
# I get the overnight low and forecast to substitute when this happens.
if weather['today']['temp_min'] is None:
if wdays_dict[0]['temp_min'] is None:
night = 1
weather['today'] = wdays_dict[0]
weather['tomorrow'] = wdays_dict[2]
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]
if night:
for day in weather.keys():

View file

@ -310,9 +310,7 @@ void weatherUpdate(void) {
Serial.println(buf);
epd_disp_string(buf, 500, 225);
} else {
Serial.print("Error on HTTP Request: ");
Serial.println(httpCode);