ESPHome 2026.9.0-dev
Loading...
Searching...
No Matches
network_component.h
Go to the documentation of this file.
1#pragma once
3#if defined(USE_NETWORK) && defined(USE_ESP32)
5
6#ifdef USE_NETWORK_DEFAULT_ROUTE
7// Forward declaration matching esp_netif's own typedef; avoids pulling esp_netif.h
8// into this header.
9using esp_netif_t = struct esp_netif_obj;
10#endif
11
12namespace esphome::network {
13class NetworkComponent final : public Component {
14 public:
15 void setup() override;
16 void dump_config() override;
17 // AFTER_BLUETOOTH: BLE controller must initialize before esp_netif_init per IDF guidance.
18 float get_setup_priority() const override { return setup_priority::AFTER_BLUETOOTH; }
19
20#ifdef USE_NETWORK_DEFAULT_ROUTE
21 void loop() override;
22
23 protected:
24 // Verify-lwIP-route interval for the settled state; keeps the global lwIP core
25 // mutex off the hot loop path.
26 static constexpr uint32_t ROUTE_CHECK_INTERVAL_MS = 1000;
27 // Last netif this component made the default; avoids redundant esp_netif calls.
30#endif
31};
32} // namespace esphome::network
33#endif
float get_setup_priority() const override
static constexpr uint32_t ROUTE_CHECK_INTERVAL_MS
constexpr float AFTER_BLUETOOTH
Definition component.h:49
struct esp_netif_obj esp_netif_t
static void uint32_t