Merge pull request #47 from mbiernacik/build-warnings

Replace deprecated IP address and sensor state APIs
This commit is contained in:
Pawel
2026-06-05 11:43:55 +02:00
committed by GitHub
4 changed files with 20 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ sensor:
- text_sensor.template.publish:
id: wt32_uptime
state: !lambda |-
int seconds = round(id(wt32_uptime_seconds).raw_state);
int seconds = round(id(wt32_uptime_seconds).get_raw_state());
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
@@ -33,7 +33,10 @@ text_sensor:
entity_category: diagnostic
icon: 'mdi:ip-network'
lambda: |-
return id(eth).get_ip_addresses().empty() ? "Unset" : id(eth).get_ip_addresses()[0].str();
if (id(eth).get_ip_addresses().empty()) return {"Unset"};
char buf[esphome::network::IP_ADDRESS_BUFFER_SIZE];
id(eth).get_ip_addresses()[0].str_to(buf);
return {buf};
update_interval: 60s
script:

View File

@@ -9,7 +9,7 @@ sensor:
- text_sensor.template.publish:
id: wt32_uptime
state: !lambda |-
int seconds = round(id(wt32_uptime_seconds).raw_state);
int seconds = round(id(wt32_uptime_seconds).get_raw_state());
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
@@ -33,7 +33,10 @@ text_sensor:
entity_category: diagnostic
icon: 'mdi:ip-network'
lambda: |-
return id(eth).get_ip_addresses().empty() ? "Unset" : id(eth).get_ip_addresses()[0].str();
if (id(eth).get_ip_addresses().empty()) return {"Unset"};
char buf[esphome::network::IP_ADDRESS_BUFFER_SIZE];
id(eth).get_ip_addresses()[0].str_to(buf);
return {buf};
update_interval: 60s
script:

View File

@@ -9,7 +9,7 @@ sensor:
- text_sensor.template.publish:
id: wt32_uptime
state: !lambda |-
int seconds = round(id(wt32_uptime_seconds).raw_state);
int seconds = round(id(wt32_uptime_seconds).get_raw_state());
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
@@ -33,7 +33,10 @@ text_sensor:
entity_category: diagnostic
icon: 'mdi:ip-network'
lambda: |-
return id(eth).get_ip_addresses().empty() ? "Unset" : id(eth).get_ip_addresses()[0].str();
if (id(eth).get_ip_addresses().empty()) return {"Unset"};
char buf[esphome::network::IP_ADDRESS_BUFFER_SIZE];
id(eth).get_ip_addresses()[0].str_to(buf);
return {buf};
update_interval: 60s
script:

View File

@@ -9,7 +9,7 @@ sensor:
- text_sensor.template.publish:
id: wt32_uptime
state: !lambda |-
int seconds = round(id(wt32_uptime_seconds).raw_state);
int seconds = round(id(wt32_uptime_seconds).get_raw_state());
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
@@ -33,7 +33,10 @@ text_sensor:
entity_category: diagnostic
icon: 'mdi:ip-network'
lambda: |-
return id(eth).get_ip_addresses().empty() ? "Unset" : id(eth).get_ip_addresses()[0].str();
if (id(eth).get_ip_addresses().empty()) return {"Unset"};
char buf[esphome::network::IP_ADDRESS_BUFFER_SIZE];
id(eth).get_ip_addresses()[0].str_to(buf);
return {buf};
update_interval: 60s
script: