add webserver with API for controlling commands

This commit is contained in:
Nicu Hodos 2025-09-07 10:22:35 +02:00
parent 57c6051f7d
commit 74ff694293
2 changed files with 6 additions and 1 deletions

View File

@ -23,7 +23,8 @@ lib_deps =
sparkfun/SparkFun BME280@^2.0.9
arkhipenko/TaskScheduler@^3.8.5
https://git.hodos.ro/libraries/wifi.git@^2.0.0
https://git.hodos.ro/libraries/ha-mqtt.git@^1.7.0
https://git.hodos.ro/libraries/ha-mqtt.git@^1.8.0
https://git.hodos.ro/libraries/ha-webserver.git@^1.0.0
build_flags = -D WIFI_ALWAYS_ON=1 -D ADAFRUIT_BME=1
[env:laptop_home]

View File

@ -23,6 +23,7 @@ void turnLed(bool on = true) {
#include "devices.h"
#include "mqtt.h"
#include "ota.h"
#include "webserver.h"
#define BUTTON D3
@ -63,6 +64,7 @@ void setup() {
Mqtt::publishCleanupConfig();
delay(2000);
Mqtt::disconnect();
WebServer::stop();
});
Ntp::setup();
Bme::setup();
@ -77,10 +79,12 @@ void setup() {
Ota::tLoop.enable();
Mqtt::tReConnect.enable();
Ntp::tUpdateTime.enable();
WebServer::setup();
},
[] {
Ota::tLoop.disable();
Mqtt::tReConnect.disable();
WebServer::stop();
});
pinMode(BUTTON, INPUT_PULLUP);