Skip to content

ESP32: Unused Built-in IDF Components Excluded by Default

ESP32 builds now exclude unused built-in IDF components by default to reduce compile time. This applies to both ESP-IDF and Arduino framework builds, since both use the ESP-IDF build system underneath. External components that use excluded IDF APIs (e.g., esp_vfs_fat.h, esp_http_client.h, esp_eth.h) must explicitly re-enable them via include_builtin_idf_component().

This is a breaking change for external components in ESPHome 2026.2.0 and later.

PR #13610: Reduce compile time by excluding unused IDF components PR #13664: Exclude additional unused IDF components

Previously, all ESP-IDF built-in components were compiled for every ESP32 build (both IDF and Arduino frameworks), even when ESPHome never uses them. Components like fatfs, spiffs, esp_hid, mqtt, and many others were compiled and linked but never called. Excluding them significantly reduces compile time.

The following ESP-IDF components are now excluded by default:

Excluded ComponentDescription
cmockUnit testing mock framework
driverLegacy driver shim
esp_adcADC driver
esp_driver_dacDAC driver
esp_driver_i2sI2S driver
esp_driver_mcpwmMotor control PWM driver
esp_driver_pcntPulse counter driver
esp_driver_rmtRMT driver
esp_driver_touch_sensTouch sensor driver
esp_driver_twaiTWAI/CAN driver
esp_ethEthernet driver
esp_hidHID host/device support
esp_http_clientHTTP client
esp_https_otaESP-IDF HTTPS OTA
esp_https_serverHTTPS server
esp_lcdLCD controller drivers
esp_local_ctrlLocal control over HTTPS/BLE
espcoredumpCore dump support
fatfsFAT filesystem
mqttESP-IDF MQTT library
openthreadThread protocol
perfmonXtensa performance monitor
protocommProtocol communication for provisioning
spiffsSPIFFS filesystem
ulpULP coprocessor
unityUnit testing framework
wear_levellingFlash wear levelling for fatfs
wifi_provisioningWiFi provisioning

ESPHome’s built-in components already call include_builtin_idf_component() to re-enable any they need, so they are automatically handled. External components that use these IDF APIs must do the same.

External components that:

  • Include ESP-IDF headers from excluded components (e.g., esp_vfs_fat.h, esp_http_client.h, rmt_encoder.h)
  • Use ESP-IDF APIs provided by excluded components without calling include_builtin_idf_component() in their Python to_code()

Standard YAML configurations are not affected — ESPHome’s built-in components automatically re-enable the IDF components they need.

NOTE

Arduino framework builds have additional exclusions for Arduino-specific managed components. See the ESP32 Arduino Selective Compilation post for details on Arduino library changes.

External Components: Add include_builtin_idf_component() Calls

Section titled “External Components: Add include_builtin_idf_component() Calls”

If your external component uses IDF APIs from an excluded component, call include_builtin_idf_component() in your to_code():

# In your component's __init__.py
from esphome.components.esp32 import include_builtin_idf_component
async def to_code(config):
include_builtin_idf_component("fatfs")
include_builtin_idf_component("wear_levelling") # If using wear levelling
# ... rest of to_code

If you cannot modify the external component, add the required IDF components in your YAML. This works with both ESP-IDF and Arduino framework builds:

esp32:
framework:
advanced:
include_builtin_idf_components:
- fatfs
- wear_levelling

Components Already Re-enabled by Built-in ESPHome Components

Section titled “Components Already Re-enabled by Built-in ESPHome Components”

Many IDF components are already re-enabled by ESPHome’s built-in components. If your external component lists any of these in its DEPENDENCIES, the IDF component is already available:

IDF ComponentRe-enabled by ESPHome Component
esp_driver_rmtremote_transmitter, remote_receiver, neopixelbus, esp32_rmt_led_strip
esp_driver_i2si2s_audio
esp_driver_pcntpulse_counter, hlw8012
esp_driver_twaiesp32_can
esp_driver_touch_sensesp32_touch
esp_driver_dacesp32_dac
esp_adcadc
esp_ethethernet
esp_http_clienthttp_request, audio
esp_lcddisplay
mqttmqtt
openthreadopenthread
driveresp32_can, esp32_touch, opentherm

These IDF components are not re-enabled by any commonly-used built-in component. If your external component uses them, you must call include_builtin_idf_component():

IDF ComponentHeadersUse Case
fatfsesp_vfs_fat.hFAT filesystem, SD card via VFS
wear_levellingwear_levelling.hFlash wear levelling for FAT partitions
spiffsesp_spiffs.hSPIFFS filesystem
esp_hidesp_hid*.hHID host/device
esp_https_otaesp_https_ota.hESP-IDF native OTA
esp_https_serveresp_https_server.hHTTPS server
espcoredumpesp_core_dump.hCore dump analysis
ulpulp.h, ulp_riscv.hULP coprocessor
async def to_code(config):
try:
from esphome.components.esp32 import include_builtin_idf_component
include_builtin_idf_component("fatfs")
except ImportError:
# ESPHome < 2026.2.0 - all IDF components included by default
pass

If your component uses an excluded IDF component without re-enabling it, you’ll see errors like:

fatal error: esp_vfs_fat.h: No such file or directory
fatal error: esp_http_client.h: No such file or directory
fatal error: rmt_encoder.h: No such file or directory

The fix is to add the corresponding include_builtin_idf_component() call in your Python code, or use the include_builtin_idf_components YAML option.

  • ESPHome 2026.2.0 (February 2026): IDF components excluded by default
  • No deprecation period — behavior changed directly
Terminal window
# Find IDF includes from commonly-excluded components
grep -rn '#include.*esp_vfs_fat' your_component/
grep -rn '#include.*esp_http_client' your_component/
grep -rn '#include.*esp_hid' your_component/
grep -rn '#include.*wear_levelling' your_component/
grep -rn '#include.*esp_spiffs' your_component/
grep -rn '#include.*rmt_encoder' your_component/
# Check if your Python code already re-enables them
grep -rn 'include_builtin_idf_component' your_component/

If you have questions about migrating your external component, please ask in:

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.