diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index 6bebd3b927..fc6ed732be 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -57,14 +57,7 @@ void Application::setup() { } ESP_LOGI(TAG, "setup() finished successfully!"); - this->dump_config(); -} -void Application::dump_config() { - ESP_LOGI(TAG, "esphome version " ESPHOME_VERSION " compiled on %s", this->compilation_time_.c_str()); - - for (auto component : this->components_) { - component->dump_config(); - } + this->schedule_dump_config(); } void Application::loop() { uint32_t new_app_state = 0; @@ -97,9 +90,13 @@ void Application::loop() { } this->last_loop_ = now; - if (this->dump_config_scheduled_) { - this->dump_config(); - this->dump_config_scheduled_ = false; + if (this->dump_config_at_ >= 0 && this->dump_config_at_ < this->components_.size()) { + if (this->dump_config_at_ == 0) { + ESP_LOGI(TAG, "esphome version " ESPHOME_VERSION " compiled on %s", this->compilation_time_.c_str()); + } + + this->components_[this->dump_config_at_]->dump_config(); + this->dump_config_at_++; } } diff --git a/esphome/core/application.h b/esphome/core/application.h index 2ee8404a9f..c4cc1f27a8 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -109,8 +109,7 @@ class Application { */ void set_loop_interval(uint32_t loop_interval) { this->loop_interval_ = loop_interval; } - void dump_config(); - void schedule_dump_config() { this->dump_config_scheduled_ = true; } + void schedule_dump_config() { this->dump_config_at_ = 0; } void feed_wdt(); @@ -234,7 +233,7 @@ class Application { std::string compilation_time_; uint32_t last_loop_{0}; uint32_t loop_interval_{16}; - bool dump_config_scheduled_{false}; + int dump_config_at_{-1}; uint32_t app_state_{0}; };