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)