From 67386f0dd17d45d19af4e7e7b200329e2a4477b6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 15 Mar 2026 20:34:25 -1000 Subject: [PATCH] fix copilots manged suggestion --- esphome/components/ethernet/__init__.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/esphome/components/ethernet/__init__.py b/esphome/components/ethernet/__init__.py index cbc50c6bf6..e1ceefeacd 100644 --- a/esphome/components/ethernet/__init__.py +++ b/esphome/components/ethernet/__init__.py @@ -39,6 +39,7 @@ from esphome.const import ( KEY_NATIVE_IDF, Platform, PlatformFramework, +) from esphome.core import ( CORE, CoroPriority, @@ -626,15 +627,13 @@ def _filter_source_files() -> list[str]: # and pioarduino doesn't have it builtin (IDF 5.4.2 to 5.x) if eth_type != "JL1101": excluded.append("esp_eth_phy_jl1101.c") - elif CORE.is_esp32: + elif CORE.is_esp32 and not CORE.data.get(KEY_NATIVE_IDF, False): from esphome.components.esp32 import idf_version - # Mirror C preprocessor logic: only exclude for PlatformIO (non-native IDF) - is_native_idf = CORE.data.get(KEY_NATIVE_IDF, False) - if not is_native_idf: - ver = idf_version() - if cv.Version(5, 4, 2) <= ver < cv.Version(6, 0, 0): - excluded.append("esp_eth_phy_jl1101.c") + # pioarduino has JL1101 builtin on IDF 5.4.2-5.x; exclude custom driver + # to avoid shadowing. Native IDF builds always need the custom driver. + if cv.Version(5, 4, 2) <= idf_version() < cv.Version(6, 0, 0): + excluded.append("esp_eth_phy_jl1101.c") return excluded