diff --git a/examples/solar-monitoring.py b/examples/date-diff.py similarity index 84% rename from examples/solar-monitoring.py rename to examples/date-diff.py index 69e2e6f..9924493 100644 --- a/examples/solar-monitoring.py +++ b/examples/date-diff.py @@ -9,7 +9,6 @@ if os.path.exists(libdir): import logging from waveshare_epd import epd2in13b_V3 -#import waveshare-epaper import time from PIL import Image,ImageDraw,ImageFont import traceback @@ -17,9 +16,6 @@ import traceback logging.basicConfig(level=logging.DEBUG) - - - #Define Display epd = epd2in13b_V3.EPD() epd.init() @@ -34,9 +30,6 @@ HRYimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red drawblack = ImageDraw.Draw(HBlackimage) #drawry = ImageDraw.Draw(HRYimage) -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - import time import datetime import locale @@ -44,10 +37,13 @@ import locale loc = locale.getlocale() print (loc) -from datetime import datetime, timedelta -# Zwei datetime-Objekte erstellen -start_time = datetime(2024, 6, 1, 0, 0, 0) -end_time = datetime(2024, 6, 10, 0, 0, 0) +from datetime import datetime, timedelta, date +# Zwei datetime-Objekte erstellen +# from datetime import date + +start_time = date.today() +print(start_time.strftime("%d.%m.%Y")) +end_time = date(2025, 6, 10) # Zeitdelta berechnen duration = end_time - start_time print(duration) # Ausgabe: 9 Tage, 2:30:00 @@ -67,7 +63,7 @@ def init_monitor(topics): # Drawing on the Horizontal image logging.info("1.Drawing on the Horizontal image...") - drawblack.text((4, 0), 'PV Production', font = font16, fill = 0) + drawblack.text((4, 0), 'Noch: ' + duration + 'bis', font = font16, fill = 0) drawblack.text((4, 16), 'Hausverbrauch', font = font16, fill = 0) drawblack.text((4, 32), 'Strom Import', font = font16, fill = 0) drawblack.text((4, 48), 'Batterie', font = font16, fill = 0) @@ -85,16 +81,6 @@ def init_monitor(topics): logging.info("Goto Sleep...") epd.sleep() - #except IOError as e: - # logging.info(e) - - #except KeyboardInterrupt: - # logging.info("ctrl + c:") - # epd2in13b_V3.epdconfig.module_exit() - # exit() - - #client.loop_forever() - def run(): try: diff --git a/examples/time-diff.py b/examples/time-diff.py new file mode 100644 index 0000000..e69de29