From 6eb2a44d637028a4d20e9480922d135fbd9d201d Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Mar 2026 12:10:03 +0000 Subject: [PATCH] Add pool controller web page with full controls Adds /pool page with controls for all pool aspects (mode, temperature, channels, lighting, valves, heaters, favourites) and a read-only chlorinator section. Also adds /api/command POST endpoint that accepts JSON commands and sends the appropriate UART protocol messages to the pool bus, enabling standalone control without Home Assistant. - /pool: auto-refreshing control UI (5s poll, 500ms after commands) - /api/command: JSON API for mode, temperature, channel, light, heater, valve, and favourite commands - Nav updated to include Pool Controls link on all pages - HTTP_MAX_URI_HANDLERS bumped from 14 to 16 https://claude.ai/code/session_01RzbUePWyC17sxRBGDSrewy --- main/config.h | 3 +- main/web_handlers.c | 389 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 391 insertions(+), 1 deletion(-) diff --git a/main/config.h b/main/config.h index e02eaa0..9c73bb0 100644 --- a/main/config.h +++ b/main/config.h @@ -19,7 +19,7 @@ // HTTP Server #define HTTP_SERVER_PORT 80 -#define HTTP_MAX_URI_HANDLERS 14 // Number of endpoint handlers +#define HTTP_MAX_URI_HANDLERS 16 // Number of endpoint handlers #define HTTP_RECV_TIMEOUT_SEC 10 // Timeout for receiving requests #define HTTP_SEND_TIMEOUT_SEC 10 // Timeout for sending responses #define HTTP_STACK_SIZE 8192 // Stack size for HTTP server task @@ -112,6 +112,7 @@ #define HTTP_MQTT_CONFIG_BUFFER_SIZE 512 // Buffer for MQTT config requests #define HTTP_WIFI_SCAN_BUFFER_SIZE 4096 // Buffer for WiFi scan results JSON #define HTTP_OTA_BUFFER_SIZE 4096 // Buffer for OTA firmware chunks +#define HTTP_API_COMMAND_BUFFER_SIZE 256 // Buffer for /api/command requests // ====================================================== // Timeouts & Delays diff --git a/main/web_handlers.c b/main/web_handlers.c index 5397ca0..d1d2525 100644 --- a/main/web_handlers.c +++ b/main/web_handlers.c @@ -6,6 +6,7 @@ #include "message_decoder.h" #include "tcp_bridge.h" #include "device_serial.h" +#include "bus.h" #include "esp_wifi.h" #include "esp_log.h" #include "esp_system.h" @@ -95,6 +96,7 @@ char *get_page_nav(const char page) { "