delay first connect mqtt message

This commit is contained in:
Robin Appelman 2021-12-30 19:54:49 +01:00
commit b891a34e82

View file

@ -250,14 +250,19 @@ async fn send_update(
),
)
.await?;
client
.publish(
format!("wifi-exporter/{}/state", mac),
QoS::AtLeastOnce,
false,
r#"connected"#,
)
.await?;
let client = client.clone();
spawn(async move {
sleep(Duration::from_millis(1500)).await;
client
.publish(
format!("wifi-exporter/{}/state", mac),
QoS::AtLeastOnce,
false,
r#"connected"#,
)
.await
.ok();
});
}
Update::Connected => {
client