From b9c2cc742d3bca9054f8f21bfaf24c911cfc8fed Mon Sep 17 00:00:00 2001 From: Robert Borzutzki Date: Wed, 19 Oct 2022 19:30:44 +0200 Subject: [PATCH] logging --- examples/mqtt.py | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/examples/mqtt.py b/examples/mqtt.py index f1630e0..045c647 100644 --- a/examples/mqtt.py +++ b/examples/mqtt.py @@ -31,18 +31,6 @@ username = "mqtt-user" pw = "phio6yiR9ohs1veeghu4WaeGhaiRi8he4EiWasheev4faeku8tohdiuthah7zahP" client_id = "solarmonitor" -# global value_pvProduction -# global value_wHouseConsumption -# global value_energyImportExport -# global value_houseBatterySoC -# global value_houseBatteryLoadUnload - -# value_pvProduction = "0" -# value_wHouseConsumption = "0" -# value_energyImportExport = "0" -# value_houseBatterySoC = "0" -# value_houseBatteryLoadUnload = "0" - try: logging.info("epd2in13bc Demo") @@ -70,9 +58,6 @@ try: #epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage)) epd.display(epd.getbuffer(HBlackimage)) - #values_image = Image.new('1', (epd.height, epd.width), 255) - #values_draw = ImageDraw.Draw(values_image) - time.sleep(2) except IOError as e: @@ -117,11 +102,11 @@ def on_message(client, userdata, msg): line = 60 print(line) - print(value_pvProduction) - print(value_wHouseConsumption) - print(value_energyImportExport) - print(value_houseBatterySoC) - print(value_houseBatteryLoadUnload) + print("PvP: "+value_pvProduction) + print("Hou: "+value_wHouseConsumption) + print("I/E: "+value_energyImportExport) + print("SoC: "+value_houseBatterySoC) + print("Bio: "+value_houseBatteryLoadUnload) #print(f"`{msg.topic}`: `{msg.payload.decode()}`") @@ -156,11 +141,11 @@ try: time.sleep(10) print("-----") logging.info("test") - logging.info(value_pvProduction) - logging.info(value_wHouseConsumption) - logging.info(value_energyImportExport) - logging.info(value_houseBatterySoC) - logging.info(value_houseBatteryLoadUnload) + logging.info("PvP: "+value_pvProduction) + logging.info("Hou: "+value_wHouseConsumption) + logging.info("I/E: "+value_energyImportExport) + logging.info("SoC: "+value_houseBatterySoC) + logging.info("Bio: "+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)