From 968c0c245208e0d8d99c0f153f03169960e58c5d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 15 Mar 2026 20:27:07 -1000 Subject: [PATCH] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- esphome/components/ethernet/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/esphome/components/ethernet/__init__.py b/esphome/components/ethernet/__init__.py index b534df89856..cbc50c6bf66 100644 --- a/esphome/components/ethernet/__init__.py +++ b/esphome/components/ethernet/__init__.py @@ -36,9 +36,9 @@ from esphome.const import ( CONF_VALUE, KEY_CORE, KEY_FRAMEWORK_VERSION, + KEY_NATIVE_IDF, Platform, PlatformFramework, -) from esphome.core import ( CORE, CoroPriority, @@ -629,9 +629,12 @@ def _filter_source_files() -> list[str]: elif CORE.is_esp32: from esphome.components.esp32 import idf_version - ver = idf_version() - if cv.Version(5, 4, 2) <= ver < cv.Version(6, 0, 0): - excluded.append("esp_eth_phy_jl1101.c") + # 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") return excluded