Send MQTT "stay_alive" message before deep sleep; add delay to ensure message delivery.

This commit is contained in:
Kai Börnert
2026-04-28 16:34:57 +02:00
parent 3be8dc7f6a
commit 9cd20cd56b

View File

@@ -1251,14 +1251,15 @@ async fn wait_infinity(
info!("Rebooting now");
//ensure clean http answer
Timer::after_millis(500).await;
BOARD_ACCESS
let mut board = BOARD_ACCESS
.get()
.await
.lock()
.await
.board_hal
.deep_sleep(0)
.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;
}
}
}