mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 13:27:14 +00:00
8f3010ac64c64793baa7a51764c4fadd6fb4a9c1
Builds on PR #14012's NetworkComponent + PR #14255's priority list to make the user's stated interface priority actually drive runtime default-route selection. Without this, ESP-IDF's auto-selection picks the default netif by each netif's hardcoded `route_prio` field (WiFi STA = 100, Ethernet = 50, WiFi AP = 10) — which inverts the user's intent on same-subnet multi-homing configurations where wifi+ethernet share a broadcast domain. Changes: - NetworkComponent gains an IP_EVENT handler registered in setup() that re-arbitrates the default netif on every interface up/down. The handler walks the priority list in order, picks the highest-priority netif that is up, and calls esp_netif_set_default_netif() on it. ESP-IDF then sets its internal "manual override" flag so subsequent auto-selection events don't undo our choice. - New StaticVector<NetworkPriorityEntry, 4> stores the priority list with zero heap allocation. The interface-name string pointer is a YAML literal with static storage duration. - The timeout_ms field is parsed and stored but not yet consumed by Unit A; it's wired up for Unit D (runtime timeout fallback). - New getters get_active_interface() / get_active_netif() expose the currently-active interface for Unit C consumers. - Python codegen iterates CORE.data[KEY_NETWORK_PRIORITY] and emits add_priority_entry() calls per YAML order. Field-tested on ESP32-S3 with W5500 SPI ethernet + WiFi STA on the same subnet. The log line "[network] Default interface: <name>" confirms the arbitration logic fires correctly on IP_EVENT_*_GOT_IP. Standalone — no schema changes, single-interface configs unaffected.
[esp32] Decouple esp-idf toolchain version check from PIO, honor framework source: override (#16516)
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
393 MiB
Languages
C++
60.7%
Python
38.9%
C
0.3%
