From 02a0584e432d6b1307ff6eeeb5cd8af38a8ef50c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 11 Jun 2025 21:33:36 -0500 Subject: [PATCH] Always perform select() when loop duration exceeds interval --- esphome/core/application.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index 75a7052c63..40f56930a9 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -116,7 +116,11 @@ void Application::loop() { // Use the last component's end time instead of calling millis() again auto elapsed = last_op_end_time - this->last_loop_; - if (elapsed >= this->loop_interval_ || HighFrequencyLoopRequester::is_high_frequency()) { + if (elapsed >= this->loop_interval_) { + // Even if we overran the loop interval, we still need to select() + // to know if any sockets have data ready + this->delay_with_select_(0); + } else if (HighFrequencyLoopRequester::is_high_frequency()) { yield(); } else { uint32_t delay_time = this->loop_interval_ - elapsed;