add label

This commit is contained in:
Robert Borzutzki 2022-10-19 15:16:32 +02:00
parent 79deb2c7a5
commit 636a76a4e7

View File

@ -38,13 +38,13 @@ try:
#HRedimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red or yellow image #HRedimage = Image.new('1', (epd.height, epd.width), 255) # 298*126 ryimage: red or yellow image
drawblack = ImageDraw.Draw(HBlackimage) drawblack = ImageDraw.Draw(HBlackimage)
#drawred = ImageDraw.Draw(HRedimage) #drawred = ImageDraw.Draw(HRedimage)
#drawblack.text((5, 0), 'PV Produktion', font = font10, fill = 0) drawblack.text((5, 0), 'PV Produktion', font = font10, fill = 0)
#drawblack.text((5, 15), 'Hausverbrauch', font = font10, fill = 0) drawblack.text((5, 15), 'Hausverbrauch', font = font10, fill = 0)
#drawblack.text((5, 30), 'Strom Import/Export', font = font10, fill = 0) drawblack.text((5, 30), 'Strom Import/Export', font = font10, fill = 0)
#drawblack.text((5, 45), 'Batterie %', font = font10, fill = 0) drawblack.text((5, 45), 'Batterie %', font = font10, fill = 0)
#drawblack.text((5, 60), 'Batterie Laden/Entladen', font = font10, fill = 0) drawblack.text((5, 60), 'Batterie Laden/Entladen', font = font10, fill = 0)
#epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage)) #epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRedimage))
#epd.DisplayPartial(epd.getbuffer(HBlackimage)) epd.DisplayPartial(epd.getbuffer(HBlackimage))
values_image = Image.new('1', (epd.height, epd.width), 255) values_image = Image.new('1', (epd.height, epd.width), 255)
values_draw = ImageDraw.Draw(values_image) values_draw = ImageDraw.Draw(values_image)
@ -82,7 +82,7 @@ def on_message(client, userdata, msg):
line = 60 line = 60
print(line) print(line)
values_draw.rectangle((150, line, 220, 50), fill = 255) values_draw.rectangle((150, line, 220, 50), fill = 0)
values_draw.text((150, line), msg.payload.decode(), font = font10, fill = 0) values_draw.text((150, line), msg.payload.decode(), font = font10, fill = 0)
epd.DisplayPartial(epd.getbuffer(values_image)) epd.DisplayPartial(epd.getbuffer(values_image))
time.sleep(1) time.sleep(1)