USE_ESP_IDF Deprecated in Favor of USE_ESP32
The USE_ESP_IDF C++ define and related Python APIs are deprecated. Since Arduino-ESP32 is built on ESP-IDF, all IDF APIs are available on ESP32 regardless of framework selection.
This is a breaking change for external components in ESPHome 2026.1.0 and later.
Background
Section titled “Background”PR #12673: Replace USE_ESP_IDF with USE_ESP32 across components
The ESP32 Arduino framework is built on top of ESP-IDF, so ESP-IDF APIs are always available when targeting ESP32. This change simplifies framework checks by unifying on platform detection rather than framework detection.
What’s Changing
Section titled “What’s Changing”C++ Defines
Section titled “C++ Defines”// Before - framework check#ifdef USE_ESP_IDF // This code was only included for IDF builds#endif
// After - platform check#ifdef USE_ESP32 // This code is included for all ESP32 builds#endifPython Configuration
Section titled “Python Configuration”# Before - framework validation (deprecated)CONFIG_SCHEMA = cv.All( my_schema, cv.only_with_esp_idf, # Deprecated)
# After - platform validationCONFIG_SCHEMA = cv.All( my_schema, cv.only_on_esp32,)Python Code
Section titled “Python Code”# Before - framework check (deprecated)if CORE.using_esp_idf: # code for IDF framework
# After - platform checkif CORE.is_esp32: # code for all ESP32 buildsWho This Affects
Section titled “Who This Affects”External components that:
- Use
#ifdef USE_ESP_IDFin C++ code - Use
CORE.using_esp_idfin Python code - Use
cv.only_with_esp_idfvalidator
Standard YAML configurations are not affected.
Migration Guide
Section titled “Migration Guide”1. C++ ifdef checks
Section titled “1. C++ ifdef checks”// Before#ifdef USE_ESP_IDF#include "esp_wifi.h"void init_wifi() { esp_wifi_init(...);}#endif
// After#ifdef USE_ESP32#include "esp_wifi.h"void init_wifi() { esp_wifi_init(...);}#endif2. Python configuration validation
Section titled “2. Python configuration validation”# Beforeimport esphome.config_validation as cv
CONFIG_SCHEMA = cv.All( cv.Schema({...}), cv.only_with_esp_idf,)
# AfterCONFIG_SCHEMA = cv.All( cv.Schema({...}), cv.only_on_esp32,)3. Python platform checks
Section titled “3. Python platform checks”# Beforefrom esphome.core import CORE
async def to_code(config): if CORE.using_esp_idf: # IDF-specific code
# Afterasync def to_code(config): if CORE.is_esp32: # ESP32 code (works with both Arduino and IDF)4. Framework-specific code (rare)
Section titled “4. Framework-specific code (rare)”If you genuinely need framework-specific code (not just platform-specific):
# If you need to differentiate Arduino vs pure IDFif CORE.is_esp32 and not CORE.using_arduino: # Pure ESP-IDF only (no Arduino layer)elif CORE.is_esp32 and CORE.using_arduino: # Arduino framework on ESP32// C++ framework check (rare) - use explicit framework defines#ifdef USE_ESP32_FRAMEWORK_ESP_IDF // Pure ESP-IDF framework#elif defined(USE_ESP32_FRAMEWORK_ARDUINO) // Arduino framework on ESP32#endifWhy This Change
Section titled “Why This Change”- Arduino-ESP32 is built on ESP-IDF - All ESP-IDF APIs are available regardless of framework selection
- Simplifies code - Most
USE_ESP_IDFchecks were really platform checks, not framework checks - Reduces confusion - The distinction between “ESP-IDF framework” and “ESP-IDF APIs” caused confusion
- Unified behavior - Components now work consistently across both frameworks
Timeline
Section titled “Timeline”- ESPHome 2026.1.0 (January 2026): Deprecation warnings active
- ESPHome 2026.6.0 (June 2026): Deprecated APIs removed
Finding Code That Needs Updates
Section titled “Finding Code That Needs Updates”# Find C++ USE_ESP_IDF usagegrep -rn "USE_ESP_IDF" your_component/
# Find Python using_esp_idf usagegrep -rn "using_esp_idf" your_component/
# Find Python only_with_esp_idf usagegrep -rn "only_with_esp_idf" your_component/Questions?
Section titled “Questions?”If you have questions about migrating your external component, please ask in:
- ESPHome Discord - #devs channel
- ESPHome GitHub Discussions
Related Documentation
Section titled “Related Documentation”Copyright © 2026 ESPHome - A project from the Open Home Foundation
Comments
Feel free to leave a comment here to discuss this post with others. You can ask questions, share your experience, or suggest improvements. If you have a question about a specific feature or issue, please consider using the ESPHome Discord. Stick to English and follow ESPHome's code of conduct. These comments exist on a discussion on GitHub, so you can also comment there directly if you prefer.