re-order
This commit is contained in:
parent
fc7d944ce0
commit
816ac7af21
@ -17,7 +17,6 @@ import traceback
|
|||||||
# Import MQTT client.
|
# Import MQTT client.
|
||||||
from paho.mqtt import client as mqtt_client
|
from paho.mqtt import client as mqtt_client
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
# MQTT credentials
|
# MQTT credentials
|
||||||
@ -66,6 +65,19 @@ topic6 = {
|
|||||||
|
|
||||||
topics = {0:topic0,1:topic1,2:topic2,3:topic3,4:topic4,5:topic5,6:topic6}
|
topics = {0:topic0,1:topic1,2:topic2,3:topic3,4:topic4,5:topic5,6:topic6}
|
||||||
|
|
||||||
|
#Define Display
|
||||||
|
epd = epd2in13b_V3.EPD()
|
||||||
|
epd.init()
|
||||||
|
|
||||||
|
#Set fonts
|
||||||
|
font16 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 16)
|
||||||
|
font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18)
|
||||||
|
|
||||||
|
#Init 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)
|
||||||
|
|
||||||
def connect_mqtt():
|
def connect_mqtt():
|
||||||
def on_connect(client, userdata, flags, rc):
|
def on_connect(client, userdata, flags, rc):
|
||||||
@ -93,26 +105,18 @@ def subscribe(client: mqtt_client, topic):
|
|||||||
def init_monitor(topics):
|
def init_monitor(topics):
|
||||||
|
|
||||||
logging.info("epd2in13b_V3 Demo")
|
logging.info("epd2in13b_V3 Demo")
|
||||||
logging.info(libdir)
|
|
||||||
logging.info(picdir)
|
|
||||||
|
|
||||||
epd = epd2in13b_V3.EPD()
|
#epd = epd2in13b_V3.EPD()
|
||||||
#epd = epaper.epaper('epd2in13b_V3').EPD()
|
#epd.init()
|
||||||
#logging.info("init and Clear")
|
|
||||||
epd.init()
|
|
||||||
#epd.Clear()
|
#epd.Clear()
|
||||||
|
|
||||||
# Drawing on the image
|
# Drawing on the image
|
||||||
logging.info("Drawing")
|
#logging.info("Drawing")
|
||||||
font16 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 16)
|
#font16 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 16)
|
||||||
font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18)
|
#font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18)
|
||||||
|
|
||||||
# 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...")
|
||||||
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((4, 0), 'PV Production', font = font16, fill = 0)
|
drawblack.text((4, 0), 'PV Production', 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)
|
||||||
@ -164,7 +168,5 @@ def run():
|
|||||||
print(topic_info["value"])
|
print(topic_info["value"])
|
||||||
drawblack.text((160, int(topic_info["line"])), str(topic_info["value"]), font = font16, fill = 0)
|
drawblack.text((160, int(topic_info["line"])), str(topic_info["value"]), font = font16, fill = 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
run()
|
run()
|
Loading…
Reference in New Issue
Block a user