change
This commit is contained in:
		
							parent
							
								
									fbb22a3572
								
							
						
					
					
						commit
						fc7d944ce0
					
				@ -90,7 +90,7 @@ def subscribe(client: mqtt_client, topic):
 | 
			
		||||
    client.on_message = on_message
 | 
			
		||||
    client.loop_stop()
 | 
			
		||||
 | 
			
		||||
def monitor(topics):
 | 
			
		||||
def init_monitor(topics):
 | 
			
		||||
    
 | 
			
		||||
    logging.info("epd2in13b_V3 Demo")
 | 
			
		||||
    logging.info(libdir)
 | 
			
		||||
@ -120,21 +120,6 @@ def monitor(topics):
 | 
			
		||||
    drawblack.text((4, 64), 'Batterie Entladen', font = font16, fill = 0)
 | 
			
		||||
    drawblack.text((4, 80), 'Auto Laden', font = font16, fill = 0)
 | 
			
		||||
    
 | 
			
		||||
    for topic_id, topic_info in topics.items():
 | 
			
		||||
        print("\nTopic ID:", topic_id)
 | 
			
		||||
    
 | 
			
		||||
        for key in topic_info:
 | 
			
		||||
            print(key + ':', topic_info[key])
 | 
			
		||||
            print(topic_info["line"])
 | 
			
		||||
            print(topic_info["value"])
 | 
			
		||||
            drawblack.text((160, int(topic_info["line"])), str(topic_info["value"]), font = font16, fill = 0)
 | 
			
		||||
 | 
			
		||||
    #drawblack.text((160, 16), str(house_power), font = font16, fill = 0)
 | 
			
		||||
    #drawblack.text((160, 32), str(power_import_export), font = font16, fill = 0)
 | 
			
		||||
    #drawblack.text((160, 48), str(house_battery_soc), font = font16, fill = 0)
 | 
			
		||||
    #drawblack.text((160, 64), str(house_battery_power), font = font16, fill = 0)
 | 
			
		||||
    #drawblack.text((160, 80), str(charge_point_power), font = font16, fill = 0)
 | 
			
		||||
    
 | 
			
		||||
    epd.display(epd.getbuffer(HBlackimage), epd.getbuffer(HRYimage))
 | 
			
		||||
 | 
			
		||||
    #logging.info("Clear...")
 | 
			
		||||
@ -156,17 +141,8 @@ def monitor(topics):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def run():
 | 
			
		||||
    client = connect_mqtt()
 | 
			
		||||
 | 
			
		||||
    for topic_id, topic_info in topics.items():
 | 
			
		||||
        print("\nTopic ID:", topic_id)
 | 
			
		||||
    
 | 
			
		||||
        for key in topic_info:
 | 
			
		||||
            print(key + ':', topic_info[key])
 | 
			
		||||
            topic_info["value"] = subscribe(client, topic_info["topic"])
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        monitor(topics)
 | 
			
		||||
        init_monitor(topics)
 | 
			
		||||
 | 
			
		||||
    except IOError as e:
 | 
			
		||||
        logging.info(e)
 | 
			
		||||
@ -176,6 +152,19 @@ def run():
 | 
			
		||||
        epd2in13b_V3.epdconfig.module_exit()
 | 
			
		||||
        exit()
 | 
			
		||||
    
 | 
			
		||||
    client = connect_mqtt()
 | 
			
		||||
 | 
			
		||||
    for topic_id, topic_info in topics.items():
 | 
			
		||||
        print("\nTopic ID:", topic_id)
 | 
			
		||||
    
 | 
			
		||||
        for key in topic_info:
 | 
			
		||||
            print(key + ':', topic_info[key])
 | 
			
		||||
            topic_info["value"] = subscribe(client, topic_info["topic"])
 | 
			
		||||
            print(topic_info["line"])
 | 
			
		||||
            print(topic_info["value"])
 | 
			
		||||
            drawblack.text((160, int(topic_info["line"])), str(topic_info["value"]), font = font16, fill = 0)
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    run()          
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user