diff --git a/esphome/core/application.h b/esphome/core/application.h index 9892e27022..4baf24cd9d 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -643,6 +643,12 @@ class Application { #endif #endif +#if defined(USE_ESP8266) && defined(USE_SOCKET_IMPL_LWIP_TCP) + /// Wake the main event loop from any context (ISR, thread, or main loop). + /// On ESP8266: sets the socket wake flag and calls esp_schedule() to exit esp_delay() early. + static void IRAM_ATTR wake_loop_any_context() { socket::socket_wake(); } +#endif + protected: friend Component; friend class socket::Socket;