From 5725cb312360d2d6e1e4f85d7a2c829cc9e7d750 Mon Sep 17 00:00:00 2001 From: Robert Borzutzki Date: Wed, 19 Oct 2022 21:29:50 +0200 Subject: [PATCH] add color for house energy usage --- examples/mqtt.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/mqtt.py b/examples/mqtt.py index 0410f9a..fc4323f 100644 --- a/examples/mqtt.py +++ b/examples/mqtt.py @@ -109,7 +109,10 @@ try: drawblack = ImageDraw.Draw(HBlackimage) drawred = ImageDraw.Draw(HRedimage) drawblack.text((5, 0), 'PV Produktion', font = font10, fill = 0) - drawblack.text((5, 15), 'Hausverbrauch', font = font10, fill = 0) + if value_pvProduction < value_wHouseConsumption: + drawred.text((5, 15), 'Hausverbrauch', font = font10, fill = 0) + else: + drawblack.text((5, 15), 'Hausverbrauch', font = font10, fill = 0) if value_energyImportExport > 0: drawred.text((5, 30), 'Strom Import', font = font10, fill = 0) else: @@ -130,7 +133,10 @@ try: #drawblack.rectangle((150, 0, 220, 50), fill = 255) drawblack.text((150, 0), str(value_pvProduction) + " W", font = font10, fill = 0) #drawblack.rectangle((150, 15, 220, 50), fill = 255) - drawblack.text((150, 15), str(value_wHouseConsumption) + " W", font = font10, fill = 0) + if value_pvProduction < value_wHouseConsumption: + drawred.text((150, 15), str(value_wHouseConsumption) + " W", font = font10, fill = 0) + else: + drawblack.text((150, 15), str(value_wHouseConsumption) + " W", font = font10, fill = 0) #drawblack.rectangle((150, 30, 220, 50), fill = 255) if value_energyImportExport > 0: drawred.text((150, 30), str(value_energyImportExport) + " W", font = font10, fill = 0)