change font size
cleanup
This commit is contained in:
parent
acb89d2345
commit
155bfd19f1
@ -103,27 +103,22 @@ client.subscribe(topic_houseBatteryLoadUnload)
|
||||
try:
|
||||
while True:
|
||||
logging.debug("Drawing")
|
||||
font10 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 16)
|
||||
font16 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 16)
|
||||
|
||||
HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
#HRedimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red or yellow image
|
||||
drawblack = ImageDraw.Draw(HBlackimage)
|
||||
#drawred = ImageDraw.Draw(HRedimage)
|
||||
drawblack.text((5, 0), 'PV Produktion', font = font10, fill = 0)
|
||||
#if value_pvProduction < value_wHouseConsumption:
|
||||
#drawred.text((5, 15), 'Hausverbrauch', font = font10, fill = 0)
|
||||
#else:
|
||||
drawblack.text((5, 20), 'Hausverbrauch', font = font10, fill = 0)
|
||||
drawblack.text((5, 0), 'PV Produktion', font = font16, fill = 0)
|
||||
drawblack.text((5, 20), 'Hausverbrauch', font = font16, fill = 0)
|
||||
if value_energyImportExport > 0:
|
||||
drawblack.text((7, 40), 'Strom Import', font = font10, fill = 0)
|
||||
drawblack.text((7, 40), 'Strom Import', font = font16, fill = 0)
|
||||
else:
|
||||
drawblack.text((7, 40), 'Strom Export', font = font10, fill = 0)
|
||||
drawblack.text((7, 40), 'Strom Export', font = font16, fill = 0)
|
||||
|
||||
drawblack.text((5, 60), 'Batterie', font = font10, fill = 0)
|
||||
drawblack.text((5, 60), 'Batterie', font = font16, fill = 0)
|
||||
if value_houseBatteryLoadUnload > 0:
|
||||
drawblack.text((5, 80), 'Batterie Laden', font = font10, fill = 0)
|
||||
drawblack.text((5, 80), 'Batterie Laden', font = font16, fill = 0)
|
||||
else:
|
||||
drawblack.text((5, 80), 'Batterie Entladen', font = font10, fill = 0)
|
||||
drawblack.text((5, 80), 'Batterie Entladen', font = font16, fill = 0)
|
||||
|
||||
logging.info("-----")
|
||||
logging.info("PvProd: "+str(value_pvProduction))
|
||||
@ -132,24 +127,18 @@ try:
|
||||
logging.info("BatSoC: "+str(value_houseBatterySoC))
|
||||
logging.info("BatI/O: "+str(value_houseBatteryLoadUnload))
|
||||
#drawblack.rectangle((150, 0, 220, 50), fill = 255)
|
||||
drawblack.text((150, 0), str(value_pvProduction) + " W", font = font10, fill = 0)
|
||||
drawblack.text((150, 0), str(value_pvProduction) + " W", font = font16, fill = 0)
|
||||
#drawblack.rectangle((150, 15, 220, 50), fill = 255)
|
||||
#if value_pvProduction < value_wHouseConsumption:
|
||||
#drawred.text((150, 15), str(value_wHouseConsumption) + " W", font = font10, fill = 0)
|
||||
#else:
|
||||
drawblack.text((150, 20), str(value_wHouseConsumption) + " W", font = font10, fill = 0)
|
||||
drawblack.text((150, 20), str(value_wHouseConsumption) + " W", font = font16, fill = 0)
|
||||
#drawblack.rectangle((150, 30, 220, 50), fill = 255)
|
||||
if value_energyImportExport < 0:
|
||||
drawblack.text((150, 40), str(-value_energyImportExport) + " W", font = font10, fill = 0)
|
||||
drawblack.text((150, 40), str(-value_energyImportExport) + " W", font = font16, fill = 0)
|
||||
else:
|
||||
drawblack.text((150, 40), str(value_energyImportExport) + " W", font = font10, fill = 0)
|
||||
drawblack.text((150, 40), str(value_energyImportExport) + " W", font = font16, fill = 0)
|
||||
#drawblack.rectangle((150, 60, 220, 50), fill = 0)
|
||||
drawblack.text((150, 60), str(value_houseBatterySoC) + " %", font = font10, fill = 0)
|
||||
drawblack.text((150, 60), str(value_houseBatterySoC) + " %", font = font16, fill = 0)
|
||||
#drawblack.rectangle((150, 75, 220, 50), fill = 255)
|
||||
#if value_houseBatteryLoadUnload > 0:
|
||||
drawblack.text((150, 80), str(value_houseBatteryLoadUnload) + " W", font = font10, fill = 0)
|
||||
#else:
|
||||
#drawred.text((150, 60), str(value_houseBatteryLoadUnload) + " W", font = font10, fill = 0)
|
||||
drawblack.text((150, 80), str(value_houseBatteryLoadUnload) + " W", font = font16, fill = 0)
|
||||
|
||||
epd.display(epd.getbuffer(HBlackimage))
|
||||
time.sleep(10)
|
||||
|
@ -103,27 +103,29 @@ client.subscribe(topic_houseBatteryLoadUnload)
|
||||
try:
|
||||
while True:
|
||||
logging.debug("Drawing")
|
||||
font10 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 12)
|
||||
font16 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 16)
|
||||
|
||||
HBlackimage = Image.new('1', (epd.height, epd.width), 255) # 298*126
|
||||
HRedimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red or yellow image
|
||||
drawblack = ImageDraw.Draw(HBlackimage)
|
||||
drawred = ImageDraw.Draw(HRedimage)
|
||||
drawblack.text((5, 0), 'PV Produktion', font = font10, fill = 0)
|
||||
drawblack.text((5, 0), 'PV Produktion', font = font16, fill = 0)
|
||||
if value_pvProduction < value_wHouseConsumption:
|
||||
drawred.text((5, 15), 'Hausverbrauch', font = font10, fill = 0)
|
||||
drawred.text((5, 20), 'Hausverbrauch', font = font16, fill = 0)
|
||||
else:
|
||||
drawblack.text((5, 15), 'Hausverbrauch', font = font10, fill = 0)
|
||||
drawblack.text((5, 20), 'Hausverbrauch', font = font16, fill = 0)
|
||||
if value_energyImportExport > 0:
|
||||
drawred.text((5, 30), 'Strom Import', font = font10, fill = 0)
|
||||
drawred.text((5, 40), 'Strom Import', font = font16, fill = 0)
|
||||
else:
|
||||
drawblack.text((5, 30), 'Strom Export', font = font10, fill = 0)
|
||||
drawblack.text((5, 40), 'Strom Export', font = font16, fill = 0)
|
||||
|
||||
drawblack.text((5, 45), 'Batterie', font = font10, fill = 0)
|
||||
drawblack.text((5, 60), 'Batterie', font = font16, fill = 0)
|
||||
if value_houseBatteryLoadUnload > 0:
|
||||
drawblack.text((5, 60), 'Batterie Laden', font = font10, fill = 0)
|
||||
drawblack.text((5, 80), 'Batterie Laden', font = font16, fill = 0)
|
||||
elif value_houseBatteryLoadUnload < 0:
|
||||
drawred.text((5, 80), 'Batterie Entladen', font = font16, fill = 0)
|
||||
else:
|
||||
drawred.text((5, 60), 'Batterie Entladen', font = font10, fill = 0)
|
||||
drawred.text((5, 80), 'Batterie', font = font16, fill = 0)
|
||||
|
||||
logging.info("-----")
|
||||
logging.info("PvProd: "+str(value_pvProduction))
|
||||
@ -131,25 +133,20 @@ try:
|
||||
logging.info("EneI/E: "+str(value_energyImportExport))
|
||||
logging.info("BatSoC: "+str(value_houseBatterySoC))
|
||||
logging.info("BatI/O: "+str(value_houseBatteryLoadUnload))
|
||||
#drawblack.rectangle((150, 0, 220, 50), fill = 255)
|
||||
drawblack.text((150, 0), str(value_pvProduction) + " W", font = font10, fill = 0)
|
||||
#drawblack.rectangle((150, 15, 220, 50), fill = 255)
|
||||
drawblack.text((150, 0), str(value_pvProduction) + " W", font = font16, fill = 0)
|
||||
if value_pvProduction < value_wHouseConsumption:
|
||||
drawred.text((150, 15), str(value_wHouseConsumption) + " W", font = font10, fill = 0)
|
||||
drawred.text((150, 20), str(value_wHouseConsumption) + " W", font = font16, fill = 0)
|
||||
else:
|
||||
drawblack.text((150, 15), str(value_wHouseConsumption) + " W", font = font10, fill = 0)
|
||||
#drawblack.rectangle((150, 30, 220, 50), fill = 255)
|
||||
drawblack.text((150, 20), str(value_wHouseConsumption) + " W", font = font16, fill = 0)
|
||||
if value_energyImportExport > 0:
|
||||
drawred.text((150, 30), str(value_energyImportExport) + " W", font = font10, fill = 0)
|
||||
drawred.text((150, 40), str(value_energyImportExport) + " W", font = font16, fill = 0)
|
||||
else:
|
||||
drawblack.text((150, 30), str(value_energyImportExport) + " W", font = font10, fill = 0)
|
||||
#drawblack.rectangle((150, 45, 220, 50), fill = 255)
|
||||
drawblack.text((150, 45), str(value_houseBatterySoC) + " %", font = font10, fill = 0)
|
||||
#drawblack.rectangle((150, 60, 220, 50), fill = 255)
|
||||
drawblack.text((150, 40), str(value_energyImportExport) + " W", font = font16, fill = 0)
|
||||
drawblack.text((150, 60), str(value_houseBatterySoC) + " %", font = font16, fill = 0)
|
||||
if value_houseBatteryLoadUnload > 0:
|
||||
drawblack.text((150, 60), str(value_houseBatteryLoadUnload) + " W", font = font10, fill = 0)
|
||||
drawblack.text((150, 80), str(value_houseBatteryLoadUnload) + " W", font = font16, fill = 0)
|
||||
else:
|
||||
drawred.text((150, 60), str(value_houseBatteryLoadUnload) + " W", font = font10, fill = 0)
|
||||
drawred.text((150, 80), str(value_houseBatteryLoadUnload) + " W", font = font16, fill = 0)
|
||||
|
||||
epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage))
|
||||
time.sleep(10)
|
Loading…
Reference in New Issue
Block a user