From 74ff694293c2979f66c18eabe5f15ab5ff242c61 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Sun, 7 Sep 2025 10:22:35 +0200 Subject: [PATCH] add webserver with API for controlling commands --- platformio.ini | 3 ++- src/esp_clock.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index f733b42..04428e5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -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] diff --git a/src/esp_clock.cpp b/src/esp_clock.cpp index 58ac444..ba0c0ab 100644 --- a/src/esp_clock.cpp +++ b/src/esp_clock.cpp @@ -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);