From 31da7421a2a8bfd56b22674eaa8df1fff8044076 Mon Sep 17 00:00:00 2001 From: Robert Borzutzki Date: Wed, 19 Oct 2022 21:04:43 +0200 Subject: [PATCH] add red black energy import export --- examples/mqtt.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/mqtt.py b/examples/mqtt.py index 92e1826..e98566b 100644 --- a/examples/mqtt.py +++ b/examples/mqtt.py @@ -113,7 +113,11 @@ try: drawred = ImageDraw.Draw(HRedimage) drawblack.text((5, 0), 'PV Produktion', font = font10, fill = 0) drawblack.text((5, 15), 'Hausverbrauch', font = font10, fill = 0) - drawblack.text((5, 30), 'Strom Import/Export', font = font10, fill = 0) + if value_energyImportExport > 0: + drawred.text((5, 30), 'Strom Import', font = font10, fill = 0) + else: + drawblack.text((5, 30), 'Strom Export', font = font10, fill = 0) + drawblack.text((5, 45), 'Batterie %', font = font10, fill = 0) drawblack.text((5, 60), 'Batterie Laden/Entladen', font = font10, fill = 0) #epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage)) @@ -131,7 +135,10 @@ try: #drawblack.rectangle((150, 15, 220, 50), fill = 255) drawblack.text((150, 15), value_wHouseConsumption, font = font10, fill = 0) #drawblack.rectangle((150, 30, 220, 50), fill = 255) - drawblack.text((150, 30), value_energyImportExport, font = font10, fill = 0) + if value_energyImportExport > 0: + drawred.text((150, 30), value_energyImportExport, font = font10, fill = 0) + else: + drawblack.text((150, 30), value_energyImportExport, font = font10, fill = 0) #drawblack.rectangle((150, 45, 220, 50), fill = 255) drawblack.text((150, 45), value_houseBatterySoC, font = font10, fill = 0) #drawblack.rectangle((150, 60, 220, 50), fill = 255)