From 5966c6249edcffb1fde263dfc55f0abe6f8c56ec Mon Sep 17 00:00:00 2001 From: Paul Warren Date: Sat, 29 Jan 2022 06:54:49 +1100 Subject: [PATCH] daytime bugfixes for bom_rrd2 --- bom_rrd2.py | 19 ++++++++++--------- esp_time.ino | 4 +--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/bom_rrd2.py b/bom_rrd2.py index 3f2cbdf..878e351 100755 --- a/bom_rrd2.py +++ b/bom_rrd2.py @@ -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(): diff --git a/esp_time.ino b/esp_time.ino index cbc42ff..28a1e56 100644 --- a/esp_time.ino +++ b/esp_time.ino @@ -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);