From f83297809b337cb4dd5ca8094ac23f158761cd72 Mon Sep 17 00:00:00 2001 From: TilCreator Date: Mon, 28 May 2018 20:32:22 +0200 Subject: [PATCH 1/6] Add link to next Webui --- wifimgr.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/wifimgr.py b/wifimgr.py index 387866c..cef009b 100644 --- a/wifimgr.py +++ b/wifimgr.py @@ -6,6 +6,7 @@ ap_ssid = "WifiManager" ap_password = "tayfunulu" ap_authmode = 3 # WPA2 +linkToNextWebinterface = True NETWORK_PROFILES = 'wifi.dat' @@ -202,11 +203,19 @@ def handle_configure(client, request): ESP successfully connected to WiFi network %(ssid)s. - + """ % dict(ssid=ssid) + if linkToNextWebinterface: + response += """\ +

+ To new Interface
+ (You must be connected to the set network to follow this Link) +

+ """ % dict(ip=wlan_sta.ifconfig()[0]) + response += """\

- """ % dict(ssid=ssid) + """ send_response(client, response) try: profiles = read_profiles() From 35727e21d98fbc6965f2389cc5d8b26614c9696b Mon Sep 17 00:00:00 2001 From: TilCreator Date: Wed, 30 May 2018 13:24:06 +0200 Subject: [PATCH 2/6] Change var naming style to match code --- wifimgr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wifimgr.py b/wifimgr.py index cef009b..8370bfe 100644 --- a/wifimgr.py +++ b/wifimgr.py @@ -6,7 +6,7 @@ ap_ssid = "WifiManager" ap_password = "tayfunulu" ap_authmode = 3 # WPA2 -linkToNextWebinterface = True +link_to_next_webui = True NETWORK_PROFILES = 'wifi.dat' @@ -204,7 +204,7 @@ def handle_configure(client, request): ESP successfully connected to WiFi network %(ssid)s. """ % dict(ssid=ssid) - if linkToNextWebinterface: + if link_to_next_webui: response += """\

To new Interface
From 540770e959e7cc582ee4da24d23834536c8df641 Mon Sep 17 00:00:00 2001 From: TilCreator Date: Wed, 30 May 2018 13:25:16 +0200 Subject: [PATCH 3/6] Fix string formating --- wifimgr.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wifimgr.py b/wifimgr.py index 8370bfe..929e7a8 100644 --- a/wifimgr.py +++ b/wifimgr.py @@ -207,7 +207,7 @@ def handle_configure(client, request): if link_to_next_webui: response += """\

- To new Interface
+ To new Interface
(You must be connected to the set network to follow this Link)

""" % dict(ip=wlan_sta.ifconfig()[0]) @@ -299,4 +299,3 @@ def start(port=80): handle_not_found(client, url) finally: client.close() - From 4820592558198a8c2172b4a682101095002362ec Mon Sep 17 00:00:00 2001 From: TilCreator Date: Thu, 31 May 2018 16:09:17 +0200 Subject: [PATCH 4/6] Add comment to clarify config var function --- wifimgr.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wifimgr.py b/wifimgr.py index 929e7a8..e0ccc06 100644 --- a/wifimgr.py +++ b/wifimgr.py @@ -6,6 +6,9 @@ ap_ssid = "WifiManager" ap_password = "tayfunulu" ap_authmode = 3 # WPA2 + +# If `link_to_next_webui` is set to `True` on the successfully connected page there is a link to the IP of the ESP in the newly connected WiFi. +# This is useful if the ESP shows an other web interface after the WiFiManager, because the user can just click the link and doesn't have to search the new IP of the ESP. link_to_next_webui = True NETWORK_PROFILES = 'wifi.dat' From eb8794cdeec0e33294201cbc705e083f5755f54d Mon Sep 17 00:00:00 2001 From: TilCreator Date: Thu, 31 May 2018 16:09:47 +0200 Subject: [PATCH 5/6] Not only link but also show IP --- wifimgr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifimgr.py b/wifimgr.py index e0ccc06..d523be3 100644 --- a/wifimgr.py +++ b/wifimgr.py @@ -210,7 +210,7 @@ def handle_configure(client, request): if link_to_next_webui: response += """\

- To new Interface
+ To new Interface [%(ip)s]
(You must be connected to the set network to follow this Link)

""" % dict(ip=wlan_sta.ifconfig()[0]) From b00ae1fa463a16a6f8869348bba05d533091259a Mon Sep 17 00:00:00 2001 From: TilCreator Date: Thu, 31 May 2018 23:28:28 +0200 Subject: [PATCH 6/6] Add IP to success page --- wifimgr.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wifimgr.py b/wifimgr.py index d523be3..aa1b3fc 100644 --- a/wifimgr.py +++ b/wifimgr.py @@ -204,13 +204,13 @@ def handle_configure(client, request):

- ESP successfully connected to WiFi network %(ssid)s. + ESP successfully connected to WiFi network %(ssid)s with IP %(ip)s. -

""" % dict(ssid=ssid) + """ % dict(ssid=ssid, ip=wlan_sta.ifconfig()[0]) if link_to_next_webui: response += """\

- To new Interface [%(ip)s]
+ To new Interface
(You must be connected to the set network to follow this Link)

""" % dict(ip=wlan_sta.ifconfig()[0])