|
ESPHome 2026.2.1
|
#include <ethernet_component.h>
Public Member Functions | |
| EthernetComponent () | |
| void | setup () override |
| void | loop () override |
| void | dump_config () override |
| float | get_setup_priority () const override |
| void | on_powerdown () override |
| bool | is_connected () |
| void | set_clk_pin (uint8_t clk_pin) |
| void | set_miso_pin (uint8_t miso_pin) |
| void | set_mosi_pin (uint8_t mosi_pin) |
| void | set_cs_pin (uint8_t cs_pin) |
| void | set_interrupt_pin (uint8_t interrupt_pin) |
| void | set_reset_pin (uint8_t reset_pin) |
| void | set_clock_speed (int clock_speed) |
| void | set_polling_interval (uint32_t polling_interval) |
| void | set_phy_addr (uint8_t phy_addr) |
| void | set_power_pin (int power_pin) |
| void | set_mdc_pin (uint8_t mdc_pin) |
| void | set_mdio_pin (uint8_t mdio_pin) |
| void | set_clk_pin (uint8_t clk_pin) |
| void | set_clk_mode (emac_rmii_clock_mode_t clk_mode) |
| void | add_phy_register (PHYRegister register_value) |
| void | set_type (EthernetType type) |
| void | set_manual_ip (const ManualIP &manual_ip) |
| void | set_fixed_mac (const std::array< uint8_t, 6 > &mac) |
| network::IPAddresses | get_ip_addresses () |
| network::IPAddress | get_dns_address (uint8_t num) |
| const char * | get_use_address () const |
| void | set_use_address (const char *use_address) |
| void | get_eth_mac_address_raw (uint8_t *mac) |
| std::string | get_eth_mac_address_pretty () |
| const char * | get_eth_mac_address_pretty_into_buffer (std::span< char, MAC_ADDRESS_PRETTY_BUFFER_SIZE > buf) |
| eth_duplex_t | get_duplex_mode () |
| eth_speed_t | get_link_speed () |
| bool | powerdown () |
| void | add_ip_state_listener (EthernetIPStateListener *listener) |
| Trigger * | get_connect_trigger () |
| Trigger * | get_disconnect_trigger () |
Public Member Functions inherited from esphome::Component | |
| float | get_actual_setup_priority () const |
| void | set_setup_priority (float priority) |
| virtual float | get_loop_priority () const |
| priority of loop(). | |
| void | call () |
| virtual void | on_shutdown () |
| virtual void | on_safe_shutdown () |
| virtual bool | teardown () |
| Called during teardown to allow component to gracefully finish operations. | |
| uint8_t | get_component_state () const |
| void | reset_to_construction_state () |
| Reset this component back to the construction state to allow setup to run again. | |
| bool | is_in_loop_state () const |
| Check if this component has completed setup and is in the loop state. | |
| bool | is_idle () const |
| Check if this component is idle. | |
| virtual void | mark_failed () |
| Mark this component as failed. | |
| ESPDEPRECATED ("Use mark_failed(LOG_STR(\"static string literal\")) instead. Do NOT use .c_str() from temporary " "strings. Will stop working in 2026.6.0", "2025.12.0") void mark_failed(const char *message) | |
| void | mark_failed (const LogString *message) |
| void | disable_loop () |
| Disable this component's loop. | |
| void | enable_loop () |
| Enable this component's loop. | |
| void | enable_loop_soon_any_context () |
| Thread and ISR-safe version of enable_loop() that can be called from any context. | |
| bool | is_failed () const |
| bool | is_ready () const |
| virtual bool | can_proceed () |
| bool | status_has_warning () const |
| bool | status_has_error () const |
| void | status_set_warning (const char *message=nullptr) |
| void | status_set_warning (const LogString *message) |
| void | status_set_error () |
| ESPDEPRECATED ("Use status_set_error(LOG_STR(\"static string literal\")) instead. Do NOT use .c_str() from temporary " "strings. Will stop working in 2026.6.0", "2025.12.0") void status_set_error(const char *message) | |
| void | status_set_error (const LogString *message) |
| void | status_clear_warning () |
| void | status_clear_error () |
| void | status_momentary_warning (const char *name, uint32_t length=5000) |
| Set warning status flag and automatically clear it after a timeout. | |
| void | status_momentary_error (const char *name, uint32_t length=5000) |
| Set error status flag and automatically clear it after a timeout. | |
| bool | has_overridden_loop () const |
| void | set_component_source (const LogString *source) |
| Set where this component was loaded from for some debug messages. | |
| const LogString * | get_component_log_str () const |
| Get the integration where this component was declared as a LogString for logging. | |
| bool | should_warn_of_blocking (uint32_t blocking_time) |
Protected Member Functions | |
| void | notify_ip_state_listeners_ () |
| void | start_connect_ () |
| void | finish_connect_ () |
| void | dump_connect_params_ () |
| void | log_error_and_mark_failed_ (esp_err_t err, const char *message) |
| void | ksz8081_set_clock_reference_ (esp_eth_mac_t *mac) |
Set RMII Reference Clock Select bit for KSZ8081. | |
| void | write_phy_register_ (esp_eth_mac_t *mac, PHYRegister register_data) |
| Set arbitratry PHY registers from config. | |
Protected Member Functions inherited from esphome::Component | |
| virtual void | call_loop () |
| virtual void | call_setup () |
| virtual void | call_dump_config () |
| void | set_component_state_ (uint8_t state) |
| Helper to set component state (clears state bits and sets new state) | |
| void | set_interval (uint32_t id, uint32_t interval, std::function< void()> &&f) |
| Set an interval function with a numeric ID (zero heap allocation). | |
| void | set_interval (InternalSchedulerID id, uint32_t interval, std::function< void()> &&f) |
| void | set_interval (uint32_t interval, std::function< void()> &&f) |
| bool | cancel_interval (uint32_t id) |
| bool | cancel_interval (InternalSchedulerID id) |
| ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std | ESPDEPRECATED ("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const char *name |
| ESPDEPRECATED ("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(uint32_t id | |
| ESPDEPRECATED ("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(uint32_t initial_wait_time | |
| ESPDEPRECATED("cancel_retry is deprecated and will be removed in 2026.8.0.", "2026.2.0") bool cancel_retry(const std | ESPDEPRECATED ("cancel_retry is deprecated and will be removed in 2026.8.0.", "2026.2.0") bool cancel_retry(const char *name) |
| ESPDEPRECATED ("cancel_retry is deprecated and will be removed in 2026.8.0.", "2026.2.0") bool cancel_retry(uint32_t id) | |
| void | set_timeout (uint32_t id, uint32_t timeout, std::function< void()> &&f) |
| Set a timeout function with a numeric ID (zero heap allocation). | |
| void | set_timeout (InternalSchedulerID id, uint32_t timeout, std::function< void()> &&f) |
| void | set_timeout (uint32_t timeout, std::function< void()> &&f) |
| bool | cancel_timeout (uint32_t id) |
| bool | cancel_timeout (InternalSchedulerID id) |
| void | defer (std::function< void()> &&f) |
| Defer a callback to the next loop() call. | |
| void | defer (uint32_t id, std::function< void()> &&f) |
| Defer a callback with a numeric ID (zero heap allocation) | |
| bool | cancel_defer (uint32_t id) |
Static Protected Member Functions | |
| static void | eth_event_handler (void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) |
| static void | got_ip_event_handler (void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) |
| static void | got_ip6_event_handler (void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) |
Protected Attributes | |
| uint8_t | clk_pin_ {0} |
| uint8_t | miso_pin_ |
| uint8_t | mosi_pin_ |
| uint8_t | cs_pin_ |
| int | interrupt_pin_ {-1} |
| int | reset_pin_ {-1} |
| int | phy_addr_spi_ {-1} |
| int | clock_speed_ |
| uint32_t | polling_interval_ {0} |
| int | power_pin_ {-1} |
| emac_rmii_clock_mode_t | clk_mode_ {EMAC_CLK_EXT_IN} |
| std::vector< PHYRegister > | phy_registers_ {} |
| uint8_t | phy_addr_ {0} |
| uint8_t | mdc_pin_ {23} |
| uint8_t | mdio_pin_ {18} |
| optional< ManualIP > | manual_ip_ {} |
| uint32_t | connect_begin_ |
| EthernetType | type_ {ETHERNET_TYPE_UNKNOWN} |
| EthernetComponentState | state_ {EthernetComponentState::STOPPED} |
| bool | started_ {false} |
| bool | connected_ {false} |
| bool | got_ipv4_address_ {false} |
| uint8_t | ipv6_count_ {0} |
| bool | ipv6_setup_done_ {false} |
| esp_netif_t * | eth_netif_ {nullptr} |
| esp_eth_handle_t | eth_handle_ |
| esp_eth_phy_t * | phy_ {nullptr} |
| optional< std::array< uint8_t, 6 > > | fixed_mac_ |
| StaticVector< EthernetIPStateListener *, ESPHOME_ETHERNET_IP_STATE_LISTENERS > | ip_state_listeners_ |
| Trigger | connect_trigger_ |
| Trigger | disconnect_trigger_ |
Protected Attributes inherited from esphome::Component | |
| ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_interval(const std voi | set_interval )(const char *name, uint32_t interval, std::function< void()> &&f) |
| Set an interval function with a unique name. | |
| ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") bool cancel_interval(const std boo | cancel_interval )(const char *name) |
| Cancel an interval function. | |
| ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t | initial_wait_time |
| ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t | max_attempts |
| ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t std::function< RetryResult(uint8_t)> && | f |
| ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t std::function< RetryResult(uint8_t)> float | backoff_increase_factor = 1.0f) |
| uint32_t | initial_wait_time |
| uint32_t uint8_t | max_attempts |
| uint32_t uint8_t std::function< RetryResult(uint8_t)> && | f |
| uint32_t uint8_t std::function< RetryResult(uint8_t)> float | backoff_increase_factor = 1.0f) |
| uint8_t | max_attempts |
| uint8_t std::function< RetryResult(uint8_t)> && | f |
| uint8_t std::function< RetryResult(uint8_t)> float | backoff_increase_factor = 1.0f) |
| ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_timeout(const std voi | set_timeout )(const char *name, uint32_t timeout, std::function< void()> &&f) |
| Set a timeout function with a unique name. | |
| ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") bool cancel_timeout(const std boo | cancel_timeout )(const char *name) |
| Cancel a timeout function. | |
| ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0") void defer(const std voi | defer )(const char *name, std::function< void()> &&f) |
| Defer a callback to the next loop() call. | |
| ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0") bool cancel_defer(const std boo | cancel_defer )(const char *name) |
| Cancel a defer callback using the specified name, name must not be empty. | |
| const LogString * | component_source_ {nullptr} |
| uint16_t | warn_if_blocking_over_ {WARN_IF_BLOCKING_OVER_MS} |
| Warn if blocked for this many ms (max 65.5s) | |
| uint8_t | component_state_ {0x00} |
| State of this component - each bit has a purpose: Bits 0-2: Component state (0x00=CONSTRUCTION, 0x01=SETUP, 0x02=LOOP, 0x03=FAILED, 0x04=LOOP_DONE) Bit 3: STATUS_LED_WARNING Bit 4: STATUS_LED_ERROR Bits 5-7: Unused - reserved for future expansion. | |
| volatile bool | pending_enable_loop_ {false} |
| ISR-safe flag for enable_loop_soon_any_context. | |
Definition at line 72 of file ethernet_component.h.
| esphome::ethernet::EthernetComponent::EthernetComponent | ( | ) |
Definition at line 65 of file ethernet_component.cpp.
|
inline |
Definition at line 120 of file ethernet_component.h.
| void esphome::ethernet::EthernetComponent::add_phy_register | ( | PHYRegister | register_value | ) |
Definition at line 756 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 355 of file ethernet_component.cpp.
|
protected |
Definition at line 693 of file ethernet_component.cpp.
|
staticprotected |
Definition at line 488 of file ethernet_component.cpp.
|
protected |
Definition at line 573 of file ethernet_component.cpp.
|
inline |
Definition at line 124 of file ethernet_component.h.
|
inline |
Definition at line 127 of file ethernet_component.h.
| network::IPAddress esphome::ethernet::EthernetComponent::get_dns_address | ( | uint8_t | num | ) |
Definition at line 482 of file ethernet_component.cpp.
| eth_duplex_t esphome::ethernet::EthernetComponent::get_duplex_mode | ( | ) |
Definition at line 788 of file ethernet_component.cpp.
| std::string esphome::ethernet::EthernetComponent::get_eth_mac_address_pretty | ( | ) |
Definition at line 775 of file ethernet_component.cpp.
| const char * esphome::ethernet::EthernetComponent::get_eth_mac_address_pretty_into_buffer | ( | std::span< char, MAC_ADDRESS_PRETTY_BUFFER_SIZE > | buf | ) |
Definition at line 780 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::get_eth_mac_address_raw | ( | uint8_t * | mac | ) |
Definition at line 769 of file ethernet_component.cpp.
| network::IPAddresses esphome::ethernet::EthernetComponent::get_ip_addresses | ( | ) |
Definition at line 458 of file ethernet_component.cpp.
| eth_speed_t esphome::ethernet::EthernetComponent::get_link_speed | ( | ) |
Definition at line 796 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 456 of file ethernet_component.cpp.
| const char * esphome::ethernet::EthernetComponent::get_use_address | ( | ) | const |
Definition at line 765 of file ethernet_component.cpp.
|
staticprotected |
Definition at line 543 of file ethernet_component.cpp.
|
staticprotected |
Definition at line 524 of file ethernet_component.cpp.
| bool esphome::ethernet::EthernetComponent::is_connected | ( | ) |
Definition at line 691 of file ethernet_component.cpp.
|
protected |
Set RMII Reference Clock Select bit for KSZ8081.
Definition at line 825 of file ethernet_component.cpp.
|
protected |
Definition at line 48 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 302 of file ethernet_component.cpp.
|
protected |
Definition at line 563 of file ethernet_component.cpp.
|
inlineoverridevirtual |
Reimplemented from esphome::Component.
Definition at line 79 of file ethernet_component.h.
| bool esphome::ethernet::EthernetComponent::powerdown | ( | ) |
Definition at line 804 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_clk_mode | ( | emac_rmii_clock_mode_t | clk_mode | ) |
Definition at line 755 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_clk_pin | ( | uint8_t | clk_pin | ) |
Definition at line 739 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_clk_pin | ( | uint8_t | clk_pin | ) |
| void esphome::ethernet::EthernetComponent::set_clock_speed | ( | int | clock_speed | ) |
Definition at line 745 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_cs_pin | ( | uint8_t | cs_pin | ) |
Definition at line 742 of file ethernet_component.cpp.
|
inline |
Definition at line 106 of file ethernet_component.h.
| void esphome::ethernet::EthernetComponent::set_interrupt_pin | ( | uint8_t | interrupt_pin | ) |
Definition at line 743 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_manual_ip | ( | const ManualIP & | manual_ip | ) |
Definition at line 760 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_mdc_pin | ( | uint8_t | mdc_pin | ) |
Definition at line 752 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_mdio_pin | ( | uint8_t | mdio_pin | ) |
Definition at line 753 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_miso_pin | ( | uint8_t | miso_pin | ) |
Definition at line 740 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_mosi_pin | ( | uint8_t | mosi_pin | ) |
Definition at line 741 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_phy_addr | ( | uint8_t | phy_addr | ) |
Definition at line 750 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_polling_interval | ( | uint32_t | polling_interval | ) |
Definition at line 747 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_power_pin | ( | int | power_pin | ) |
Definition at line 751 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_reset_pin | ( | uint8_t | reset_pin | ) |
Definition at line 744 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_type | ( | EthernetType | type | ) |
Definition at line 758 of file ethernet_component.cpp.
| void esphome::ethernet::EthernetComponent::set_use_address | ( | const char * | use_address | ) |
Definition at line 767 of file ethernet_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 67 of file ethernet_component.cpp.
|
protected |
Definition at line 597 of file ethernet_component.cpp.
|
protected |
Set arbitratry PHY registers from config.
Definition at line 857 of file ethernet_component.cpp.
|
protected |
Definition at line 165 of file ethernet_component.h.
|
protected |
Definition at line 151 of file ethernet_component.h.
|
protected |
Definition at line 158 of file ethernet_component.h.
|
protected |
Definition at line 177 of file ethernet_component.h.
|
protected |
Definition at line 201 of file ethernet_component.h.
|
protected |
Definition at line 183 of file ethernet_component.h.
|
protected |
Definition at line 154 of file ethernet_component.h.
|
protected |
Definition at line 204 of file ethernet_component.h.
|
protected |
Definition at line 192 of file ethernet_component.h.
|
protected |
Definition at line 191 of file ethernet_component.h.
|
protected |
Definition at line 194 of file ethernet_component.h.
|
protected |
Definition at line 184 of file ethernet_component.h.
|
protected |
Definition at line 155 of file ethernet_component.h.
|
protected |
Definition at line 197 of file ethernet_component.h.
|
protected |
Definition at line 186 of file ethernet_component.h.
|
protected |
Definition at line 187 of file ethernet_component.h.
Definition at line 175 of file ethernet_component.h.
|
protected |
Definition at line 171 of file ethernet_component.h.
|
protected |
Definition at line 172 of file ethernet_component.h.
|
protected |
Definition at line 152 of file ethernet_component.h.
|
protected |
Definition at line 153 of file ethernet_component.h.
|
protected |
Definition at line 193 of file ethernet_component.h.
|
protected |
Definition at line 170 of file ethernet_component.h.
|
protected |
Definition at line 157 of file ethernet_component.h.
|
protected |
Definition at line 166 of file ethernet_component.h.
|
protected |
Definition at line 160 of file ethernet_component.h.
|
protected |
Definition at line 164 of file ethernet_component.h.
|
protected |
Definition at line 156 of file ethernet_component.h.
|
protected |
Definition at line 182 of file ethernet_component.h.
|
protected |
Definition at line 181 of file ethernet_component.h.
|
protected |
Definition at line 180 of file ethernet_component.h.