diff --git a/.clang-tidy.hash b/.clang-tidy.hash index 59caddf59b..0a71b6859f 100644 --- a/.clang-tidy.hash +++ b/.clang-tidy.hash @@ -1 +1 @@ -97fb425f1d681a5994ed1cc6187910f5d2c37ee577b6dc07eb3f4d8862a011de +191a0e6ab5842d153dd77a2023bc5742f9d4333c334de8d81b57f2b8d4d4b65e diff --git a/esphome/components/async_tcp/__init__.py b/esphome/components/async_tcp/__init__.py index 4b6c6a275c..1ff4805f03 100644 --- a/esphome/components/async_tcp/__init__.py +++ b/esphome/components/async_tcp/__init__.py @@ -26,12 +26,12 @@ CONFIG_SCHEMA = cv.Schema({}) @coroutine_with_priority(CoroPriority.NETWORK_TRANSPORT) async def to_code(config): - if CORE.using_esp_idf: - # ESP-IDF needs the IDF component + if CORE.is_esp32: + # https://github.com/ESP32Async/AsyncTCP from esphome.components.esp32 import add_idf_component add_idf_component(name="esp32async/asynctcp", ref="3.4.91") - elif CORE.is_esp32 or CORE.is_libretiny: + elif CORE.is_libretiny: # https://github.com/ESP32Async/AsyncTCP cg.add_library("ESP32Async/AsyncTCP", "3.4.5") elif CORE.is_esp8266: diff --git a/esphome/components/async_tcp/async_tcp.h b/esphome/components/async_tcp/async_tcp.h index 362f603451..6d9211f023 100644 --- a/esphome/components/async_tcp/async_tcp.h +++ b/esphome/components/async_tcp/async_tcp.h @@ -1,9 +1,8 @@ #pragma once #include "esphome/core/defines.h" -#if (defined(USE_ESP32) || defined(USE_LIBRETINY)) && !defined(CLANG_TIDY) +#if defined(USE_ESP32) || defined(USE_LIBRETINY) // Use AsyncTCP library for ESP32 (Arduino or ESP-IDF) and LibreTiny -// But not for clang-tidy as the header file isn't present in that case #include #elif defined(USE_ESP8266) // Use ESPAsyncTCP library for ESP8266 (always Arduino) @@ -12,6 +11,6 @@ // Use AsyncTCP_RP2040W library for RP2040 #include #else -// Use socket-based implementation for other platforms and clang-tidy +// Use socket-based implementation for other platforms #include "async_tcp_socket.h" #endif diff --git a/esphome/components/async_tcp/async_tcp_socket.cpp b/esphome/components/async_tcp/async_tcp_socket.cpp index 6c13f346e9..f64e494f5f 100644 --- a/esphome/components/async_tcp/async_tcp_socket.cpp +++ b/esphome/components/async_tcp/async_tcp_socket.cpp @@ -1,6 +1,7 @@ #include "async_tcp_socket.h" -#if defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS) +#if !defined(USE_ESP32) && !defined(USE_ESP8266) && !defined(USE_RP2040) && !defined(USE_LIBRETINY) && \ + (defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)) #include "esphome/components/network/util.h" #include "esphome/core/log.h" @@ -158,4 +159,4 @@ void AsyncClient::loop() { } // namespace esphome::async_tcp -#endif // defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS) +#endif diff --git a/esphome/components/async_tcp/async_tcp_socket.h b/esphome/components/async_tcp/async_tcp_socket.h index ca3bf19d67..28714a7752 100644 --- a/esphome/components/async_tcp/async_tcp_socket.h +++ b/esphome/components/async_tcp/async_tcp_socket.h @@ -2,7 +2,8 @@ #include "esphome/core/defines.h" -#if defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS) +#if !defined(USE_ESP32) && !defined(USE_ESP8266) && !defined(USE_RP2040) && !defined(USE_LIBRETINY) && \ + (defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)) #include "esphome/components/socket/socket.h" #include @@ -69,5 +70,4 @@ class AsyncClient { // Expose AsyncClient in global namespace to match library behavior using esphome::async_tcp::AsyncClient; // NOLINT(google-global-names-in-headers) -#define ESPHOME_ASYNC_TCP_SOCKET_IMPL -#endif // defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS) +#endif diff --git a/esphome/idf_component.yml b/esphome/idf_component.yml index 36aa77c524..2dc5b94847 100644 --- a/esphome/idf_component.yml +++ b/esphome/idf_component.yml @@ -31,3 +31,5 @@ dependencies: version: 0.2.2 rules: - if: "target in [esp32, esp32s2, esp32s3, esp32p4]" + esp32async/asynctcp: + version: 3.4.91 diff --git a/platformio.ini b/platformio.ini index dd9eb566c5..d96e9ad2cc 100644 --- a/platformio.ini +++ b/platformio.ini @@ -146,7 +146,6 @@ lib_deps = WiFi ; wifi,web_server_base,ethernet (Arduino built-in) Update ; ota,web_server_base (Arduino built-in) ${common:arduino.lib_deps} - ESP32Async/AsyncTCP@3.4.5 ; async_tcp NetworkClientSecure ; http_request,nextion (Arduino built-in) HTTPClient ; http_request,nextion (Arduino built-in) ESPmDNS ; mdns (Arduino built-in)