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