A simple and extensible framework for ESP32 based IoT projects with a feature-rich, beautiful, and responsive front-end build with Sveltekit, Tailwind CSS and DaisyUI. This is a project template to get you started in no time with a fully integrated build chain.
OTHER License
Bot releases are visible (Hide)
Changes the Event Socket System to use a clearer message structure and MessagePack. Brings breaking changes to the EventSocket.h
API.
Updated daisyUI to v4. This has changes in the colors and switches to OKLCH. Also button groups and input groups have been depreciated in favor of join. This might require changes to custom parts of the code. Please double check all websites if the still have the desired looks.
Updates ArduinoJSON from v6 to v7 to increase the available free heap. If you make use of ArduinoJSON, changes might be required.
void emitEvent(String event, JsonObject &jsonObject, const char *originId = "", bool onlyToSameOrigin = false);
.Many thanks to @runeharlyk who contributed significantly to the new event socket system and fixed many smaller issues with the front-end.
Published by theelims 6 months ago
This upgrade might require one minor change as MqttPubSub.h
and its class had been renamed to MqttEndpoint.h
and MqttEndoint
respectively. However, it is strongly advised, that you change all existing WebSocketServer endpoints to the new event socket system.
[!NOTE]
The new Event Socket system is likely to change with coming updates.
-D SERIAL_INFO
to platformio.ini to enable / disable all Serial.print()
statements. On some boards with native USB those Serial prints have been reported to block and make the server unresponsive.MqttPubSub.h
and class to MqttEndpoint.h
and class.layout.ts
to keep customization in one place #31
platform = espressif32 @ 6.6.0
in platformio.ini-D SERVE_CONFIG_FILES
Loading /rest/features using 'window.fetch'. For best results, use the 'fetch' that is passed to your 'load' function:
-D FT_SECURITY=0
. If enabled the ESP32-C3 becomes extremely sluggish with frequent connection drops.Published by theelims 9 months ago
[!CAUTION]
This update has breaking changes!
This is a major change getting rid of all ESPAsyncTCP and ESPAsyncWebserver dependencies. Despite their popularity they are plagued with countless bugs, since years unmaintained, not SSL capable and simply not suitable for a production build. Although several attempts exist to fix the most pressing bugs even these libraries lead to frequent crashes. This new version replaces them with ESP-IDF based components. PsychicHttp and PsychicMqttClient both wrap the ESP-IDF components in a familiar wrapper for easy porting of the code base. However, this will break existing code and will require some effort on your codebase. In return the stability is improved greatly and the RAM usage more friendly. Now e.g. running Bluetooth in parallel becomes possible.
PROGMEM_WWW
flag to EMBED_WWW
as there is technically speaking no PROGMEM on ESP32's.main.cpp
Change the server and ESPSvelteKit instances to PsychicHttpServer and give the ESP32SvelteKit constructor the number of http endpoints of your project.
PsychicHttpServer server;
ESP32SvelteKit esp32sveltekit(&server, 120);
Remove server.begin();
in void setup()
. This is handled by ESP32SvelteKit now.
platformio.ini
Remove the following build_flags
:
; Increase queue size of SSE and WS
-D SSE_MAX_QUEUED_MESSAGES=64
-D WS_MAX_QUEUED_MESSAGES=64
-D CONFIG_ASYNC_TCP_RUNNING_CORE=0
-D NO_GLOBAL_ARDUINOOTA
-D PROGMEM_WWW
Add the following build_flags
and adjust to your app, if needed:
-D BUILD_TARGET=\"$PIOENV\"
-D APP_NAME=\"ESP32-Sveltekit\" ; Must only contain characters from [a-zA-Z0-9-_] as this is converted into a filename
-D APP_VERSION=\"0.3.0\" ; semver compatible version string
-D EMBED_WWW
Remove the lib dependency esphome/AsyncTCP-esphome @ ^2.0.0
and add https://github.com/theelims/PsychicMqttClient.git
Consider adjusting board_ssl_cert_source = adafruit
, so that the new MQTT client has universal SSL/TLS support with a wide range of CA root certificates.
factory_settings.ini
The new MQTT client has slightly renamed factory settings:
; MQTT settings
-D FACTORY_MQTT_ENABLED=false
-D FACTORY_MQTT_URI=\"mqtts://mqtt.eclipseprojects.io:8883\"
-D FACTORY_MQTT_USERNAME=\"\" ; supports placeholders
-D FACTORY_MQTT_PASSWORD=\"\"
-D FACTORY_MQTT_CLIENT_ID=\"#{platform}-#{unique_id}\" ; supports placeholders
-D FACTORY_MQTT_KEEP_ALIVE=120
-D FACTORY_MQTT_CLEAN_SESSION=true
Max Topic Length is no longer needed.
Adapt the class constructor ((PsychicHttpServer *server, ...
) to PsychicHttpServer.
Due to the loading sequence HttpEndoint and WebsocketServer both have gotten a begin()
function to register their http endpoints with the server. This must be called in your stateful services' own begin()
function:
void LightStateService::begin()
{
_httpEndpoint.begin();
_webSocketServer.begin();
_state.ledOn = DEFAULT_LED_STATE;
onConfigUpdated();
}
Published by theelims about 1 year ago
FT_SLEEP=0
Published by theelims about 1 year ago
Published by theelims about 1 year ago
FT_PROJECT
feature flag removed.Published by theelims over 1 year ago
This is the initial release of ESP32-sveltekit. With this it is feature complete to rjwats/esp8266-react, where it forked from.
The back end code has seen some minor changes compated to the original code of rjwats:
Full Changelog: https://github.com/theelims/ESP32-sveltekit/commits/v0.1.0