From fdb214ec557cb483e0ff83e76d3def77a3fa14e0 Mon Sep 17 00:00:00 2001 From: iosullivan Date: Mon, 5 Oct 2026 18:11:21 +1000 Subject: [PATCH] Updates for web server --- examples/src/micropython-webserver/main.py | 80 +++++++++++++++++-- .../src/micropython-webserver/portal.html | 7 ++ 2 files changed, 82 insertions(+), 5 deletions(-) diff --git a/examples/src/micropython-webserver/main.py b/examples/src/micropython-webserver/main.py index 1a81ef9..6c9040a 100644 --- a/examples/src/micropython-webserver/main.py +++ b/examples/src/micropython-webserver/main.py @@ -87,11 +87,81 @@ def start_http_server(): """ else: # Serve the setup page for any other request - try: - with open("portal.html") as f: - response_body = f.read() - except: - response_body = "

Setup Page Not Found

Please upload portal.html

" + # Build list of stations + html_list = '' + for station, dict in stations.items(): # loop through all stations + html_list += f'' + + response_body = """ + + + + Device Setup + + + +

Device Setup

+ +
+ + + + + + + + + +
+ +""".format(html_list) + response = ( "HTTP/1.1 200 OK\r\n" diff --git a/examples/src/micropython-webserver/portal.html b/examples/src/micropython-webserver/portal.html index 2fc89fe..fa17e32 100644 --- a/examples/src/micropython-webserver/portal.html +++ b/examples/src/micropython-webserver/portal.html @@ -56,6 +56,13 @@ + +