Skip to content

Commit cc69048

Browse files
selbstmacherTheRealMoeder
authored andcommitted
feat: enhance homepage with improved HTML layout and navigation links
1 parent 13de0d9 commit cc69048

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

src/main.cpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,35 @@ void setup(void) {
5353
// Set up web server and endpoints
5454

5555
server.on("/", AsyncWebRequestMethod::HTTP_GET, [](AsyncWebServerRequest *request) {
56-
request->send(200, "text/plain", "This is the Energy2Shelly for ESP converter!\r\nDevice and Energy status is available under /status\r\nTo reset configuration, goto /reset\r\n");
56+
String html = R"=====(
57+
<!DOCTYPE html>
58+
<html>
59+
<head>
60+
<title>Energy2Shelly ESP</title>
61+
<meta name="viewport" content="width=device-width, initial-scale=1">
62+
<style>
63+
body { font-family: Arial, sans-serif; text-align: center; padding: 40px; background-color: #f4f4f4; color: #333; }
64+
h1 { color: #0056b3; }
65+
p { font-size: 1.1em; }
66+
.nav { margin-top: 30px; }
67+
.nav a { display: inline-block; padding: 12px 24px; margin: 8px; background-color: #007bff; color: white; text-decoration: none; border-radius: 5px; transition: background-color 0.3s; }
68+
.nav a:hover { background-color: #0056b3; }
69+
.nav a.reset { background-color: #d9534f; }
70+
.nav a.reset:hover { background-color: #c9302c; }
71+
</style>
72+
</head>
73+
<body>
74+
<h1>Energy2Shelly ESP</h1>
75+
<p>This device emulates a Shelly Pro 3EM to integrate various energy meters.</p>
76+
<div class="nav">
77+
<a href="/status">View Status</a>
78+
<a href="/config">Change Configuration</a>
79+
<a href="/reset" class="reset">Reset Device</a>
80+
</div>
81+
</body>
82+
</html>
83+
)=====";
84+
request->send(200, "text/html", html);
5785
});
5886

5987
server.on("/shelly", AsyncWebRequestMethod::HTTP_GET, [](AsyncWebServerRequest *request) {

0 commit comments

Comments
 (0)