Send MQTT "stay_alive" message before deep sleep; add delay to ensure message delivery.
This commit is contained in:
@@ -1251,14 +1251,15 @@ async fn wait_infinity(
|
|||||||
info!("Rebooting now");
|
info!("Rebooting now");
|
||||||
//ensure clean http answer
|
//ensure clean http answer
|
||||||
Timer::after_millis(500).await;
|
Timer::after_millis(500).await;
|
||||||
BOARD_ACCESS
|
let mut board = BOARD_ACCESS
|
||||||
.get()
|
.get()
|
||||||
.await
|
.await
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
|
||||||
.board_hal
|
|
||||||
.deep_sleep(0)
|
|
||||||
.await;
|
.await;
|
||||||
|
board.board_hal.get_esp().mqtt_publish("/stay_alive", "0").await;
|
||||||
|
//give time to mqtt to send the last message
|
||||||
|
Timer::after_millis(500).await;
|
||||||
|
board.board_hal.deep_sleep(0).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user