From 2c01c06828d3942f831047215d3a19162e81f899 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 2 Aug 2025 07:53:14 -1000 Subject: [PATCH 1/5] remove test --- tests/components/datetime/common.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/components/datetime/common.yaml b/tests/components/datetime/common.yaml index aa469dee76..4e26b68121 100644 --- a/tests/components/datetime/common.yaml +++ b/tests/components/datetime/common.yaml @@ -1,5 +1,3 @@ datetime: -date: - time: From ed2e8466c8ab9d86cf1697758949571c7c352bf7 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 2 Aug 2025 08:42:17 -1000 Subject: [PATCH 2/5] [esp32] Add framework migration warning for upcoming ESP-IDF default change --- esphome/components/esp32/__init__.py | 54 ++++++++++++++++++++++++++++ esphome/util.py | 8 ++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/esphome/components/esp32/__init__.py b/esphome/components/esp32/__init__.py index 05a79553a4..a657f02f5d 100644 --- a/esphome/components/esp32/__init__.py +++ b/esphome/components/esp32/__init__.py @@ -680,6 +680,58 @@ ESP_IDF_FRAMEWORK_SCHEMA = cv.All( ) +def _show_framework_migration_message(name: str, _shown: list[bool] = []) -> None: + """Show a friendly message about framework migration when defaulting to Arduino.""" + if _shown: + return + _shown.append(True) + + from esphome.log import AnsiFore, color + + message = ( + color( + AnsiFore.BOLD_CYAN, + f"💡 IMPORTANT: {name} doesn't have a framework specified!", + ) + + "\n\n" + + "Currently, ESP32 defaults to the Arduino framework.\n" + + color(AnsiFore.YELLOW, "This will change to ESP-IDF in ESPHome 2026.1.0.\n") + + "\n" + + "Why change? ESP-IDF offers:\n" + + color(AnsiFore.GREEN, " ✨ Up to 40% smaller binaries\n") + + color(AnsiFore.GREEN, " 🚀 Better performance and optimization\n") + + color(AnsiFore.GREEN, " 📦 Custom-built firmware for your exact needs\n") + + color( + AnsiFore.GREEN, + " 🔧 Active development and testing by ESPHome developers\n", + ) + + "\n" + + "Trade-offs:\n" + + color(AnsiFore.YELLOW, " ⏱️ Compile times are ~25% longer\n") + + color(AnsiFore.YELLOW, " 🔄 Some components need migration\n") + + "\n" + + "What should I do?\n" + + color(AnsiFore.CYAN, " Option 1") + + ": Migrate to ESP-IDF (recommended)\n" + + " Add this to your YAML under 'esp32:':\n" + + color(AnsiFore.WHITE, " framework:\n") + + color(AnsiFore.WHITE, " type: esp-idf\n") + + "\n" + + color(AnsiFore.CYAN, " Option 2") + + ": Keep using Arduino (100% supported)\n" + + " Add this to your YAML under 'esp32:':\n" + + color(AnsiFore.WHITE, " framework:\n") + + color(AnsiFore.WHITE, " type: arduino\n") + + "\n" + + "Need help? Check out the migration guide:\n" + + color( + AnsiFore.BLUE, + "https://esphome.io/guides/esp32_arduino_to_idf.html", + ) + ) + _LOGGER.warning(message) + + def _set_default_framework(config): if CONF_FRAMEWORK not in config: config = config.copy() @@ -688,6 +740,8 @@ def _set_default_framework(config): if variant in ARDUINO_ALLOWED_VARIANTS: config[CONF_FRAMEWORK] = ARDUINO_FRAMEWORK_SCHEMA({}) config[CONF_FRAMEWORK][CONF_TYPE] = FRAMEWORK_ARDUINO + # Show the migration message + _show_framework_migration_message(config.get(CONF_NAME, "Your device")) else: config[CONF_FRAMEWORK] = ESP_IDF_FRAMEWORK_SCHEMA({}) config[CONF_FRAMEWORK][CONF_TYPE] = FRAMEWORK_ESP_IDF diff --git a/esphome/util.py b/esphome/util.py index 3b346371bc..9aa0f6b9d8 100644 --- a/esphome/util.py +++ b/esphome/util.py @@ -345,5 +345,11 @@ def get_esp32_arduino_flash_error_help() -> str | None: + "2. Clean build files and compile again\n" + "\n" + "Note: ESP-IDF uses less flash space and provides better performance.\n" - + "Some Arduino-specific libraries may need alternatives.\n\n" + + "Some Arduino-specific libraries may need alternatives.\n" + + "\n" + + "For detailed migration instructions, see:\n" + + color( + AnsiFore.BLUE, + "https://esphome.io/guides/esp32_arduino_to_idf.html\n\n", + ) ) From 30f988c5f358baa41c26a3e9ea5652c3f70fecc6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 2 Aug 2025 08:42:46 -1000 Subject: [PATCH 3/5] [esp32] Add framework migration warning for upcoming ESP-IDF default change --- esphome/components/esp32/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/esphome/components/esp32/__init__.py b/esphome/components/esp32/__init__.py index a657f02f5d..5019a192eb 100644 --- a/esphome/components/esp32/__init__.py +++ b/esphome/components/esp32/__init__.py @@ -680,11 +680,15 @@ ESP_IDF_FRAMEWORK_SCHEMA = cv.All( ) -def _show_framework_migration_message(name: str, _shown: list[bool] = []) -> None: +class _FrameworkMigrationWarning: + shown = False + + +def _show_framework_migration_message(name: str) -> None: """Show a friendly message about framework migration when defaulting to Arduino.""" - if _shown: + if _FrameworkMigrationWarning.shown: return - _shown.append(True) + _FrameworkMigrationWarning.shown = True from esphome.log import AnsiFore, color From a1e7317f5ea08b78d564362fc5b3e254d0538a17 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 2 Aug 2025 08:46:08 -1000 Subject: [PATCH 4/5] [esp32] Add framework migration warning for upcoming ESP-IDF default change --- esphome/components/esp32/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/esphome/components/esp32/__init__.py b/esphome/components/esp32/__init__.py index 5019a192eb..f1fcae6c55 100644 --- a/esphome/components/esp32/__init__.py +++ b/esphome/components/esp32/__init__.py @@ -684,7 +684,7 @@ class _FrameworkMigrationWarning: shown = False -def _show_framework_migration_message(name: str) -> None: +def _show_framework_migration_message(name: str, variant: str) -> None: """Show a friendly message about framework migration when defaulting to Arduino.""" if _FrameworkMigrationWarning.shown: return @@ -698,9 +698,11 @@ def _show_framework_migration_message(name: str) -> None: f"💡 IMPORTANT: {name} doesn't have a framework specified!", ) + "\n\n" - + "Currently, ESP32 defaults to the Arduino framework.\n" + + f"Currently, {variant} defaults to the Arduino framework.\n" + color(AnsiFore.YELLOW, "This will change to ESP-IDF in ESPHome 2026.1.0.\n") + "\n" + + "Note: Newer ESP32 variants (C6, H2, P4, etc.) already use ESP-IDF by default.\n" + + "\n" + "Why change? ESP-IDF offers:\n" + color(AnsiFore.GREEN, " ✨ Up to 40% smaller binaries\n") + color(AnsiFore.GREEN, " 🚀 Better performance and optimization\n") @@ -745,7 +747,9 @@ def _set_default_framework(config): config[CONF_FRAMEWORK] = ARDUINO_FRAMEWORK_SCHEMA({}) config[CONF_FRAMEWORK][CONF_TYPE] = FRAMEWORK_ARDUINO # Show the migration message - _show_framework_migration_message(config.get(CONF_NAME, "Your device")) + _show_framework_migration_message( + config.get(CONF_NAME, "Your device"), variant + ) else: config[CONF_FRAMEWORK] = ESP_IDF_FRAMEWORK_SCHEMA({}) config[CONF_FRAMEWORK][CONF_TYPE] = FRAMEWORK_ESP_IDF From e4db32d73e0593eca133a93a2e00a59f34d73a30 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 2 Aug 2025 09:21:57 -1000 Subject: [PATCH 5/5] tweak --- esphome/components/esp32/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/esp32/__init__.py b/esphome/components/esp32/__init__.py index f1fcae6c55..29dc190fc9 100644 --- a/esphome/components/esp32/__init__.py +++ b/esphome/components/esp32/__init__.py @@ -724,7 +724,7 @@ def _show_framework_migration_message(name: str, variant: str) -> None: + color(AnsiFore.WHITE, " type: esp-idf\n") + "\n" + color(AnsiFore.CYAN, " Option 2") - + ": Keep using Arduino (100% supported)\n" + + ": Keep using Arduino (still supported)\n" + " Add this to your YAML under 'esp32:':\n" + color(AnsiFore.WHITE, " framework:\n") + color(AnsiFore.WHITE, " type: arduino\n")