-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatusWeb.cpp
More file actions
31 lines (27 loc) · 1.17 KB
/
Copy pathStatusWeb.cpp
File metadata and controls
31 lines (27 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "StatusWeb.h"
#include "BedJetClient.h"
// --------- Status web ----------
void startStatusWeb() {
web.on("/", HTTP_GET, []() {
String msg;
msg.reserve(1000);
msg += "BedJet Matter Bridge\n\n";
msg += "WiFi: " + String(WiFi.status() == WL_CONNECTED ? "connected" : "not-connected") + "\n";
msg += "IP: " + WiFi.localIP().toString() + "\n";
msg += "BedJet base: " + gBedJetBase + "\n";
msg += "Default mode when OFF: " + gDefaultModeOnTemp + "\n";
msg += "Last BedJet mode: " + gLastBedJetMode + " (button=" + gLastBedJetModeButton + ")\n";
msg += "Commissioned: " + String(Matter.isDeviceCommissioned() ? "true" : "false") + "\n";
msg += "Pairing code: " + Matter.getManualPairingCode() + "\n";
msg += "QR URL: " + Matter.getOnboardingQRCodeUrl() + "\n";
web.send(200, "text/plain", msg);
});
web.on("/button", HTTP_POST, []() {
if (!web.hasArg("name")) { web.send(400, "text/plain", "Missing name"); return; }
String n = web.arg("name"); n.trim(); n.toUpperCase();
Serial.printf("[WEB] Button request: %s\n", n.c_str());
enqueueCmdModeButton(n);
web.send(200, "text/plain", "Queued");
});
web.begin();
}