mirror of
https://codeberg.org/icewind/wifi-prometheus-exporter.git
synced 2026-06-03 16:44:11 +02:00
retain config message
This commit is contained in:
parent
57b013f9e6
commit
249d9cd579
1 changed files with 4 additions and 5 deletions
|
|
@ -202,7 +202,7 @@ async fn send_update(
|
||||||
.publish(
|
.publish(
|
||||||
format!("homeassistant/device_tracker/wifi-{}/config", mac),
|
format!("homeassistant/device_tracker/wifi-{}/config", mac),
|
||||||
QoS::AtLeastOnce,
|
QoS::AtLeastOnce,
|
||||||
false,
|
true,
|
||||||
format!(
|
format!(
|
||||||
r#"{{
|
r#"{{
|
||||||
"state_topic": "wifi-exporter/{mac}/state",
|
"state_topic": "wifi-exporter/{mac}/state",
|
||||||
|
|
@ -225,12 +225,11 @@ async fn send_update(
|
||||||
.await?;
|
.await?;
|
||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
spawn(async move {
|
spawn(async move {
|
||||||
sleep(Duration::from_millis(1500)).await;
|
|
||||||
client
|
client
|
||||||
.publish(
|
.publish(
|
||||||
format!("wifi-exporter/{}/state", mac),
|
format!("wifi-exporter/{}/state", mac),
|
||||||
QoS::AtLeastOnce,
|
QoS::AtLeastOnce,
|
||||||
false,
|
true,
|
||||||
r#"connected"#,
|
r#"connected"#,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
|
@ -242,7 +241,7 @@ async fn send_update(
|
||||||
.publish(
|
.publish(
|
||||||
format!("wifi-exporter/{}/state", mac),
|
format!("wifi-exporter/{}/state", mac),
|
||||||
QoS::AtLeastOnce,
|
QoS::AtLeastOnce,
|
||||||
false,
|
true,
|
||||||
r#"connected"#,
|
r#"connected"#,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
@ -252,7 +251,7 @@ async fn send_update(
|
||||||
.publish(
|
.publish(
|
||||||
format!("wifi-exporter/{}/state", mac),
|
format!("wifi-exporter/{}/state", mac),
|
||||||
QoS::AtLeastOnce,
|
QoS::AtLeastOnce,
|
||||||
false,
|
true,
|
||||||
r#"disconnected"#,
|
r#"disconnected"#,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue