ESPHome 2026.5.0-dev
Loading...
Searching...
No Matches
util.cpp
Go to the documentation of this file.
1#include "util.h"
3#ifdef USE_NETWORK
4
5namespace esphome::network {
6
7// The order of the components is important: WiFi should come after any possible main interfaces (it may be used as
8// an AP that uses a previous interface for NAT).
9
11#ifdef USE_MODEM
12 if (modem::global_modem_component != nullptr)
13 return modem::global_modem_component->is_disabled();
14#endif
15
16#ifdef USE_WIFI
17 if (wifi::global_wifi_component != nullptr)
19#endif
20 return false;
21}
22
24#ifdef USE_ETHERNET
25 if (ethernet::global_eth_component != nullptr)
27#endif
28
29#ifdef USE_MODEM
30 if (modem::global_modem_component != nullptr)
31 return modem::global_modem_component->get_ip_addresses();
32#endif
33
34#ifdef USE_WIFI
35 if (wifi::global_wifi_component != nullptr)
37#endif
38#ifdef USE_OPENTHREAD
41#endif
42 return {};
43}
44
45} // namespace esphome::network
46#endif
network::IPAddresses get_ip_addresses()
EthernetComponent * global_eth_component
std::array< IPAddress, 5 > IPAddresses
Definition ip_address.h:187
network::IPAddresses get_ip_addresses()
Definition util.cpp:23
bool is_disabled()
Return whether the network is disabled (only wifi for now)
Definition util.cpp:10
OpenThreadComponent * global_openthread_component
WiFiComponent * global_wifi_component