From a6ec7dde16512a985f906c5e1fcfbbaad27db635 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 22 Feb 2022 15:13:26 +0100 Subject: [PATCH] Add ethernet ipaddress to GUI Add ethernet ipaddress to GUI (#14929) --- tasmota/xdrv_01_webserver.ino | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 4964c6d48..c55dd5f74 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -881,12 +881,28 @@ void WSContentSendStyle_P(const char* formatP, ...) { #endif bool lip = (static_cast(WiFi.localIP()) != 0); bool sip = (static_cast(WiFi.softAPIP()) != 0); - WSContentSend_P(PSTR("

%s%s (%s%s%s)

"), // tasmota.local (192.168.2.12, 192.168.4.1) - NetworkHostname(), - (Mdns.begun) ? PSTR(".local") : "", - (lip) ? WiFi.localIP().toString().c_str() : "", - (lip && sip) ? ", " : "", - (sip) ? WiFi.softAPIP().toString().c_str() : ""); + bool eip = false; + if (lip || sip) { + WSContentSend_P(PSTR("

%s%s (%s%s%s)"), // tasmota.local (192.168.2.12, 192.168.4.1) + TasmotaGlobal.hostname, + (Mdns.begun) ? PSTR(".local") : "", + (lip) ? WiFi.localIP().toString().c_str() : "", + (lip && sip) ? ", " : "", + (sip) ? WiFi.softAPIP().toString().c_str() : ""); + } +#if defined(ESP32) && CONFIG_IDF_TARGET_ESP32 && defined(USE_ETHERNET) + eip = (static_cast(EthernetLocalIP()) != 0); + if (eip) { + WSContentSend_P(PSTR("%s%s%s (%s)"), // tasmota-eth.local (192.168.2.13) + (lip || sip) ? PSTR("
") : PSTR("

"), + EthernetHostname(), + (Mdns.begun) ? PSTR(".local") : "", + (eip) ? EthernetLocalIP().toString().c_str() : ""); + } +#endif + if (lip || sip || eip) { + WSContentSend_P(PSTR("

")); + } } WSContentSend_P(PSTR("")); }