test
This commit is contained in:
		
							parent
							
								
									e901d8db8f
								
							
						
					
					
						commit
						e09adbaea3
					
				@ -64,34 +64,36 @@ def subscribe(client: mqtt_client, topic):
 | 
				
			|||||||
    client.loop_stop()
 | 
					    client.loop_stop()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def monitor(charge_point_power):
 | 
					def monitor(charge_point_power):
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    logging.info("epd2in13b_V3 Demo")
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    epd = epd2in13b_V3.EPD()
 | 
				
			||||||
 | 
					    #epd = epaper.epaper('epd2in13b_V3').EPD()
 | 
				
			||||||
 | 
					    #logging.info("init and Clear")
 | 
				
			||||||
 | 
					    #epd.init()
 | 
				
			||||||
 | 
					    #epd.Clear()
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    # Drawing on the image
 | 
				
			||||||
 | 
					    logging.info("Drawing")    
 | 
				
			||||||
 | 
					    font16 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 16)
 | 
				
			||||||
 | 
					    font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18)
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    # 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((2, 0), 'PV Production', font = font16, fill = 0)
 | 
				
			||||||
 | 
					    drawblack.text((2, 16), 'Hausverbrauch', font = font16, fill = 0)
 | 
				
			||||||
 | 
					    drawblack.text((2, 32), 'Strom Import', font = font16, fill = 0)
 | 
				
			||||||
 | 
					    drawblack.text((2, 48), 'Batterie', font = font16, fill = 0)
 | 
				
			||||||
 | 
					    drawblack.text((2, 64), 'Batterie Entladen', font = font16, fill = 0)
 | 
				
			||||||
 | 
					    drawblack.text((2, 80), 'Auto Laden', font = font16, fill = 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #drawblack.text((100, 80), str(charge_point_power), font = font16, fill = 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        logging.info("epd2in13b_V3 Demo")
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        epd = epd2in13b_V3.EPD()
 | 
					 | 
				
			||||||
        #epd = epaper.epaper('epd2in13b_V3').EPD()
 | 
					 | 
				
			||||||
        #logging.info("init and Clear")
 | 
					 | 
				
			||||||
        #epd.init()
 | 
					 | 
				
			||||||
        #epd.Clear()
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        # Drawing on the image
 | 
					 | 
				
			||||||
        logging.info("Drawing")    
 | 
					 | 
				
			||||||
        font16 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 16)
 | 
					 | 
				
			||||||
        font18 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 18)
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        # 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((2, 0), 'PV Production', font = font16, fill = 0)
 | 
					 | 
				
			||||||
        drawblack.text((2, 16), 'Hausverbrauch', font = font16, fill = 0)
 | 
					 | 
				
			||||||
        drawblack.text((2, 32), 'Strom Import', font = font16, fill = 0)
 | 
					 | 
				
			||||||
        drawblack.text((2, 48), 'Batterie', font = font16, fill = 0)
 | 
					 | 
				
			||||||
        drawblack.text((2, 64), 'Batterie Entladen', font = font16, fill = 0)
 | 
					 | 
				
			||||||
        drawblack.text((2, 80), 'Auto Laden', font = font16, fill = 0)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        #drawblack.text((100, 80), str(charge_point_power), font = font16, fill = 0)
 | 
					 | 
				
			||||||
        epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
 | 
					        epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #logging.info("Clear...")
 | 
					        #logging.info("Clear...")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user