mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-31 02:08:26 +02:00
Add ethernet DNS text sensor and simplify DNS display format (#6450)
This commit is contained in:
@@ -39,15 +39,10 @@ class IPAddressWiFiInfo : public PollingComponent, public text_sensor::TextSenso
|
||||
class DNSAddressWifiInfo : public PollingComponent, public text_sensor::TextSensor {
|
||||
public:
|
||||
void update() override {
|
||||
std::string dns_results;
|
||||
|
||||
auto dns_one = wifi::global_wifi_component->get_dns_address(0);
|
||||
auto dns_two = wifi::global_wifi_component->get_dns_address(1);
|
||||
|
||||
dns_results += "DNS1: ";
|
||||
dns_results += dns_one.str();
|
||||
dns_results += " DNS2: ";
|
||||
dns_results += dns_two.str();
|
||||
std::string dns_results = dns_one.str() + " " + dns_two.str();
|
||||
|
||||
if (dns_results != this->last_results_) {
|
||||
this->last_results_ = dns_results;
|
||||
|
||||
Reference in New Issue
Block a user