mirror of
https://github.com/esphome/esphome.git
synced 2025-09-21 04:32:23 +01:00
Ensure components only powerdown after teardown (#9044)
This commit is contained in:
@@ -169,6 +169,7 @@ void Application::safe_reboot() {
|
||||
ESP_LOGI(TAG, "Rebooting safely");
|
||||
run_safe_shutdown_hooks();
|
||||
teardown_components(TEARDOWN_TIMEOUT_REBOOT_MS);
|
||||
run_powerdown_hooks();
|
||||
arch_restart();
|
||||
}
|
||||
|
||||
@@ -181,6 +182,12 @@ void Application::run_safe_shutdown_hooks() {
|
||||
}
|
||||
}
|
||||
|
||||
void Application::run_powerdown_hooks() {
|
||||
for (auto it = this->components_.rbegin(); it != this->components_.rend(); ++it) {
|
||||
(*it)->on_powerdown();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::teardown_components(uint32_t timeout_ms) {
|
||||
uint32_t start_time = millis();
|
||||
|
||||
|
Reference in New Issue
Block a user