Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
079e101
first commit
hmbacher May 19, 2025
6f4dbf3
Implement fans configuration feature with UI and backend support
hmbacher May 23, 2025
55ccebd
feat: Add sensor management and control functionality
hmbacher May 27, 2025
ac2c695
feat: Enhance temperature sensor handling with error tracking and eve…
hmbacher May 28, 2025
9e024e2
migrated from ESP32C3 to ESP32S3
hmbacher May 28, 2025
4dc040f
feat: Implement FFC MQTT Configuration and Alarm Logging
hmbacher Jun 2, 2025
6f11828
feat: Integrate alarm state management and update alarm handling in UI
hmbacher Jun 4, 2025
151e871
feat: Add RPM sensor functionality and integrate with fan controller
hmbacher Jun 4, 2025
ac5620a
feat: Refactor RPM sensor to include alarm service and enhance error …
hmbacher Jun 4, 2025
3f179a6
feat: Implement sensor discovery functionality and update controller …
hmbacher Jun 8, 2025
0fe3bd1
feat: Remove unused icons and configuration files; update logo in UI
hmbacher Jun 8, 2025
b6be847
feat: Update navigation to settings page and enhance alarm display wi…
hmbacher Jun 9, 2025
c50ef9a
feat: Enhance alarm notifications and add fan/temperature monitoring …
hmbacher Jun 9, 2025
ce4df56
chore: Update TODO file for project organization and future tasks
hmbacher Jun 9, 2025
5309bb6
feat: Add configuration file and update PWM settings for fan control;…
hmbacher Jun 22, 2025
9cf6e5a
- Removed obsolete (default) docs
hmbacher Aug 9, 2025
0c2f433
chore: Add initial TODO file with features and known bugs
hmbacher Aug 10, 2025
94d4439
Reworked network settings
hmbacher Aug 26, 2025
af42908
Fixed complier/IDE warnings
hmbacher Aug 26, 2025
5d80712
Updated pioarduino platfom and switched to explicit versioning
hmbacher Aug 26, 2025
2d9440a
Merge remote-tracking branch 'esp32sveltekit/main'
hmbacher Aug 26, 2025
db32c2f
Cleanup up async worker
hmbacher Aug 26, 2025
17e0c0a
Update development server configuration and dependencies
hmbacher Aug 27, 2025
9150064
Updated SSL cert creation config, updated pipeline scripts
hmbacher Aug 28, 2025
c6d826b
Fixed vite dev server issue
hmbacher Aug 28, 2025
c6d2462
Fixed bug if now handlers are passed
hmbacher Aug 28, 2025
aa9437c
Added coredump
hmbacher Aug 28, 2025
a5ac26d
Finalized Wifi Sta settings
hmbacher Aug 28, 2025
8d21f11
Merge branch 'main' of github.com:hmbacher/fridge-fan-control
hmbacher Aug 28, 2025
973e280
Optimized dirty flag for SettingsCard and Collapsible
hmbacher Aug 28, 2025
60d4e91
Delete lib/framework/WWWData.h
hmbacher Sep 14, 2025
0750aac
Fixed preprocessor directive
hmbacher Sep 14, 2025
0c155a8
Fixed makro redefinition
hmbacher Sep 14, 2025
59a51b6
Enhanced logo visualization on login page and on main page
hmbacher Sep 15, 2025
478d7fd
Added $src path alias
hmbacher Sep 15, 2025
ad370d4
Added missing page.ts for Core Dump
hmbacher Sep 15, 2025
d418239
Changes to prevent Svelte warning 'binding_property_non_reactive'
hmbacher Sep 15, 2025
ee6204f
Fixed PSRAM chart creation
hmbacher Sep 15, 2025
4de03b7
Fixed PSRAM metric
hmbacher Sep 15, 2025
b10d623
Implemented delayed wifi reconnect, to allow previous POST request to…
hmbacher Sep 16, 2025
deca943
Optimized language
hmbacher Sep 16, 2025
4d06842
Implemented draggable list with svelte-dnd-action
hmbacher Sep 19, 2025
99ce894
Fixed overflow properties
hmbacher Sep 19, 2025
0d3eb9f
Fixed Websockets implementation in frontend
hmbacher Sep 26, 2025
1926029
Changed drag & drop styling
hmbacher Sep 26, 2025
8263db0
Fixed re-ordering of Smoke detectors
hmbacher Sep 26, 2025
8fcd683
Cleanup up obsolete comments
hmbacher Sep 26, 2025
dceea17
Show HTML in Info and Confirm dialog
hmbacher Sep 28, 2025
0a89485
Removed deprecated commands in build script
hmbacher Oct 4, 2025
985b872
Enhanced execution of pre-build scripts
hmbacher Oct 5, 2025
989c378
Add print statements to indicate skipped execution for non-build task…
hmbacher Oct 5, 2025
033ab93
Merge branch 'main' into pr/hmbacher/100
theelims Oct 17, 2025
8531a3c
Latest Arduino
theelims Oct 17, 2025
3691c5f
Merge pull request #1 from theelims/main
hmbacher Oct 19, 2025
5ec8e39
Merge branch 'update'
hmbacher Oct 19, 2025
be9e831
Added an extensible health check to ESP32SvelteKit
hmbacher Oct 19, 2025
14c2b71
Fixed overflow of WiFi networks list
hmbacher Nov 2, 2025
a81b54f
Merge branch 'main' of github.com:hmbacher/ESP32-sveltekit
hmbacher Nov 2, 2025
d0b9491
Hiding DHCP/Static badge for small screens
hmbacher Nov 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions interface/src/routes/wifi/sta/Wifi.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -498,21 +498,20 @@
>
{#snippet children({ item: network, index }: { item: any; index: number })}
<!-- svelte-ignore a11y_click_events_have_key_events -->
<div class="rounded-box bg-base-100 flex items-center space-x-3 px-4 py-2">
<div class="rounded-box bg-base-100 grid grid-cols-[auto_auto_minmax(6rem,1fr)_auto] items-center gap-3 p-2">
<Grip class="h-6 w-6 text-base-content/30 cursor-grab" />
<div class="mask mask-hexagon bg-primary h-auto w-10 shrink-0">
<div class="mask mask-hexagon bg-primary h-auto w-10">
<Router class="text-primary-content h-auto w-full scale-75" />
</div>
<div>
<div class="font-bold">{network.ssid}</div>
<div class="flex items-center gap-2 overflow-hidden">
<div class="font-bold truncate">{network.ssid}</div>
{#if network.static_ip_config}
<div class="badge badge-sm badge-secondary opacity-75 flex-shrink-0 hidden sm:inline-flex">Static</div>
{:else}
<div class="badge badge-sm badge-outline badge-secondary opacity-75 flex-shrink-0 hidden sm:inline-flex">DHCP</div>
{/if}
</div>
{#if network.static_ip_config}
<div class="badge badge-sm badge-secondary opacity-75">Static</div>
{:else}
<div class="badge badge-sm badge-outline badge-secondary opacity-75">DHCP</div>
{/if}
<div class="grow"></div>
<div class="space-x-0 px-0 mx-0">
<div class="flex">
<button
class="btn btn-ghost btn-sm"
onclick={() => {
Expand Down
2 changes: 2 additions & 0 deletions lib/framework/ESP32SvelteKit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ ESP32SvelteKit::ESP32SvelteKit(PsychicHttpServer *server, unsigned int numberEnd
#endif
_restartService(server, &_securitySettingsService),
_factoryResetService(server, &ESPFS, &_securitySettingsService),
_healthCheckService(server, &_securitySettingsService),
#if FT_ENABLED(FT_COREDUMP)
_coreDump(server, &_securitySettingsService),
#endif
Expand Down Expand Up @@ -145,6 +146,7 @@ void ESP32SvelteKit::begin()
_apSettingsService.begin();
_factoryResetService.begin();
_featureService.begin();
_healthCheckService.begin();
_restartService.begin();
_systemStatus.begin();
_wifiSettingsService.begin();
Expand Down
7 changes: 7 additions & 0 deletions lib/framework/ESP32SvelteKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <SleepService.h>
#include <SystemStatus.h>
#include <CoreDump.h>
#include <HealthCheckService.h>
#include <WiFiScanner.h>
#include <WiFiSettingsService.h>
#include <WiFiStatus.h>
Expand Down Expand Up @@ -181,6 +182,11 @@ class ESP32SvelteKit
return &_restartService;
}

HealthCheckService *getHealthCheckService()
{
return &_healthCheckService;
}

void factoryReset()
{
_factoryResetService.factoryReset();
Expand Down Expand Up @@ -245,6 +251,7 @@ class ESP32SvelteKit
#endif
RestartService _restartService;
FactoryResetService _factoryResetService;
HealthCheckService _healthCheckService;
SystemStatus _systemStatus;

String _appName = APP_NAME;
Expand Down
101 changes: 101 additions & 0 deletions lib/framework/HealthCheckService.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/**
* HealthCheckService - Extensible Health Check Endpoint
*
* Provides a /rest/health endpoint with callback-based extensibility
* for the ESP32 SvelteKit framework.
*
* Copyright (C) 2025 hmbacher
*
* All Rights Reserved. This software may be modified and distributed under
* the terms of the LGPL v3 license. See the LICENSE file for details.
**/

#include <HealthCheckService.h>
#include <SecurityManager.h>

// Initialize static member
health_check_handler_id_t HealthCheckHandlerInfo::currentHandlerId = 0;

HealthCheckService::HealthCheckService(PsychicHttpServer *server, SecurityManager *securityManager) : _server(server), _securityManager(securityManager)
{
}

void HealthCheckService::begin()
{
_server->on(HEALTH_CHECK_SERVICE_PATH,
HTTP_GET,
_securityManager->wrapRequest(std::bind(&HealthCheckService::healthCheck, this, std::placeholders::_1),
AuthenticationPredicates::NONE_REQUIRED));

ESP_LOGV(SVK_TAG, "Registered GET endpoint: %s", HEALTH_CHECK_SERVICE_PATH);
}

esp_err_t HealthCheckService::healthCheck(PsychicRequest *request)
{
PsychicJsonResponse response = PsychicJsonResponse(request, false);
JsonObject root = response.getRoot();

// Always add the base "up" status
root["up"] = true;

// Call all registered health check handlers to contribute to the JSON
callHealthCheckHandlers(root);

return response.send();
}

health_check_handler_id_t HealthCheckService::addHealthCheckCallback(HealthCheckCallback cb, bool allowRemove)
{
if (!cb)
{
ESP_LOGW(SVK_TAG, "Cannot add health check callback 'null'");
return 0;
}

HealthCheckHandlerInfo_t handler(cb, allowRemove);
_healthCheckHandlers.push_back(handler);
return handler._id;
}

void HealthCheckService::removeHealthCheckCallback(health_check_handler_id_t id)
{
if (id == 0)
{
ESP_LOGW(SVK_TAG, "Invalid health check handler ID '0' for removal");
return;
}

for (auto i = _healthCheckHandlers.begin(); i != _healthCheckHandlers.end();)
{
if ((*i)._allowRemove && (*i)._id == id)
{
i = _healthCheckHandlers.erase(i);
}
else
{
++i;
}
}
}

void HealthCheckService::callHealthCheckHandlers(JsonObject &json)
{
for (const auto &handler : _healthCheckHandlers)
{
if (handler._cb)
{
try
{
handler._cb(json);
}
catch (const std::exception &e)
{
ESP_LOGW(SVK_TAG, "Health check callback failed: %s", e.what());
}
catch (...)
{
ESP_LOGW(SVK_TAG, "Health check callback failed with unknown exception");
}
}
}
}
94 changes: 94 additions & 0 deletions lib/framework/HealthCheckService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#ifndef HealthCheckService_h
#define HealthCheckService_h

/**
* HealthCheckService - Extensible Health Check Endpoint
*
* Provides a /rest/health endpoint with callback-based extensibility
* for the ESP32 SvelteKit framework.
*
* Copyright (C) 2025 hmbacher
*
* All Rights Reserved. This software may be modified and distributed under
* the terms of the LGPL v3 license. See the LICENSE file for details.
**/

#include <PsychicHttp.h>
#include <SecurityManager.h>
#include <ArduinoJson.h>
#include <functional>
#include <list>
#include <exception>

#define HEALTH_CHECK_SERVICE_PATH "/rest/health"

/**
* HealthCheckService provides an extensible health check endpoint at /rest/health
*
* Basic usage returns: {"up": true}
*
* Extended usage example:
*
* // Register a health check callback that adds WiFi status
* esp32SvelteKit.getHealthCheckService()->addHealthCheckCallback([](JsonObject &json) {
* json["wifi"]["connected"] = WiFi.isConnected();
* json["wifi"]["rssi"] = WiFi.RSSI();
* });
*
* // Register a callback that adds memory info
* esp32SvelteKit.getHealthCheckService()->addHealthCheckCallback([](JsonObject &json) {
* json["memory"]["free"] = ESP.getFreeHeap();
* json["memory"]["total"] = ESP.getHeapSize();
* });
*
* This would result in a response like:
* {
* "up": true,
* "wifi": {"connected": true, "rssi": -45},
* "memory": {"free": 123456, "total": 327680}
* }
*/

typedef size_t health_check_handler_id_t;
typedef std::function<void(JsonObject &json)> HealthCheckCallback;

typedef struct HealthCheckHandlerInfo
{
static health_check_handler_id_t currentHandlerId;
health_check_handler_id_t _id;
HealthCheckCallback _cb;
bool _allowRemove;
HealthCheckHandlerInfo(HealthCheckCallback cb, bool allowRemove) : _id(++currentHandlerId), _cb(cb), _allowRemove(allowRemove) {};
} HealthCheckHandlerInfo_t;

class HealthCheckService
{
public:
HealthCheckService(PsychicHttpServer *server, SecurityManager *securityManager);

void begin();

/**
* @brief Add a health check callback that contributes to the JSON response
* @param cb Callback function that receives a JsonObject reference to populate
* @param allowRemove Whether this callback can be removed later (default: true)
* @return Handler ID (>0) that can be used to remove the callback. Returns 0 if the callback is null.
*/
health_check_handler_id_t addHealthCheckCallback(HealthCheckCallback cb, bool allowRemove = true);

/**
* @brief Remove a health check callback by its handler ID
* @param id The handler ID returned by addHealthCheckCallback()
*/
void removeHealthCheckCallback(health_check_handler_id_t id);

private:
PsychicHttpServer *_server;
SecurityManager *_securityManager;
std::list<HealthCheckHandlerInfo_t> _healthCheckHandlers;

esp_err_t healthCheck(PsychicRequest *request);
void callHealthCheckHandlers(JsonObject &json);
};

#endif // end HealthCheckService_h