daytime bugfixes for bom_rrd2
This commit is contained in:
parent
e657df2203
commit
5966c6249e
2 changed files with 11 additions and 12 deletions
19
bom_rrd2.py
19
bom_rrd2.py
|
@ -18,25 +18,26 @@ from weather_au import api
|
||||||
# break
|
# break
|
||||||
outside_temp = 0
|
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]
|
rows = bedroom[2][::-1]
|
||||||
for data in rows:
|
for data in rows:
|
||||||
if data[0] is not None:
|
if data[0] is not None:
|
||||||
bedroom_temp = int(data[0])
|
bedroom_temp = int(data[0])
|
||||||
break
|
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]
|
rows = lounge[2][::-1]
|
||||||
for data in rows:
|
for data in rows:
|
||||||
if data[0] is not None:
|
if data[0] is not None:
|
||||||
lounge_temp = data[0]
|
lounge_temp = int(data[0])
|
||||||
break
|
break
|
||||||
lounge_temp = 0
|
|
||||||
|
|
||||||
bom_icons = {
|
bom_icons = {
|
||||||
'sunny': 'SUNNY.JPG',
|
'sunny': 'SUNNY.JPG',
|
||||||
'clear': 'CLEAR.JPG',
|
'clear': 'CLEAR.JPG',
|
||||||
'partly_cloudy': 'PCLOUD.JPG',
|
'partly_cloudy': 'PCLOUD.JPG',
|
||||||
|
'mostly_sunny': 'PCLOUD.JPG',
|
||||||
'cloudy': 'CLOUDY.JPG',
|
'cloudy': 'CLOUDY.JPG',
|
||||||
'haze': 'HAZE.JPG',
|
'haze': 'HAZE.JPG',
|
||||||
'light_rain': 'LRAIN.JPG',
|
'light_rain': 'LRAIN.JPG',
|
||||||
|
@ -61,19 +62,19 @@ wdays_dict = w.forecasts_daily()
|
||||||
new = {}
|
new = {}
|
||||||
weather = {}
|
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
|
# 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.
|
# 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
|
night = 1
|
||||||
|
weather['today'] = wdays_dict[0]
|
||||||
weather['tomorrow'] = wdays_dict[2]
|
weather['tomorrow'] = wdays_dict[2]
|
||||||
weather['day_after'] = wdays_dict[3]
|
weather['day_after'] = wdays_dict[3]
|
||||||
else:
|
else:
|
||||||
night = 0
|
night = 0
|
||||||
|
weather['today'] = wdays_dict[1]
|
||||||
|
weather['tomorrow'] = wdays_dict[2]
|
||||||
|
weather['day_after'] = wdays_dict[3]
|
||||||
|
|
||||||
if night:
|
if night:
|
||||||
for day in weather.keys():
|
for day in weather.keys():
|
||||||
|
|
|
@ -311,8 +311,6 @@ void weatherUpdate(void) {
|
||||||
|
|
||||||
epd_disp_string(buf, 500, 225);
|
epd_disp_string(buf, 500, 225);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Serial.print("Error on HTTP Request: ");
|
Serial.print("Error on HTTP Request: ");
|
||||||
Serial.println(httpCode);
|
Serial.println(httpCode);
|
||||||
|
|
Loading…
Reference in a new issue