diff --git a/src/platform/esp32.rs b/src/platform/esp32.rs index 6edd73e..5b50c3e 100644 --- a/src/platform/esp32.rs +++ b/src/platform/esp32.rs @@ -286,12 +286,13 @@ impl MqttTask { } } - fn start_mqtt(&mut self) { + fn start_mqtt(&mut self, bus: &EventBus) { log::info!("Starting MQTT"); + let chip_id: u64 = bus.property("system.board.chip_id").unwrap().into(); let (client, mut conn) = EspMqttClient::new( "mqtt://10.0.0.2:1883", &MqttClientConfiguration { - client_id: Some("renderbug-rs"), + client_id: Some(&format!("{:X}", chip_id)), ..Default::default() } ).unwrap(); @@ -322,7 +323,7 @@ impl Task for MqttTask { ("system.network.online", Variant::Boolean(true)) => { log::info!("Registering with MQTT"); - self.start_mqtt(); + self.start_mqtt(bus); if let Some(ref mut client) = self.client { client.enqueue(