diff --git a/esphome/components/socket/__init__.py b/esphome/components/socket/__init__.py index ab4f3269a84..3fa57b0b478 100644 --- a/esphome/components/socket/__init__.py +++ b/esphome/components/socket/__init__.py @@ -168,11 +168,14 @@ async def to_code(config): # Only when not using lwip_tcp, which does not provide select() support. if (CORE.is_esp32 or CORE.is_libretiny) and impl != IMPLEMENTATION_LWIP_TCP: cg.add_build_flag("-DUSE_LWIP_FAST_SELECT") - elif impl != IMPLEMENTATION_LWIP_TCP: + if ( + impl == IMPLEMENTATION_BSD_SOCKETS + and not CORE.is_esp32 + and not CORE.is_libretiny + ): # Host platform: uses select() syscall for socket monitoring + # and a UDP loopback socket for wake_loop_threadsafe() cg.add_define("USE_SOCKET_SELECT_SUPPORT") - # Platforms with select() but without fast select (host) need a UDP - # loopback socket for wake_loop_threadsafe(). consume_sockets(1, "socket.wake_loop_threadsafe", SocketType.UDP)({})