From 0f4234ab6c3c108b56cade300a3cc0ce35f20b04 Mon Sep 17 00:00:00 2001 From: Robert Borzutzki Date: Wed, 19 Oct 2022 09:21:28 +0200 Subject: [PATCH] default information --- examples/mqtt.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/examples/mqtt.py b/examples/mqtt.py index 63cf6e1..b7df022 100644 --- a/examples/mqtt.py +++ b/examples/mqtt.py @@ -19,6 +19,39 @@ logging.basicConfig(level=logging.DEBUG) Connected = False +try: + logging.info("epd2in13bc Demo") + + epd = epd2in13bc.EPD() + logging.info("init and Clear") + epd.init() + epd.Clear() + time.sleep(1) + + # Drawing on the image + logging.info("Drawing") + font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18) + + # Drawing on the Horizontal image + logging.info("1.Drawing on the Horizontal image...") + HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 + HRYimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red or yellow image + drawblack = ImageDraw.Draw(HBlackimage) + drawry = ImageDraw.Draw(HRYimage) + drawblack.text((10, 0), 'PV Produktion', font = font18, fill = 0) + drawblack.text((10, 20), 'Hausverbrauch', font = font18, fill = 0) + drawblack.text((10, 40), 'Strom Import/Export', font = font18, fill = 0) + drawblack.text((10, 60), 'Batterie %', font = font18, fill = 0) + drawblack.text((10, 80), 'Batterie Laden/Entladen', font = font18, fill = 0) + +except IOError as e: + logging.info(e) + +except KeyboardInterrupt: + logging.info("ctrl + c:") + epd2in13bc.epdconfig.module_exit() + exit() + def on_connect(client, userdata, flags, rc): if rc == 0: