From 33d6dbed3dccaf729a8587c7d3b959962de4c461 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Fri, 6 Jan 2023 14:03:16 +0100 Subject: [PATCH] No IP address shown when in AP moode (#17599) (#17619) --- CHANGELOG.md | 1 + tasmota/tasmota_support/support_wifi.ino | 4 ++++ tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cbc31475..d50926f05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file. ### Fixed - Energy dummy switched voltage and power regression from v12.2.0.2 - Orno WE517 modbus serial config 8E1 setting (#17545) +- No IP address shown when in AP moode (#17599) ### Removed diff --git a/tasmota/tasmota_support/support_wifi.ino b/tasmota/tasmota_support/support_wifi.ino index 6d946e3cd..fe2b63cf2 100644 --- a/tasmota/tasmota_support/support_wifi.ino +++ b/tasmota/tasmota_support/support_wifi.ino @@ -761,6 +761,10 @@ bool WifiGetIP(IPAddress *ip) { if (ip != nullptr) { *ip = WiFi.localIP(); } return true; } + if ((uint32_t)WiFi.softAPIP() != 0) { + if (ip != nullptr) { *ip = WiFi.softAPIP(); } + return true; + } IPAddress lip; if (WifiGetIPv6(&lip)) { if (ip != nullptr) { *ip = lip; } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index de4a3a498..f1a85b69b 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -3209,7 +3209,7 @@ bool CaptivePortal(void) if ((WifiIsInManagerMode()) && !ValidIpAddress(Webserver->hostHeader().c_str())) { AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_REDIRECTED)); - Webserver->sendHeader(F("Location"), String(F("http://")) + Webserver->client().localIP().toString(), true); + Webserver->sendHeader(F("Location"), String(F("http://")) + IPGetListeningAddressStr(), true); WSSend(302, CT_PLAIN, ""); // Empty content inhibits Content-length header so we have to close the socket ourselves. Webserver->client().stop(); // Stop is needed because we sent no content length return true;