Compare commits
2 Commits
5255f319f1
...
2127471310
Author | SHA1 | Date | |
---|---|---|---|
|
2127471310 | ||
|
348d6dd2f3 |
@ -9,7 +9,6 @@ if os.path.exists(libdir):
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
from waveshare_epd import epd2in13b_V3
|
from waveshare_epd import epd2in13b_V3
|
||||||
#import waveshare-epaper
|
|
||||||
import time
|
import time
|
||||||
from PIL import Image,ImageDraw,ImageFont
|
from PIL import Image,ImageDraw,ImageFont
|
||||||
import traceback
|
import traceback
|
||||||
@ -17,9 +16,6 @@ import traceback
|
|||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Define Display
|
#Define Display
|
||||||
epd = epd2in13b_V3.EPD()
|
epd = epd2in13b_V3.EPD()
|
||||||
epd.init()
|
epd.init()
|
||||||
@ -34,9 +30,6 @@ HRYimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red
|
|||||||
drawblack = ImageDraw.Draw(HBlackimage)
|
drawblack = ImageDraw.Draw(HBlackimage)
|
||||||
#drawry = ImageDraw.Draw(HRYimage)
|
#drawry = ImageDraw.Draw(HRYimage)
|
||||||
|
|
||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
import locale
|
import locale
|
||||||
@ -44,15 +37,16 @@ import locale
|
|||||||
loc = locale.getlocale()
|
loc = locale.getlocale()
|
||||||
print (loc)
|
print (loc)
|
||||||
|
|
||||||
datum = input('Datum: ')
|
from datetime import datetime, timedelta, date
|
||||||
td = datetime.timedelta(int(input('Abstand: ')))
|
# Zwei datetime-Objekte erstellen
|
||||||
datum1 = time.strptime(datum, '%Y-%m-%d')
|
# from datetime import date
|
||||||
datum2 = (datetime.datetime.fromtimestamp(time.mktime(datum1)) - td)
|
|
||||||
print(datum2.strftime('%Y-%m-%d'))
|
|
||||||
|
|
||||||
print(datum2.strftime('Der Wochentag ist %A'))
|
start_time = date.today()
|
||||||
locale.setlocale(locale.LC_ALL, ('de_DE', 'UTF-8'))
|
print(start_time.strftime("%d.%m.%Y"))
|
||||||
print(datum2.strftime('Der Wochentag ist %A'))
|
end_time = date(2025, 6, 10)
|
||||||
|
# Zeitdelta berechnen
|
||||||
|
duration = end_time - start_time
|
||||||
|
print(duration) # Ausgabe: 9 Tage, 2:30:00
|
||||||
|
|
||||||
def init_monitor(topics):
|
def init_monitor(topics):
|
||||||
|
|
||||||
@ -69,7 +63,7 @@ def init_monitor(topics):
|
|||||||
|
|
||||||
# Drawing on the Horizontal image
|
# Drawing on the Horizontal image
|
||||||
logging.info("1.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, 16), 'Hausverbrauch', font = font16, fill = 0)
|
||||||
drawblack.text((4, 32), 'Strom Import', font = font16, fill = 0)
|
drawblack.text((4, 32), 'Strom Import', font = font16, fill = 0)
|
||||||
drawblack.text((4, 48), 'Batterie', font = font16, fill = 0)
|
drawblack.text((4, 48), 'Batterie', font = font16, fill = 0)
|
||||||
@ -87,16 +81,6 @@ def init_monitor(topics):
|
|||||||
logging.info("Goto Sleep...")
|
logging.info("Goto Sleep...")
|
||||||
epd.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():
|
def run():
|
||||||
try:
|
try:
|
0
examples/time-diff.py
Normal file
0
examples/time-diff.py
Normal file
Loading…
Reference in New Issue
Block a user