From 420c6c3a2c3ba38d296047ca696507f649b910e3 Mon Sep 17 00:00:00 2001 From: llevet Date: Wed, 21 Oct 2020 20:33:35 +0200 Subject: [PATCH 1/2] Add Humidity and pressure on desktop Add actual humidity and pressure beside forecast. --- WeatherPiTFT.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/WeatherPiTFT.py b/WeatherPiTFT.py index a2780d4..3819036 100755 --- a/WeatherPiTFT.py +++ b/WeatherPiTFT.py @@ -701,6 +701,8 @@ def create_surface(): temp_out = str(int(current_forecast['temp'])) temp_out_unit = '°C' if METRIC else '°F' temp_out_string = str(temp_out + temp_out_unit) + rh_out_string = str(int(current_forecast['rh']))+' %' + pres_out = str(int(current_forecast['pres'])) precip = JSON_DATA['daily']['data'][0]['pop'] precip_string = str(f'{precip} %') @@ -774,13 +776,17 @@ def create_surface(): DrawString(new_surf, precip_string, FONT_BIG, PRECIPCOLOR, 105).right() DrawString(new_surf, PRECIPTYPE, FONT_SMALL_BOLD, PRECIPCOLOR, 140).right() - DrawString(new_surf, day_1_ts, FONT_SMALL_BOLD, ORANGE, 165).center(3, 0) - DrawString(new_surf, day_2_ts, FONT_SMALL_BOLD, ORANGE, 165).center(3, 1) - DrawString(new_surf, day_3_ts, FONT_SMALL_BOLD, ORANGE, 165).center(3, 2) - - DrawString(new_surf, day_1_min_max_temp, FONT_SMALL_BOLD, MAIN_FONT, 180).center(3, 0) - DrawString(new_surf, day_2_min_max_temp, FONT_SMALL_BOLD, MAIN_FONT, 180).center(3, 1) - DrawString(new_surf, day_3_min_max_temp, FONT_SMALL_BOLD, MAIN_FONT, 180).center(3, 2) + DrawString(new_surf, day_1_ts, FONT_SMALL_BOLD, ORANGE, 165).center(4, 0) + DrawString(new_surf, day_2_ts, FONT_SMALL_BOLD, ORANGE, 165).center(4, 1) + DrawString(new_surf, day_3_ts, FONT_SMALL_BOLD, ORANGE, 165).center(4, 2) + DrawString(new_surf, config['LOCALE']['HUMIDITY_STR'], FONT_SMALL_BOLD, VIOLET, 172).center(4, 3) + DrawString(new_surf, config['LOCALE']['PRESSURE_STR'], FONT_SMALL_BOLD, VIOLET, 207).center(4, 3) + + DrawString(new_surf, day_1_min_max_temp, FONT_SMALL_BOLD, MAIN_FONT, 180).center(4, 0) + DrawString(new_surf, day_2_min_max_temp, FONT_SMALL_BOLD, MAIN_FONT, 180).center(4, 1) + DrawString(new_surf, day_3_min_max_temp, FONT_SMALL_BOLD, MAIN_FONT, 180).center(4, 2) + DrawString(new_surf, rh_out_string, FONT_SMALL_BOLD, MAIN_FONT, 187).center(4, 3) + DrawString(new_surf, pres_out, FONT_SMALL_BOLD, MAIN_FONT, 222).center(4, 3) DrawString(new_surf, sunrise, FONT_SMALL_BOLD, MAIN_FONT, 265).left(30) DrawString(new_surf, sunset, FONT_SMALL_BOLD, MAIN_FONT, 292).left(30) From 3021cc9599d8af06f214d9eea72d8cc525d4687f Mon Sep 17 00:00:00 2001 From: llevet Date: Thu, 22 Oct 2020 18:02:25 +0200 Subject: [PATCH 2/2] update pressure reference Change pressure reference pres->slp pres = Pressure of the location in millibars slp = Sea level adjusted pressure of location in millibars --- WeatherPiTFT.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WeatherPiTFT.py b/WeatherPiTFT.py index 3819036..d30f2c2 100755 --- a/WeatherPiTFT.py +++ b/WeatherPiTFT.py @@ -702,7 +702,7 @@ def create_surface(): temp_out_unit = '°C' if METRIC else '°F' temp_out_string = str(temp_out + temp_out_unit) rh_out_string = str(int(current_forecast['rh']))+' %' - pres_out = str(int(current_forecast['pres'])) + slp_out = str(int(current_forecast['slp'])) precip = JSON_DATA['daily']['data'][0]['pop'] precip_string = str(f'{precip} %') @@ -786,7 +786,7 @@ def create_surface(): DrawString(new_surf, day_2_min_max_temp, FONT_SMALL_BOLD, MAIN_FONT, 180).center(4, 1) DrawString(new_surf, day_3_min_max_temp, FONT_SMALL_BOLD, MAIN_FONT, 180).center(4, 2) DrawString(new_surf, rh_out_string, FONT_SMALL_BOLD, MAIN_FONT, 187).center(4, 3) - DrawString(new_surf, pres_out, FONT_SMALL_BOLD, MAIN_FONT, 222).center(4, 3) + DrawString(new_surf, slp_out, FONT_SMALL_BOLD, MAIN_FONT, 222).center(4, 3) DrawString(new_surf, sunrise, FONT_SMALL_BOLD, MAIN_FONT, 265).left(30) DrawString(new_surf, sunset, FONT_SMALL_BOLD, MAIN_FONT, 292).left(30)