diff --git a/examples/mqtt.py b/examples/mqtt.py index fc32a62..b21c88d 100644 --- a/examples/mqtt.py +++ b/examples/mqtt.py @@ -127,10 +127,7 @@ def on_message(client, userdata, msg): print(value_energyImportExport) print(topic_houseBatterySoC) print(topic_houseBatteryLoadUnload) - - drawblack.rectangle((150, line, 220, 50), fill = 255) - drawblack.text((150, line), msg.payload.decode(), font = font10, fill = 0) - epd.DisplayPartial(epd.getbuffer(HBlackimage)) + #print(f"`{msg.topic}`: `{msg.payload.decode()}`") client = mqtt_client.Client(client_id, protocol=paho.MQTTv31) @@ -162,6 +159,18 @@ try: logging.info(value_energyImportExport) logging.info(value_houseBatterySoC) logging.info(value_houseBatteryLoadUnload) + drawblack.rectangle((150, 0, 220, 50), fill = 255) + drawblack.text((150, 0), value_pvProduction, font = font10, fill = 0) + 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) + 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) + drawblack.text((150, 60), value_houseBatteryLoadUnload, font = font10, fill = 0) + + epd.DisplayPartial(epd.getbuffer(HBlackimage)) except KeyboardInterrupt: print("exiting")