From 83cf85988bc57d3ef32feb089741b88ed0283fbe Mon Sep 17 00:00:00 2001 From: Robert Borzutzki Date: Wed, 19 Oct 2022 21:16:13 +0200 Subject: [PATCH] add "W" and color load unload battery --- examples/mqtt.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/mqtt.py b/examples/mqtt.py index 5e34e05..0571892 100644 --- a/examples/mqtt.py +++ b/examples/mqtt.py @@ -119,7 +119,10 @@ try: 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) + if value_houseBatteryLoadUnload > 0: + drawblack.text((5, 30), 'Batterie Laden', font = font10, fill = 0) + else: + drawred.text((5, 60), 'Batterie Entladen', font = font10, fill = 0) #epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage)) #epd.display(epd.getbuffer(HBlackimage)) @@ -136,13 +139,17 @@ try: drawblack.text((150, 15), str(value_wHouseConsumption), font = font10, fill = 0) #drawblack.rectangle((150, 30, 220, 50), fill = 255) if value_energyImportExport > 0: - drawred.text((150, 30), str(value_energyImportExport), font = font10, fill = 0) + drawred.text((150, 30), str(value_energyImportExport) + " W", font = font10, fill = 0) else: - drawblack.text((150, 30), str(value_energyImportExport), font = font10, fill = 0) + drawblack.text((150, 30), str(value_energyImportExport) * " W", font = font10, fill = 0) #drawblack.rectangle((150, 45, 220, 50), fill = 255) drawblack.text((150, 45), str(value_houseBatterySoC), font = font10, fill = 0) #drawblack.rectangle((150, 60, 220, 50), fill = 255) - drawblack.text((150, 60), str(value_houseBatteryLoadUnload), font = font10, fill = 0) + if value_houseBatteryLoadUnload > 0: + drawblack.text((150, 60), str(value_houseBatteryLoadUnload) + " W", font = font10, fill = 0) + else: + drawred.text((150, 60), str(value_houseBatteryLoadUnload) + " W", font = font10, fill = 0) + epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage))