retain published messages
This commit is contained in:
		
							parent
							
								
									dd4cc98bd0
								
							
						
					
					
						commit
						c23dafc732
					
				| @ -77,7 +77,7 @@ def update_disc(client:mqtt, disc_message:dict)->None: | ||||
|         client (mqtt): MQTT Client | ||||
|         disc_message (dict): Current disc information | ||||
|     """ | ||||
|     client.publish("homeassistant/sensor/floppy_player/current_disc/state", json.dumps(disc_message)) | ||||
|     client.publish("homeassistant/sensor/floppy_player/current_disc/state", json.dumps(disc_message), retain=True) | ||||
|     print(f"Published current disc: {disc_message}") | ||||
| 
 | ||||
| 
 | ||||
| @ -88,6 +88,6 @@ def control_player(client:mqtt, state:str)->None: | ||||
|         client (mqtt): MQTT Client | ||||
|         state (str): Player State | ||||
|     """     | ||||
|     client.publish("homeassistant/sensor/floppy_player/status/state", state) | ||||
|     client.publish("homeassistant/sensor/floppy_player/status/state", state, retain=True) | ||||
|     print(f"Published status: {state}") | ||||
|      | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Karl Hudgell
						Karl Hudgell