add sleep
This commit is contained in:
		
							parent
							
								
									24432b3743
								
							
						
					
					
						commit
						7a682d1cc4
					
				@ -117,12 +117,7 @@ client = mqtt_client.Client(client_id, protocol=paho.MQTTv31)
 | 
			
		||||
client.username_pw_set(username, password=pw)
 | 
			
		||||
client.on_connect = on_connect
 | 
			
		||||
client.on_message = on_message
 | 
			
		||||
logging.info("test")
 | 
			
		||||
logging.info(value_pvProduction)
 | 
			
		||||
logging.info(value_wHouseConsumption)
 | 
			
		||||
logging.info(value_energyImportExport)
 | 
			
		||||
logging.info(value_houseBatterySoC)
 | 
			
		||||
logging.info(value_houseBatteryLoadUnload)
 | 
			
		||||
 | 
			
		||||
client.connect(broker, port=port)
 | 
			
		||||
 | 
			
		||||
client.loop_start()        #start the loop
 | 
			
		||||
@ -139,8 +134,14 @@ client.subscribe(topic_houseBatteryLoadUnload)
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    while True:
 | 
			
		||||
        time.sleep(1)
 | 
			
		||||
        time.sleep(10)
 | 
			
		||||
        print("-----")
 | 
			
		||||
        logging.info("test")
 | 
			
		||||
        logging.info(value_pvProduction)
 | 
			
		||||
        logging.info(value_wHouseConsumption)
 | 
			
		||||
        logging.info(value_energyImportExport)
 | 
			
		||||
        logging.info(value_houseBatterySoC)
 | 
			
		||||
        logging.info(value_houseBatteryLoadUnload)
 | 
			
		||||
  
 | 
			
		||||
except KeyboardInterrupt:
 | 
			
		||||
    print("exiting")
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user