Hi,
Today, I encountered an error while compiling my ESPHome code.
The issue seems to be related to the following line:
lambda: return { id(eth).get_ip_address().str() };
The error message points to this part of the configuration. Specifically, it appears that the lambda
expression needs adjustment.
Here’s the context:
text_sensor:
- platform: template
name: “${friendly_name} IP Address”
entity_category: diagnostic
icon: “mdi:ip-network”
lambda: return { id(eth).get_ip_address().str() };
update_interval: 60s
Additionally, based on the recent change log for ESPHome, there have been updates related to IPv6 support.
If you are building an external component or using functions like
network::get_ip_address()
,wifi::global_wifi_component->get_ip_address()
, orethernet::global_eth_component->get_ip_address()
, note that these functions have been renamed to::get_ip_addresses()
. They now return a list of all IP addresses.
To achieve the same result as before, do I need to modify the lambda
expression as follows?
lambda: return { id(eth).get_ip_addressESS().str() };
that’s correct?
regards