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,6 +250,9 @@ async fn send_update(
), ),
) )
.await?; .await?;
let client = client.clone();
spawn(async move {
sleep(Duration::from_millis(1500)).await;
client client
.publish( .publish(
format!("wifi-exporter/{}/state", mac), format!("wifi-exporter/{}/state", mac),
@ -257,7 +260,9 @@ async fn send_update(
false, false,
r#"connected"#, r#"connected"#,
) )
.await?; .await
.ok();
});
} }
Update::Connected => { Update::Connected => {
client client