mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 03:16:37 +00:00
Merge branch 'integration' into memory_api
This commit is contained in:
@@ -112,9 +112,11 @@ void APIServer::setup() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *const REBOOT_TIMEOUT = "reboot";
|
||||||
|
|
||||||
void APIServer::schedule_reboot_timeout_() {
|
void APIServer::schedule_reboot_timeout_() {
|
||||||
this->status_set_warning();
|
this->status_set_warning();
|
||||||
this->set_timeout("api_reboot", this->reboot_timeout_, []() {
|
this->set_timeout(REBOOT_TIMEOUT, this->reboot_timeout_, []() {
|
||||||
if (!global_api_server->is_connected()) {
|
if (!global_api_server->is_connected()) {
|
||||||
ESP_LOGE(TAG, "No clients; rebooting");
|
ESP_LOGE(TAG, "No clients; rebooting");
|
||||||
App.reboot();
|
App.reboot();
|
||||||
@@ -150,7 +152,7 @@ void APIServer::loop() {
|
|||||||
// Clear warning status and cancel reboot when first client connects
|
// Clear warning status and cancel reboot when first client connects
|
||||||
if (this->clients_.size() == 1 && this->reboot_timeout_ != 0) {
|
if (this->clients_.size() == 1 && this->reboot_timeout_ != 0) {
|
||||||
this->status_clear_warning();
|
this->status_clear_warning();
|
||||||
this->cancel_timeout("api_reboot");
|
this->cancel_timeout(REBOOT_TIMEOUT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user