Releases: theelims/ESP32-sveltekit
v0.6.0 SvelteKit 2, Svelte 5, ESP-IDF 5 Migration
What's Changed
Caution
This update has breaking changes!
Added
- Added
GEMINI.mdto store notes about the repository for the Gemini CLI. We are now using the Gemini CLI for development. - Added a build script to create a merged firmware file to use with ESP Web Tools
- Added compatibility with ESP32-C6
- Added getIP() function to WiFiSettingsService.
- Added Arduino Log Colors
- Possibility to add a loop callback to ESP32-Sveltekit to leverage its loop threat. Meant to include custom services so no separate task is needed for them.
- Change wake-up pin in SleepService during runtime. It is also possible to use the internal pull-up or pull-down resistors now.
- Get current connection status from ESP32-SvelteKit. Useful for status LED or displays.
- Battery history graph to gauge battery consumption and device life.
- Add a status topic (
onlineoroffline) to the MQTT client. It retains its message and sendsofflineas last will and testament, signalling all subscribers when it goes missing. - FeatureService sends updates through the event system.
- WiFiSettingsService can set the WiFi station mode to offline, without deleting the list of networks.
- Expands menu on selected subitem #77
- Refactor System Status and Metrics, added PSRAM #79
- Add /rest/coreDump endpoint #87 & #94
- Rate limiting for MQTT publish messages. Can be configured as factory setting or at runtime.
0will disable the rate limiting. - Added discord invite to readme.md and docs.
- Created DraggableList component based on svelte-dnd-action (used in WiFi Settings) #100
- Extended Collapsible and SettingsCard components to support a dirty status #100
- Enhanced ConfirmDialog, InfoDialog and Toast components to support HTML content #100
- Added connection check to WebSocket store (socket.ts) and allow secure WebSocket connections #100
- Added a delayed reconnect function to WifiSettingsService.cpp to allow the last POST request from frontend (providing new network settings) to be properly responded to. In the previous implementation, the POST request was never responded to by the backend, as the connection was closed immediately upon receiving the request in the backend. This resulted in the user receiving no feedback about whether the settings update was successful, only a timeout that suggested something had gone wrong. #100
- Added scripts/prebuild_utils.py that allows other build scripts to be executed depending on the type of the executed task (e.g. I don't want to have the interface built or the certificate bundle created on clean tasks) #100
- Added build flag
-D TELEPLOT_TASKSto plot task heap high water mark with teleplot. You can include this in your tasks as well:
#ifdef TELEPLOT_TASKS
static int lastTime = 0;
if (millis() - lastTime > 1000)
{
lastTime = millis();
Serial.printf(">ESP32SveltekitTask:%i:%i\n", millis(), uxTaskGetStackHighWaterMark(NULL));
}
#endifChanged
- Lightstate example uses simpler, less explicit constructor
- MQTT library updated
- Analytics task was refactored into a loop() function which is called by the ESP32-sveltekit main task.
- Updated PsychicHttp to v1.2.1 incl. patches.
- Updated to DaisyUI 5 and Tailwind CSS 4
- Updated Svelte 5 --> see Svelte 5 Migration Guide
- Changed platform to PIO Arduino using Arduino 3 Core. Also upgrades ESP-IDF to v5.
- ESPD_LOGx: replace first argument with TAG and define TAG as 🐼 #85
- Replace rtc_get_reset_reason(0) with esp_reset_reason() #86
- Default build_interface.py script to npm, if no lock file is found.
- Replaced
svelte-dnd-listwithsvelte-dnd-actionassvelte-dnd-listcreates build warnings and appears to no longer be maintained, while svelte-dnd-action is under active community development. #100 - Made Spinner component more flexible (to allow other texts than "Loading..." or no text at all) #100
- Reworked WiFi Settings (Station) dialog: added edit dialog for networks, rearranged UI components, used new DraggableList component #100
Fixed
- Ensure thread safety for client subscriptions #58
- Deferred websocket event connection to after user validation & login #72
- Wrong return type battery service
- Wrong return types in various getService functions.
- Add file.close in fileHandler handleRequest #73
- Fixed bug in WiFiSettingsService preventing discovery of networks other than the first
- Fixed mixup pull up and pull down when configuring wake up pin in SleepService.cpp
- Wifi: Multiple edits bug resolved #79
- Fixed broken link to Adafruit SSL Cert Store #93
- Fixed JSON creation in WiFiSettingsService.h #91
- Fixed preprocessor warning: usage of #ifdef with OR operator #100
- Fixed preprocessor warning: redefinition of ESP_PLATFORM #100
- Fixed deprecated usage of merge-bin and its parameters in scripts/merge_bin.py #100
- Fixed Download OTA. Issues with certificate validation might remain, but build flag
-D DOWNLOAD_OTA_SKIP_CERT_VERIFYallows to circumvent issue by sacrificing certificate validation.
Removed
- Removed async workers in PsychicHttp, as these were not used, but caused linker errors.
Depreciate
- Support for ESP Arduino 2 and ESP-IDF v4 will depreciate some time in the future. Try to migrate to the current Arduino 3 / ESP-IDF v5 based branch.
Migration Guide
PIO Arduino & ESP-IDF 5
The firmware is based on the community maintained fork PIO Arduino of Arduino 3 for ESP32. Which is based on ESP-IDF 5. Please make sure all your dependencies and application code is compatible with ESP-IDF 5.
Frontend
SvelteKit was updated to v2 and Svelte to v5. Please check the migration guides for SvelteKit 2 and the Svelte 5 Migration Guide for the changes required on your frontend code.
To migrate your frontend run
npm install --force
npx sv migrate svelte-5
Also DaisyUI and Tailwind CSS have been updated to their last major versions. Run the official Tailwind upgrade tool:
npx @tailwindcss/upgrade
This will migrate some of your svelte files to the new naming convention of Tailwind. For DaisyUI follow this guide. Likely you'll need to redo all forms, as the components behave differently. Forms will need the fieldset class. Inputs will need an additional w-full to have the same behavior as before. And labels have a different syntax, too.
The themes are to be found in app.css now. Add them back if they had been changed from the default.
Acknowledgment
Many thanks to @runeharlyk, @ewowi, @hmbacher, and @stamp who contributed significantly to this new release.
New Contributors
- @ewowi made their first contribution in #73
- @stamp made their first contribution in #86
- @hmbacher made their first contribution in #91
Full Changelog: v0.5.0...v0.6.0
v0.5.0 MessagePack Event Socket
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.
Added
- Debug buildflag to switch between MessagePack and JSON for event messages.
- Show SSID of the current WiFi Station as tooltip of the RSSI icon.
Changed
- Moved MQTT types to models.ts as well. #49
- Updated daisyUI to 4.10.2 #48
- Fixed spelling error in models.ts
- Changed ArduinoJson from v6 to v7 increasing the free heap by ~40kb
- Split NotificationService out of EventSocket into own class
- Changed API of EventSocket.h. Now uses
void emitEvent(String event, JsonObject &jsonObject, const char *originId = "", bool onlyToSameOrigin = false);. - Changed event socket message format to MessagePack
Fixed
- Fixes to WiFi.svelte and models.ts to fix type errors and visibility rights.
- Fixes bug in highlighting the menu when navigating with the browser (back/forward)
- Made WiFi connection routine more robust by using BSSID. Ensures that the STA truly connects to the strongest hotspot, even if several hotspots are in reach.
Removed
Acknowledgment
Many thanks to @runeharlyk who contributed significantly to the new event socket system and fixed many smaller issues with the front-end.
v0.4.0 EventSocket System
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.
Added
- Added build flag
-D SERIAL_INFOto platformio.ini to enable / disable allSerial.print()statements. On some boards with native USB those Serial prints have been reported to block and make the server unresponsive. - Added a hook handler to StatefulService. Unlike an UPDATE a hook is called every time a state receives an updated, even if the result is UNCHANGED or ERROR.
- Added missing include for S2 in SystemStatus.cpp #23
- Added awareness of front end build script for all 3 major JS package managers. The script will auto-identify the package manager by the lock-file. #40
- Added a new event socket to bundle the websocket server and the notifications events. This saves on open sockets and allows for concurrent visitors of the internal website. The normal websocket server endpoint remains as an option, should a pure websocket connection be desired. An EventEndpoint was added to use this with Stateful Services. #29 and #43
- TS Types definition in one central place for the frontend.
Changed
- more generic board definition in platformio.ini #20
- Renamed
MqttPubSub.hand class toMqttEndpoint.hand class. - refactored MqttEndpoint.h into a single class to improve readability
- Moves appName and copyright to
layout.tsto keep customization in one place #31 - Make event source use timeout for reconnect #34
- Make each toasts disappear after timeout #35
- Fixed version
platform = espressif32 @ 6.6.0in platformio.ini - Analytics data limited to 1000 data points (roughly 33 minutes).
- postcss.config.cjs as ESM module #24
Fixed
- Fixed compile error with FLAG
-D SERVE_CONFIG_FILES - Fixed typo in telemetry.ts #38
- Fixed the development warning:
Loading /rest/features using 'window.fetch'. For best results, use the 'fetch' that is passed to your 'load' function:
Removed
- Duplicate method in FeatureService #18
- Duplicate lines in Systems Settings view.
- Removes duplicate begin #36
- Temporary disabled OTA progress update due to crash with PsychicHttp #32 until a fix is found.
Known Issues
- On ESP32-C3 the security features should be disabled in features.ini:
-D FT_SECURITY=0. If enabled the ESP32-C3 becomes extremely sluggish with frequent connection drops.
v0.3.0 Exchange ESPAsyncWebserver with PsychicHttp
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.
Added
- Added postscript to platform.io build process to copy, rename and calculate MD5 checksum of *.bin file. These files are ready for uploading to the Github Release page.
- Added more information to SystemStatus API
- Added generateToken API for security settings
- Added Multi-WiFi capability. Add up to five WiFi configurations and connect to either strongest network (default), or by priority.
- Added InfoDialog as a simpler version of the ConfirmDialog for a simple notification modal.
- Added Adafruit certificate repository as the default choice for the X509 certificate bundle.
Changed
- Better route protection for user page with deep link.
- Changed build_interface.py script to check for modified files in the interface sources before re-building the interface. Saves some time on the compilation process.
- Upload firmware binary allows uploading of MD5 checksum file in advance to verify downloaded firmware package.
- GithubFirmwareManager checks against PIO build_target in filename to support Github OTA for binaries build for various targets. You should rename your old release *.bin files on the Github release pages for backward compatibility.
- Changed MQTT Client to an ESP-IDF backed one which supports SSL/TLS X509 root CA bundles and transport over WS.
- Changed the
PROGMEM_WWWflag toEMBED_WWWas there is technically speaking no PROGMEM on ESP32's. - Updated dependencies to the latest version. Except SvelteKit.
Fixed
- Fixed reactivity of System Status page.
Removed
- Removed support for Arduino ESP OTA.
- HttpEndpoints and Websocket Server without a securityManager are no longer possible.
Migrate from ESPAsyncWebServer to PsychicHttp
Migrate 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.
Migrate 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_WWWAdd 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_WWWRemove 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.
Migrate 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=trueMax Topic Length is no longer needed.
Custom Stateful Services
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();
}v0.2.2 QOS Updates
Added
- Status reports reset-reason & uptime.
- AnalyticsService to draw graphs about heap usage and other time dependent values
- Added ping to WebSocket Server
- Use telemetry store with RSSI messages to gauge health of connection. Automatic reconnect for SSE and WS.
- Added user supplied features to FeatureService
- Compiler flag to let it serve the config JSONs for debug purposes
- Hard fork of ESPAsyncWebserver as it is unmaintained to fix bugs and add features
Changed
- Changed JSON format for websocket server and removed "payload" property. JSON is the same as for MQTT or HTTP now.
- Changed features.ini to default
FT_SLEEP=0 - Updated dependencies to latest version.
v0.2.1 Fixes boot loop issue with Arduino 6.4.0
Fixed
- Fixed the boot loop issue for Arduino 6.4.0
v0.2.0 Github Releases OTA
Added
- Introduced CHANGELOG.md
- Added core temperature to the system status API
- Added mDNS / Bonjour / zeroConf for better discoverability in local network
- Added recovery mode which forces AP to spin up regardless from its settings
- Added push notification service to show notification toasts on all clients
- Added SSE to update RSSI in status bar on client
- Added firmware version to System Status API
- Added sleep service to send ESP32 into deep sleep. Wake-up with button using EXT1
- Added battery service to show battery state of charge in the status bar. Uses SSE.
- Added download firmware manager to pull firmware binaries e.g. from github release pages
- modified generate_cert_bundle.py from Espressif included into the build process to automatically create SSL Root CA Bundle
Changed
- Improved system status with more meaningful presentation of available data
- Improved layout on small screens
- Increased queue size for SSE and WS to 64 instead of 32
- ESP32-SvelteKit loop()-function is its own task now
- ArduinoOTA handle runs in own task now
- AsyncTCP tasks run on Core 0 to move all networking related stuff to Core 0 and free up Core 1 for business logic
- Compiler flag on which core ESP32-sveltekit tasks should run
- Renamed WebSocketRxTx.h to WebSocketServer.h to create a distinction between WS Client and WS Server interfaces
- Made code of LightStateExample slightly more verbose
- getServer() returning a pointer to the AsnycWebServer instance.
- Updated frontend dependencies and packages to newest version.
Depreciated
- ArduinoOTA feature is set to depreciate. It is unstable with mDNS causing some reset loops until it finally settles.
Removed
FT_PROJECTfeature flag removed.
v0.1.0 Inital Release
This is the initial release of ESP32-sveltekit. With this it is feature complete to rjwats/esp8266-react, where it forked from.
What's Changed
The back end code has seen some minor changes compated to the original code of rjwats:
- Added copyright notes
- Renaming into ESP32-sveltekit
- Small changes to reflect the slightly different file structure of sveltekit
- Dropping support for the ESP8266
Full Changelog: https://github.com/theelims/ESP32-sveltekit/commits/v0.1.0