GithubHelp home page GithubHelp logo

theelims / esp32-sveltekit Goto Github PK

View Code? Open in Web Editor NEW
85.0 5.0 15.0 2.87 MB

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.

Home Page: https://theelims.github.io/ESP32-sveltekit/

License: Other

JavaScript 0.08% CSS 0.01% HTML 0.02% Svelte 7.41% TypeScript 1.78% C++ 17.20% C 72.69% Python 0.81%
arduino esp esp32 esp32-arduino iot platformio svelte sveltekit wifimanager mqtt

esp32-sveltekit's Introduction

ESP32 SvelteKit - Create Amazing IoT Projects

A simple and extensible framework for ESP32 based IoT projects with a feature-rich, beautiful, and responsive front-end build with Sveltekit, TailwindCSS and DaisyUI. This is a project template to get you started in no time backed by a powerful back end service, an amazing front end served from the ESP32 and an easy to use build chain to get everything going.

It was forked from the fabulous rjwats/esp8266-react project, from where it inherited the mighty back end services.

Tip: This template repository is not meant to be used stand alone. If you're just looking for a WiFi manager there are plenty of options available. This is a starting point when you need a rich web UI.

Features

🦋 Beautiful UI powered by DaisyUI and TailwindCSS

Beautiful, responsive UI which works equally well on desktop and on mobile. Gently animated for a snappy and modern feeling without ever being obtrusive or in the way. Easy theming with DaisyUI and media-queries to respect the users wish for a light or dark theme.

🦖 Low Memory Footprint and Easy Customization by Courtesy of SvelteKit

SvelteKit is ideally suited to be served from constrained devices like an ESP32. It's unique approach leads to very slim files. No bloatware like other popular JS frameworks. Not only the low memory footprint make it ideal but the developer experience is also outstanding letting you customize the front end with ease. Adapt and add functionality as you need it. The back end has you covered as well.

☎️ Rich Communication Interfaces

Comes with a rich set of communication interfaces to cover most standard needs of an IoT application. Like MQTT client, HTTP RESTful API, a WebSocket based Event Socket and a classic Websocket Server. All communication channels are stateful and fully synchronized. Changes propagate and are communicated to all other participants. The states can be persisted on the file system as well. For accurate time keeping time can by synchronized over NTP.

🗄️ WiFi Provisioning and Management

Naturally ESP32 SvelteKit comes with rich features to manage all your WiFi needs. From pulling up an access point for provisioning or as fall back, to fully manage your WiFi networks. Scan for available networks and connect to them. Advanced configuration options like static IP are on board as well.

🗝️ Secured API and User Management

Manage different user of your app with two authorization levels. An administrator and a guest user. Authenticate their API calls with a JWT token. Manage the user's profile from the admin interface. Use at own risk, as it is neither secure without the ability to use TLS/SSL encryption on the ESP32 server, nor very convenient, as only an admin can change passwords.

✈️ OTA Upgrade Service

The framework can provide two different channels for Over-the-Air updates. Either by uploading a *.bin file from the web interface. Or by pulling a firmware image from an update server. This is implemented with the github release page as an example. It is even possible to have different build environments at the same time and the Github OTA process pulls the correct binary.

🏗️ Automated Build Chain

The automated build chain takes out the pain and tears of getting all the bits and pieces play nice together. The repository contains a PlatformIO project at its heart. A SvelteKit project for the frontend code and a mkdocs project for the documentation go alongside. The PlatformIO build tools not only build the SvelteKit frontend with Vite, but also ensure that the build results are gzipped and find their way into the flash memory of the ESP32. You have two choices to serve the frontend either from the flash partition, or embedded into the firmware binary. The latter is much more friendly if your frontend code should be distributed OTA as well, leaving all configuration files intact.

🍦 Compatible with all ESP32 Flavours

The code runs on many variants of the ESP32 chip family. From the plain old ESP32, the ESP32-S3 and ESP32-C3. Other ESP32 variants might work, but haven't been tested. Sorry, no support for the older ESP8266. Go with one of the ESP32's instead.

Visit the Project Site

https://theelims.github.io/ESP32-sveltekit/

Libraries Used

Licensing

ESP32 SvelteKit is distributed with two licenses for different sections of the code. The back end code inherits the GNU LESSER GENERAL PUBLIC LICENSE Version 3 and is therefore distributed with said license. The front end code is distributed under the MIT License. See the LICENSE for a full text of both licenses.

esp32-sveltekit's People

Contributors

eveggelen avatar jetpax avatar leokeba avatar runeharlyk avatar solardaniel avatar theelims avatar zylos146 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

esp32-sveltekit's Issues

Guide for custom Theme

Hi do you have examples, guides and references on how to create custom themes, colors for the dashboard?

web interface

Help, I can't figure out how to transfer the sensor value to the web interface. You can use a detailed example with an explanation.

ESP32 S2 missing include

Hello,

I have updated my project to the latest version.

I had to adjust one thing in SystemStatus.cpp.

There is a missing include after the condition:

#elif CONFIG_IDF_TARGET_ESP32S2 
#include "esp32/rom/rtc.h"

otherwise I get errors with root["cpu_reset_reason"] = verbosePrintResetReason(rtc_get_reset_reason(0));

What is the constraint on use with ESP8266?

ESP12-E/F have 4MB of memory like entry level ESP32. What are the other constraints against use with ESP8266?

I have 4 different models of hardware we produce and 1 will continue to use an ESP8266.

I’m happy to do some work to help add support for ESP8266 with sufficient memory. Just need a steer.

WebSerial Monitor. Not an Issue, only a contribution of a github newbie

Sorry, I'm only a retired hobbyist and not (yet) familiar with github and don't know how to fork and contribute with pull requests.
But maybe someone is interested in what I did and maybe it would be a nice extension to features.

WebSerial.zip

WebSerialClass inherits from Arduino Print and can be used like Serial.print() and all other print functions.
It opens a WebSocketClient and sends to clients instead to HwSerial.

On the UI side there's a <textarea> element that acts like a Serial Monitor in platformio, where all content received over the WebSocket is printed. Includes toggling Start/Stop button and Clear button.

How to use:
In main.cpp

WebSerialClass WebSerial = WebSerialClass(&server);

void setup()
{
    // start serial and filesystem
    Serial.begin(SERIAL_BAUD_RATE);

    // start ESP32-SvelteKit
    esp32sveltekit.begin();
    WebSerial.begin();
}

Anywhere else

WebSerial.println("7EA08BCEFF31....3EDBB88FC0D5333092E61348397E");

I hope someone likes it. For me it is very helpfull, cause all my serial ports are used.
Probably it needs some professional improvement.

Monitor GUI

Minimize number of parallel sockets

Right now the Lightstate Demo uses 2 sockets for SSE and WS and need a 3rd socket to update the HTTP pages. PsychicHttp limits the available sockets to 5 crippling the number of devices available for concurrent connections.

  1. Create a UnifiedWebSocketServerEndpoint to use only one socket per frontend connection
  2. Merge the NotificationEvents (SSE) into this UnifiedWebSocketServerEndpoint
  3. Use this additionally as an endpoint for the lightstate demo to show both usecases

TLS handshake crash on esp32-dev platform github OTA update

Hi, I've been trying to add OTA support to my project via github releases, but as soon as the TLS handshake starts I get a crash.

[500440][V][ssl_client.cpp:62] start_ssl_client(): Free internal heap before TLS 90848
[500441][V][ssl_client.cpp:68] start_ssl_client(): Starting socket
[500467][V][ssl_client.cpp:146] start_ssl_client(): Seeding the random number generator
[500469][V][ssl_client.cpp:155] start_ssl_client(): Setting up the SSL/TLS structure...
[500473][V][ssl_client.cpp:190] start_ssl_client(): Attaching root CA cert bundle
[500479][V][ssl_client.cpp:254] start_ssl_client(): Setting hostname for TLS session...
[500487][V][ssl_client.cpp:269] start_ssl_client(): Performing the SSL/TLS handshake...
[500744][D][esp_crt_bundle.c:108] esp_crt_verify_callback(): 48 certificates in bundle
[500747][E][esp_crt_bundle.c:74] esp_crt_check_signature(): PK verify failed with error FFFFBD70
[500750][E][esp_crt_bundle.c:147] esp_crt_verify_callback(): Failed to verify certificate
[500762][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():273]: (-12288) X509 - A fatal error occurred, eg the chain is too long or the vrfy callback failed
[500772][E][WiFiClientSecure.cpp:144] connect(): start_ssl_client: -12288
[500782][V][ssl_client.cpp:321] stop_ssl_socket(): Cleaning SSL connection.
[500786][D][HTTPClient.cpp:1163] connect(): failed connect to github.com:443
[500792][W][HTTPClient.cpp:1483] returnError(): error(-1): connection refused
[500799][E][HTTPUpdate.cpp:234] handleUpdate(): HTTP error: connection refused

[500806][D][HTTPClient.cpp:408] disconnect(): tcp is closed

[500812][V][ssl_client.cpp:321] stop_ssl_socket(): Cleaning SSL connection.
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400e29f8  PS      : 0x00060430  A0      : 0x800ec2d0  A1      : 0x3fff5650  
A2      : 0x00000060  A3      : 0x3fffff70  A4      : 0x3fff576c  A5      : 0x0007a453  
A6      : 0x00000000  A7      : 0x3ffc62c0  A8      : 0x800e29f8  A9      : 0x3fff5610  
A10     : 0x3fff565c  A11     : 0xfc8d3b73  A12     : 0xfc8d3b73  A13     : 0x3ffc62c0  
A14     : 0x00000000  A15     : 0x3fff565c  SAR     : 0x00000019  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000060  LBEG    : 0x4008a3e8  LEND    : 0x4008a3f2  LCOUNT  : 0x00000000  


Backtrace: 0x400e29f5:0x3fff5650 0x400ec2cd:0x3fff5690 0x400f2811:0x3fff56b0

  #0  0x400e29f5:0x3fff5650 in PsychicEventSource::send(char const*, char const*, unsigned int, unsigned int) at lib/PsychicHttp/src/PsychicEventSource.cpp:121
  #1  0x400ec2cd:0x3fff5690 in NotificationEvents::send(String, String, int) at lib/framework/NotificationEvents.cpp:64
  #2  0x400f2811:0x3fff56b0 in updateTask(void*) at lib/framework/DownloadFirmwareService.cpp:80 (discriminator 3)

The error FFFFBD70 seems to point to a memory issue like running out of heap space, but several facts make this a little suspicious. First, I have about 90kB of free heap available before the handshake, and the documentation suggest I need about 42kB in the worst-case scenario. Also, I once had an error clearly indicating I was running out of heap, and this is a different one. I also tried adding the flags suggested here to sdkconfig.defaults, but that did not have an effect.

I will keep investigating this issue myself, but if anybody has a clue about where to look I'll take it.

Thanks.

Building for lolin s2 mini fails

Building in release mode
Retrieving maximum program size .pio/build/lolin_s2_mini/firmware.elf
Checking size .pio/build/lolin_s2_mini/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  17.8% (used 58196 bytes from 327680 bytes)
Flash: [===Error: The program size (1422998 bytes) is greater than maximum allowed (1310720 bytes)
=======]  108.6% (used 1422998 bytes from *** [checkprogsize] Explicit exit, status 1
1310720 bytes)
========================================================================= [FAILED] Took 7.29 seconds =========================================================================

Environment    Status    Duration
-------------  --------  ------------
lolin_s2_mini  FAILED    00:00:07.291

Do I have to set anything else in the build process?
With https://github.com/rjwats/esp8266-react it works.

WIFI with spaces

When I use a space in the WIFI Name I get lots of errors missing terminating " character

So the example in the documentation does not work: -D FACTORY_WIFI_SSID=\"My Awesome WiFi Network\"

When I escape the spaces like -D FACTORY_WIFI_SSID=\"My\ Awesome\ WiFi\ Network\" it builds and uploads, but the device does not connect to my wifi. (might be becouse I did no factory reset)

Compiling .pio\build\esp32dev\src\LightMqttSettingsService.cpp.o
<command-line>: warning: missing terminating " character
Compiling .pio\build\esp32dev\src\LightStateService.cpp.o
<command-line>: warning: missing terminating " character
Compiling .pio\build\esp32dev\src\main.cpp.o
Building .pio\build\esp32dev\bootloader.bin
Generating partitions .pio\build\esp32dev\partitions.bin
<command-line>: warning: missing terminating " character
esptool.py v4.5.1
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Compiling .pio\build\esp32dev\libeef\WiFi\WiFi.cpp.o
Compiling .pio\build\esp32dev\libeef\WiFi\WiFiAP.cpp.o
<command-line>: warning: missing terminating " character
Compiling .pio\build\esp32dev\libeef\WiFi\WiFiClient.cpp.o
Compiling .pio\build\esp32dev\libeef\WiFi\WiFiGeneric.cpp.o
<command-line>: warning: missing terminating " character
Compiling .pio\build\esp32dev\libeef\WiFi\WiFiMulti.cpp.o
Compiling .pio\build\esp32dev\libeef\WiFi\WiFiSTA.cpp.o
<command-line>: warning: missing terminating " character
Compiling .pio\build\esp32dev\libeef\WiFi\WiFiScan.cpp.o
Compiling .pio\build\esp32dev\libeef\WiFi\WiFiServer.cpp.o
<command-line>: warning: missing terminating " character
<command-line>: warning: missing terminating " character
Compiling .pio\build\esp32dev\libeef\WiFi\WiFiUdp.cpp.o
<command-line>: warning: missing terminating " character
<command-line>: warning: missing terminating " character
<command-line>: warning: missing terminating " character
<command-line>: warning: missing terminating " character
Compiling .pio\build\esp32dev\liba5d\WiFiClientSecure\WiFiClientSecure.cpp.o
Compiling .pio\build\esp32dev\liba5d\WiFiClientSecure\esp_crt_bundle.c.o
Compiling .pio\build\esp32dev\liba5d\WiFiClientSecure\ssl_client.cpp.o
<command-line>: warning: missing terminating " character
<command-line>: warning: missing terminating " character
<command-line>: warning: missing terminating " character
Compiling .pio\build\esp32dev\libced\PsychicMqttClient\PsychicMqttClient.cpp.o
<command-line>: warning: missing terminating " character
<command-line>: error: missing terminating " character
lib/framework/WiFiSettingsService.h:182:24: note: in expansion of macro 'FACTORY_WIFI_SSID'     
             if (String(FACTORY_WIFI_SSID).length() > 0)
                        ^~~~~~~~~~~~~~~~~
<command-line>: error: missing terminating " character
lib/framework/WiFiSettingsService.h:185:29: note: in expansion of macro 'FACTORY_WIFI_SSID'     
                     .ssid = FACTORY_WIFI_SSID,
                             ^~~~~~~~~~~~~~~~~
Compiling .pio\build\esp32dev\libfdd\ESPmDNS\ESPmDNS.cpp.o
<command-line>: warning: missing terminating " character
Compiling .pio\build\esp32dev\libb9b\UrlEncode\UrlEncode.cpp.o
<command-line>: warning: missing terminating " character
In file included from lib/framework/ESP32SvelteKit.h:41,
                 from src/main.cpp:15:
lib/framework/WiFiSettingsService.h: In static member function 'static StateUpdateResult WiFiSettings::update(ArduinoJson::V6215PB2::JsonObject&, WiFiSettings&)':
lib/framework/WiFiSettingsService.h:184:64: error: expected primary-expression before '{' token 
                 settings.wifiSettings.push_back(wifi_settings_t{
                                                                ^
Compiling .pio\build\esp32dev\libf8d\FS\FS.cpp.o
Archiving .pio\build\esp32dev\libeef\libWiFi.a
Compiling .pio\build\esp32dev\libf8d\FS\vfs_api.cpp.o
<command-line>: warning: missing terminating " character
<command-line>: warning: missing terminating " character
Compiling .pio\build\esp32dev\lib8df\PsychicHttp\ChunkPrinter.cpp.o
*** [.pio\build\esp32dev\src\main.cpp.o] Error 1
<command-line>: warning: missing terminating " character
================================== [FAILED] Took 8.57 seconds ==================================

Environment    Status    Duration
-------------  --------  ------------
esp32dev       FAILED    00:00:08.570
============================ 1 failed, 0 succeeded in 00:00:08.570 ============================ 

Crash on MQTTClient error, after new lease

Hi, this is an awesome peace of code, thank you.
Good documentation!
I'm not a professional so it took me some time to learn how it works, but now it's great.

I detected some minor issues:

  • NTPSettingsService has still some #ifdef SERIAL_INFO missing
  • WebSocketClient does not compile cause of some ESP headers missing, just renamed it to ...h.bak and ...cpp.bak and it compiled.
  • In some Serial logs (printf) with IP adresses, .c_str() is missing

And a big issue:

  • The system crashes (reboot) each time a new lease is assigned
  • I suspect cause of MQTTClient crashes (reboot) on error

I have just the Serial monitor and can't debug.

This is not an issue, more a request:
When using NTP, there is no event to tell me that the time is valid.
I'm using the standard Arduino loop to do some stuff and there I check

tm timeinfo;
if (!getLocalTime(&timeinfo))
{
	Serial.println("Failed to obtain time");
}

It would be nice to have a callback to indicate NTP time is valid.

Thanks
Daniel

heap fragmentation

In some services Strings are used as members.
They are initialized with empty buffer.
As an example WifiSettingsService.h.

// Struct defining the wifi settings in WifiSettingsService.h
typedef struct
{
    String ssid;
    String password;
    bool staticIPConfig;
    IPAddress localIP;
    IPAddress gatewayIP;
    IPAddress subnetMask;
    IPAddress dnsIP1;
    IPAddress dnsIP2;
    bool available;
} wifi_settings_t;

When changing the settings from the GUI, a JSON document is dynamically allocated and the update() is called, where the Strings are set. The String class then allocates memory and copies the content to the memory from the heap, where it lives until it's changed again. But the JSON document (sometimes 2000 to 4000 bytes) is freed after the update.
A gap is left on the heap. It will be used later on, but the heap gets fragmented and the maximum allocatable heap shrinks.

The same happens when using persistancy, when initial data is loaded from FS..

My proposal is to use String.reserve() in the constructor for these members.
The size of the content is known in advance and can be well limited.
So the framework would leave the maximum heap possible to the user and not fragment the heap already at startup.

Getting Started: WebSocket Not Working

I had some trouble but got it to run, so I am just verifying if the solution is correct,
and it might help others too.

When this repo is run, I get message on the browser "Connection to device lost".
Toggling the light using REST is working.
Socket is not working.

I tried this solution and it solves the web socket issue:
https://stackoverflow.com/questions/69350342/svelte-sveltekit-and-socket-io-client-not-working-in-dev-works-in-preview

It says to add to svelte.config.js

const config = {
  kit: {
    vite: {
      resolve: {
        alias: {
          "xmlhttprequest-ssl": "./node_modules/engine.io-client/lib/xmlhttprequest.js",
        },
      },
    },
  },
};

Is this the recommended solution?

Thank you for the great lib.

rename spinner.svelte to Spinner.svelte

Used: release 0.2.1

In the release the file spinner.svelte is present ( src/lib/components). During build a Spinner.svelte is needed. On a Linux machine that is case sensitive for filenames this results in an error.

ESP32C3 - Serial appears to block the application

From discord:

the esp32c3 I'm working with seems to halt execution or something unless there is a serial monitor connected. If I plug it into my PC, it seems to connect to wifi as expected, but the web ui (using the sveltekit build) is not accessible... However the moment I start a serial monitor the UI loads up.

Commenting/removing all references to Serial appears to resolve this issue.

The following files (excluding main.cpp) had Serial lines that were commented:
image

Maybe unique to the ESP32C3, or the Seeed Studio XIAO ESP32C3 board specifically.

lost connection to webserver

To reproduce

  1. Clean build and upload SW.
  2. Connect to device ( 192.168.4.1)
  3. Login screen shows
  4. Do a refresh in browser.
  5. You will get an error message in the log window and the connection is lost forever.
    Sometimes I see the error something like" Too many messages in the queue"

ESP32-sveltekit:
https://github.com/theelims/ESP32-sveltekit/releases/tag/v0.2.1

Added to platformio.ini
[env:nodemcu-32s]
board = nodemcu-32s
board_build.partitions = min_spiffs.csv

Hardware:
https://www.aliexpress.com/item/1005001636295529.html

[features]
build_flags =
-D FT_SECURITY=1
-D FT_MQTT=1
-D FT_NTP=1
-D FT_OTA=0 ; Not recommended, will be deprectiated in an upcomming release
-D FT_UPLOAD_FIRMWARE=1
-D FT_DOWNLOAD_FIRMWARE=1 ; requires FT_NTP=1
-D FT_SLEEP=1
-D FT_BATTERY=0

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:184
load:0x40078000,len:12732
␛[33m=> 0x40078000: ?? ??:0␛[0m
ho 0 tail 12 room 4
load:0x40080400,len:2908
␛[33m=> 0x40080400: _init at ??:?␛[0m
entry 0x400805c4
␛[33m=> 0x400805c4: ?? ??:0␛[0m
[ 33][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
[ 90][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 0 - WIFI_READY
[ 189][V][WiFiGeneric.cpp:340] _arduino_event_cb(): STA Started
[ 190][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: [ - 191_ST][W
iG[neri92]E:34iF Gendrico_even042event Sloppck(
: esp_wifi_set_ps failed
[ 199][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 3 - STA_STOP
Running Firmware Version: 0.2.1
Starting software access point
[ 439][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 0 - WIFI_READY
[ 447][V][WiFiGeneric.cpp:392] _arduino_event_cb(): AP Started
[ 448][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 10 - AP_START
[ 455][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring SoftAP static IP: 192.168.4.1, MASK: 255.255.255.0, GW: 192.168.4.1
[ 462][V][WiFiGeneric.cpp:143] set_esp_interface_ip(): SoftAP: 192.168.4.1 | Gateway: 192.168.4.1 | DHCP Start: 0.0.0.0 | Netmask: 255.255.255.0
[ 474][V][WiFiGeneric.cpp:190] set_esp_interface_ip(): DHCP Server Range: 192.168.4.2 to 192.168.4.12
[ 1138][V][WiFiGeneric.cpp:395] _arduino_event_cb(): AP Stopped
[ 1138][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 11 - AP_STO 1139][V][WiFiGeneric.cpp:392] _arduino_event_cb(): AP Started
[ 1145][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 10 - AP_START
Starting captive portal on 192.168.4.1
[ 14808][V][WiFiGeneric.cpp:407] _arduino_event_cb(): AP Station Connected: MAC: 44:78:3e:f6:b0:21, AID: 1
[ 14808][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 12 - AP_STACONNECTED
[ 15063][V][WiFiGeneric.cpp:421] _arduino_event_cb(): AP Station IP Assigned:192.168.4.2
[ 15064][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 14 - AP_STAIPASSIGNED
[ 32654][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
New client connected to Event Source: 1 Clients connected
[ 38216][W][AsyncTCP.cpp:976] _poll(): pcb is NULL

Wifi state - ap mode or sta mode

Hello, I've been stuck on a topic for some time now, so I thought I might find some help here. I'm using this project, and I've connected a display to my ESP32-S2 where I want to display certain things, for example, weather data.

It should work as follows:

  1. When the device is turned on, the AP access data should be displayed on the display.
  2. Once the device is connected to a home network (i.e., STA Mode), the access data on the display should be cleared and something else should be displayed.

My problem now is that I'm using the two classes WiFiSettingsService and APsettingsService to solve this. However, I haven't managed to do this because the device first goes into STA mode when starting and then sometimes turns the AP mode on or off. When the device is in STA mode, the AP access data continues to be displayed. Somehow, I'm not getting anywhere. Do you have any idea how I should proceed?

postcss.config.cjs as ESM module

This isn't so much an issue, but something I wanted to share here.

Longer story short, I was having a hard time getting the postcss-remove-class plugin to work with the way postcss.config.cjs was defined.

This ESM approach worked better for me (renamed as postcss.config.js):

import tailwindcss from 'tailwindcss';
import autoprefixer from 'autoprefixer';
import postcssRemoveClasses from 'postcss-remove-classes';

export default {
  plugins: [
    tailwindcss(),
    autoprefixer(),
    postcssRemoveClasses.default('range'),
  ],
}

There may be a solution using the previous format of the file, but I wasn't finding the approach very intuitive 🤷

RMT failed to initilize

Hardware: Wemos Lolin ESP32S3 (N16R8) - more or less similar to esp32-s3-devkitc-1

Unmodified latest release (except for env) does not work with build in RGB LED.
LED_BUILTIN/RGB_BUILTIN 38 same as for the devkit.

E (31449) rmt: rmt_set_gpio(526): RMT GPIO ERROR
E (31450) rmt: rmt_config(686): set gpio for RMT driver failed
[ 31353][D][esp32-hal-rmt.c:615] rmtInit():  -- TX RMT - CH 1 - 1 RAM Blocks - pin 245
[ 31359][E][esp32-hal-rmt.c:631] rmtInit(): RMT failed to initilize.
[ 31365][E][esp32-hal-rgb-led.c:18] neopixelWrite(): RGB LED driver initialization failed!

FIrst build problem

Hi, I would like to use your project but unfortunately I can't even get to the first compilation.
I should have followed your instructions but during compilation it gives me this error.

  • Executing task in folder theelims-ESP32-sveltekit: C:\Users\bradi.platformio\penv\Scripts\platformio.exe run

Processing az-delivery-devkit-v4 (board: az-delivery-devkit-v4; framework: arduino; platform: espressif32)

Verbose mode can be enabled via -v, --verbose option
Skipping build interface step for target(s):
SSL Cert Store: Parsing certificates from ssl_certs\DigiCert_Global_Root_CA.pem
SSL Cert Store: Successfully added 1 certificates
SSL Cert Store: Successfully added 1 certificates in total
SSL Cert Store: Successfully created src\certs\x509_crt_bundle.bin
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/az-delivery-devkit-v4.html
PLATFORM: Espressif 32 (6.4.0) > AZ-Delivery ESP-32 Dev Kit C V4
HARDWARE: ESP32 240MHz, 520KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

  • framework-arduinoespressif32 @ 3.20011.230801 (2.0.11)
  • tool-esptoolpy @ 1.40501.0 (4.5.1)
  • toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ strict
    Found 39 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- ArduinoJson @ 6.21.3
    |-- AsyncTCP-esphome @ 2.0.1
    |-- AsyncMqttClient-esphome @ 0.8.6
    |-- framework
    Building in release mode
    Compiling .pio\build\az-delivery-devkit-v4\src\main.cpp.o
    Archiving .pio\build\az-delivery-devkit-v4\libb8c\libWiFi.a
    Archiving .pio\build\az-delivery-devkit-v4\lib51c\libESPmDNS.a
    Compiling .pio\build\az-delivery-devkit-v4\libb67\FS\FS.cpp.o
    Compiling .pio\build\az-delivery-devkit-v4\libb67\FS\vfs_api.cpp.o
    Compiling .pio\build\az-delivery-devkit-v4\lib264\ESPAsyncWebServer\AsyncEventSource.cpp.o
    Compiling .pio\build\az-delivery-devkit-v4\lib264\ESPAsyncWebServer\AsyncWebSocket.cpp.o
    Compiling .pio\build\az-delivery-devkit-v4\lib264\ESPAsyncWebServer\WebAuthentication.cpp.o
    Compiling .pio\build\az-delivery-devkit-v4\lib264\ESPAsyncWebServer\WebHandlers.cpp.o
    Compiling .pio\build\az-delivery-devkit-v4\lib264\ESPAsyncWebServer\WebRequest.cpp.o
    Compiling .pio\build\az-delivery-devkit-v4\lib264\ESPAsyncWebServer\WebResponses.cpp.o
    Compiling .pio\build\az-delivery-devkit-v4\lib264\ESPAsyncWebServer\WebServer.cpp.o
    Compiling .pio\build\az-delivery-devkit-v4\libde1\DNSServer\DNSServer.cpp.o
    In file included from src/main.cpp:15:
    lib/framework/ESP32SvelteKit.h:48:10: fatal error: WWWData.h: No such file or directory


#include <WWWData.h>
^~~~~~~~~~~
compilation terminated.
Compiling .pio\build\az-delivery-devkit-v4\lib72c\WiFiClientSecure\WiFiClientSecure.cpp.o
*** [.pio\build\az-delivery-devkit-v4\src\main.cpp.o] Error 1
================================================================================================================= [FAILED] Took 10.24 seconds =================================================================================================================

Environment Status Duration


az-delivery-devkit-v4 FAILED 00:00:10.236
============================================================================================================ 1 failed, 0 succeeded in 00:00:10.236 ============================================================================================================

  • The terminal process "C:\Users\bradi.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

If I remove the PROGMEM_WWW option it obviously continues, but I would like to try using the non-spiffs version.
I have a further compilation problem in lightstateservice.cpp on LED_BUILTIN because I use an azdelivery kit v.4 which does not have this definition; I will bypass it by adding an external LED.... but the problem relating to the WWWData.h , I honestly can't understand what's causing it... I seem to have done all the first setup steps correctly.

Thank you in advance for the support

Vite Proxy does not work: »Error: read ECONNRESET«

I try to use the vite proxy to work on the sveltekit code. The board is available at 192.168.1.190, but the vite proxy does not seem to work:

Vite proxy config:

proxy: {
	'/rest': {
		target: 'http://192.168.1.190',
		changeOrigin: true
	},
	'/ws': {
		target: 'ws://192.168.1.190',
		changeOrigin: true,
		ws: true
	}
}

The Vite Server shows this error:
image

The serial output shows, that there was a request:
image

The error message seems very general to me, so I do not really have an idea where to expect the issue. Anyone had a similar issue before or an idea what I could check?

I'm using the ESP32_Relay_X8 which is equipet with an ESP32-WROOM-32E.

Read state from FS for custom external rest call

Hello, I would like to save a Json Object in the FileSystem via Http.
I then want to read the values from the FS in my CustomStateService.

What is the best way to do this in the backend? I have already done the frontend part, the id is set and a rest endpoint should be called. But I would like to save this ID in the file system in the backend and then read it somewhere else. For an Http rest call to an external service. Which in turn gives me a Json response and I save it back into the file system.

I'm currently also using my own code to save the result of the external service call in the FS. Can I also use the FSPersisntence for this somehow?

Here is the code I use...

#ifndef CustomTimesService_h
#define CustomTimesService_h

#include <Arduino.h>
#include <ArduinoJson.h>
#include <LittleFS.h>
#include <FSPersistence.h>
#include <HttpEndpoint.h>
#include <WiFiClient.h>
#include <HTTPClient.h>
#include <DisplayService.h>

class CustomTimeState {
 public:
  String selectedCountry;
  String selectedCity;
  String selectedDistrict;

  static void read(CustomTimeState& settings, JsonObject& root) {
    root["selectedCountry"] = settings.selectedCountry;
    root["selectedCity"] = settings.selectedCity;
    root["selectedDistrict"] = settings.selectedDistrict;
  }

  static StateUpdateResult update(JsonObject& root, CustomTimeState& customTimeState) {
    customTimeState.selectedCountry = root["selectedCountry"];
    customTimeState.selectedCity = root["selectedCity"];
    customTimeState.selectedDistrict = root["selectedDistrict"];
    return StateUpdateResult::CHANGED;
  }
};

class CustomTimesService : public StatefulService<CustomTimeState>  {
 public:
  CustomTimesService(DisplayService* displayService, AsyncWebServer* server, FS* fs, SecurityManager* securityManager);

  void begin();

 private:
  DisplayService _displayService;
  HttpEndpoint<CustomTimeState> _httpEndpoint;
  FSPersistence<CustomTimeState> _fsPersistence;

  boolean readFromFS();
  void makeHttpCall();
  void writeFile(const char* path, const char* content);
};

#endif
#include <CustomTimesService.h>


#define CUSTOM_TIMES_SETTINGS_PATH "/rest/customTimes"

CustomTimesService::CustomTimesService(DisplayService* displayService, AsyncWebServer* server, FS* fs, SecurityManager* securityManager)
: _displayService(),
 _httpEndpoint(CustomTimeState::read,
                  CustomTimeState::update,
                  this,
                  server,
                  CUSTOM_TIMES_SETTINGS_PATH,
                  securityManager,
                  AuthenticationPredicates::IS_AUTHENTICATED),
 _fsPersistence(CustomTimeState::read, CustomTimeState::update, this, fs, "/config/selectedCustomTime.json")
{}

unsigned long lastRequest = millis();

String endpointUrl = "http://localhost:1234/api/";
Adafruit_ST7789 tft(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

void CustomTimesService::begin() {
  auto successfull = readFromFS();

  if (!successfull) {
    makeHttpCall();
  }
}

boolean CustomTimesService::readFromFS() {
  Serial.println("Start reading custom times from FS");
  File file = LittleFS.open("/custom_times.json");
  if (!file) {
    Serial.println("Failed to open custom_times.json");
    return false;
  }

  size_t size = file.size();
  std::unique_ptr<char[]> buf(new char[size]);
  file.readBytes(buf.get(), size);
  file.close();

  DynamicJsonDocument doc(25000);  // Passen Sie die Größe je nach Bedarf an
  DeserializationError error = deserializeJson(doc, buf.get());

  if (error) {
    Serial.println("Failed to parse JSON");
    return false;
  }

  const char* data = doc[0]["Data"];
  _displayService.displayPrayerTime("Data", data, ST77XX_WHITE, 2, DISPLAY_HEIGHT-145);


  Serial.println("Sucesfull read custom times from FS");
  return true;
}

void CustomTimesService::makeHttpCall() {
  WiFiClient wifiClient;
  HTTPClient httpClient;

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  tft.fillScreen(ST77XX_BLACK);

  // Read Id here from FS and append to endpointUrl
 // url = endpointUrl + id;

  // Führe HTTP GET-Request aus
  httpClient.addHeader("content-type", "application/json");
  if (httpClient.begin(wifiClient, url)) {
    int httpResponseCode = httpClient.GET();

    if (httpResponseCode == HTTP_CODE_OK) {
      String payload = httpClient.getString();
      Serial.println("Times fetched");
      Serial.println("HTTP-Code: ");
      Serial.print(httpResponseCode);

      DynamicJsonDocument doc(25000);
      DeserializationError error = deserializeJson(doc, payload);
      Serial.print("Size of json: ");
      Serial.println(doc.size());

      if (error) {
        Serial.println("Failed to parse JSON");
      }

      writeFile("/custom_times.json", payload.c_str());
    } else {
      Serial.print("Failure during HTTP-GET. HTTP-Statuscode: ");
      Serial.println(httpResponseCode);
    }

    httpClient.end();
    lastRequest = millis();
  }
}

void CustomTimesService::writeFile(const char* path, const char* content) {
  // Datei zum Schreiben öffnen (wird erstellt, wenn sie nicht existiert)
  File file = LittleFS.open(path, "w");
  if (!file) {
    Serial.println("Fehler beim Öffnen der Datei zum Schreiben");
    return;
  }
  file.print(content);
  file.close();
}

Server stops responding

Thanks for building this great project!

Not sure if this is related to #8, so am opening a new issue.

I did a build with webui in LittleFS, and system works but is quite unstable and server stops responding after a while.

ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
ERROR: Too many SSE messages queued for [192.168.1.125]
[879753][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Paxnet, BSSID: b4:fb:e4:d7:d4:ee, Reason: 200
[879754][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[879761][W][WiFiGeneric.cpp:955] _eventCallback(): Reason: 200 - BEACON_TIMEOUT
[879768][D][WiFiGeneric.cpp:975] _eventCallback(): WiFi Reconnect Running
WiFi Disconnected. Reason code=200
WiFi connection dropped, stopping NTP.
[879787][V][WiFiGeneric.cpp:343] _arduino_event_cb(): STA Stopped
[879789][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 3 - STA_STOP
Starting software access point
[881615][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 0 - WIFI_READY
[881617][V][WiFiGeneric.cpp:392] _arduino_event_cb(): AP Started
[881617][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 10 - AP_START
[881618][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring SoftAP static IP: 192.168.4.1, MASK: 255.255.255.0, GW: 192.168.4.1
[881636][V][WiFiGeneric.cpp:143] set_esp_interface_ip(): SoftAP: 192.168.4.1 | Gateway: 192.168.4.1 | DHCP Start: 0.0.0.0 | Netmask: 255.255.255.0
[881649][V][WiFiGeneric.cpp:190] set_esp_interface_ip(): DHCP Server Range: 192.168.4.2 to 192.168.4.12
[882343][V][WiFiGeneric.cpp:395] _arduino_event_cb(): AP Stopped
[882343][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 11 - AP_STOP
[882344][V][WiFiGeneric.cpp:392] _arduino_event_cb(): AP Started
[882351][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 10 - AP_START
Starting captive portal on 192.168.4.1
Connecting to WiFi.
[900901][V][WiFiGeneric.cpp:340] _arduino_event_cb(): STA Started
[900901][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 2 - STA_START
[900901][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[900952][V][WiFiGeneric.cpp:355] _arduino_event_cb(): STA Connected: SSID: Paxnet, BSSID: f4:92:bf:a5:99:f1, Channel: 6, Auth: WPA2_PSK
[900953][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
WiFi Connected.
[902371][V][WiFiGeneric.cpp:369] _arduino_event_cb(): STA Got Same IP:192.168.1.153
[902371][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
[902374][D][WiFiGeneric.cpp:996] _eventCallback(): STA IP: 192.168.1.153, MASK: 255.255.255.0, GW: 192.168.1.1
WiFi Got IP. localIP=192.168.1.153, hostName=Svelte-RetroVMS
Got IP address, starting NTP Synchronization
Starting NTP...
[908358][E][vfs_api.cpp:105] open(): /littlefs/www/index.html does not exist, no permits for creation
[908389][E][vfs_api.cpp:105] open(): /littlefs/www/index.html does not exist, no permits for creation
[908419][E][vfs_api.cpp:105] open(): /littlefs/www/index.html does not exist, no permits for creation
[908488][E][vfs_api.cpp:105] open(): /littlefs/www/index.html does not exist, no permits for creation
[908518][E][vfs_api.cpp:105] open(): /littlefs/www/index.html does not exist, no permits for creation
[908548][E][vfs_api.cpp:105] open(): /littlefs/www/index.html does not exist, no permits for creation
[908644][E][vfs_api.cpp:105] open(): /littlefs/www/_app/immutable/entry/start.js does not exist, no permits for creation
[909278][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[909279][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[909279][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[909281][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[909286][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[909304][E][vfs_api.cpp:105] open(): /littlefs/www/favicon.png does not exist, no permits for creation
New client connected to Event Source: 1 Clients connected
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbec
load:0x403cc700,len:0x2920
entry 0x403c98d8
[   317][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 0 - WIFI_READY
[   352][V][WiFiGeneric.cpp:340] _arduino_event_cb(): STA Started
[   353][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 2 - STA_START
[   355][E][WiFiGeneric.cpp:940] _eventCallback(): esp_wifi_set_ps failed
E (452) wifi_init_default: esp_wifi_get_mac failed with 12289
[   367][V][WiFiGeneric.cpp:343] _arduino_event_cb(): STA Stopped
[   373][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 3 - STA_STOP
Running Firmware Version: 0.2.2
Connecting to WiFi.
[   542][D][esp32-hal-rmt.c:615] rmtInit():  -- TX RMT - CH 0 - 1 RAM Blocks - pin 48
[   555][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 0 - WIFI_READY
[   557][V][WiFiGeneric.cpp:340] _arduino_event_cb(): STA Started
[   557][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 2 - STA_START
[   557][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
Starting software access point
[   732][V][WiFiGeneric.cpp:392] _arduino_event_cb(): AP Started
[   732][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 10 - AP_START
[   733][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring SoftAP static IP: 192.168.4.1, MASK: 255.255.255.0, GW: 192.168.4.1
[   746][V][WiFiGeneric.cpp:143] set_esp_interface_ip(): SoftAP: 192.168.4.1 | Gateway: 192.168.4.1 | DHCP Start: 0.0.0.0 | Netmask: 255.255.255.0
[   758][V][WiFiGeneric.cpp:190] set_esp_interface_ip(): DHCP Server Range: 192.168.4.2 to 192.168.4.12
[  1454][V][WiFiGeneric.cpp:395] _arduino_event_cb(): AP Stopped
[  1455][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 11 - AP_STOP
[  1455][V][WiFiGeneric.cpp:392] _arduino_event_cb(): AP Started
[  1462][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 10 - AP_START
Starting captive portal on 192.168.4.1
[  2455][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Paxnet, BSSID: 68:ff:7b:06:87:15, Reason: 2
[  2455][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[  2462][W][WiFiGeneric.cpp:955] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[  2469][D][WiFiGeneric.cpp:975] _eventCallback(): WiFi Reconnect Running
WiFi Disconnected. Reason code=2
WiFi connection dropped, stopping NTP.
[  2487][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: Paxnet, BSSID: f4:92:bf:a5:99:f1, Reason: 202
[  2493][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[  2493][V][WiFiGeneric.cpp:343] _arduino_event_cb(): STA Stopped
[  2500][W][WiFiGeneric.cpp:955] _eventCallback(): Reason: 202 - AUTH_FAIL
WiFi Disconnected. Reason code=202
WiFi connection dropped, stopping NTP.
[  2523][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 3 - STA_STOP
Connecting to WiFi.
[ 30548][V][WiFiGeneric.cpp:340] _arduino_event_cb(): STA Started
[ 30548][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 2 - STA_START
[ 30549][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[ 30734][V][WiFiGeneric.cpp:355] _arduino_event_cb(): STA Connected: SSID: Paxnet, BSSID: f4:92:bf:a5:99:f1, Channel: 6, Auth: WPA2_PSK
[ 30735][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
WiFi Connected.
[ 31266][V][WiFiGeneric.cpp:369] _arduino_event_cb(): STA Got New IP:192.168.1.153
[ 31267][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
[ 31270][D][WiFiGeneric.cpp:996] _eventCallback(): STA IP: 192.168.1.153, MASK: 255.255.255.0, GW: 192.168.1.1
WiFi Got IP. localIP=192.168.1.153, hostName=Svelte-RetroVMS
Got IP address, starting NTP Synchronization
Starting NTP...
New client connected to Event Source: 1 Clients connected
[ 39401][E][vfs_api.cpp:105] open(): /littlefs/www/_app/version.json does not exist, no permits for creation
Stopping captive portal
Stopping software access point
[ 40758][V][WiFiGeneric.cpp:395] _arduino_event_cb(): AP Stopped
[ 40758][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 11 - AP_STOP
[ 40759][V][WiFiGeneric.cpp:392] _arduino_event_cb(): AP Started
[ 40769][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 10 - AP_START
[ 40770][V][WiFiGeneric.cpp:395] _arduino_event_cb(): AP Stopped
[ 40782][D][WiFiGeneric.cpp:931] _eventCallback(): Arduino Event: 11 - AP_STOP
[ 42864][W][AsyncTCP.cpp:999] _poll(): rx timeout 4
[ 42866][W][AsyncTCP.cpp:999] _poll(): rx timeout 4
[ 42867][W][AsyncTCP.cpp:999] _poll(): rx timeout 4
[ 42868][W][AsyncTCP.cpp:999] _poll(): rx timeout 4
[ 45573][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[ 45936][E][vfs_api.cpp:105] open(): /littlefs/www/favicon.png does not exist, no permits for creation
[ 45979][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[ 47043][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[ 47043][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[ 47513][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[ 47514][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[ 48053][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[ 48053][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[ 48605][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[ 48605][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
New client connected to Event Source: 1 Clients connected
[105819][E][vfs_api.cpp:105] open(): /littlefs/www/index.html does not exist, no permits for creation
[105848][E][vfs_api.cpp:105] open(): /littlefs/www/index.html does not exist, no permits for creation
[105879][E][vfs_api.cpp:105] open(): /littlefs/www/index.html does not exist, no permits for creation
[106689][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[106689][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[106689][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[106691][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[107279][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[107279][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[107677][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[107677][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[107678][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[107680][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[107684][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[108408][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[108408][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[108408][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[108410][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[108415][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[108872][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[108872][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[108872][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[108874][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[108879][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
New client connected to Event Source: 2 Clients connected
New client connected to Event Source: 3 Clients connected
[119216][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[119216][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
[119216][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
E (127354) tsens: Do not configure the temp sensor when it's running!
E (157350) tsens: Do not configure the temp sensor when it's running!
[324237][I][WebSocketServer.h:144] onWSEvent(): [WebSocket Server] ws[/ws/lightState][1] connect
[342419][I][WebSocketServer.h:253] onWSEvent(): [WebSocket Server] ws[/ws/lightState][1] disconnect: 1070549080
Starting NTP...
Connecting to MQTT...
[509382][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
Connected to MQTT, without persistent session
Disconnected from MQTT reason: 0
Connecting to MQTT...
Connected to MQTT, without persistent session
[530068][I][WebSocketServer.h:144] onWSEvent(): [WebSocket Server] ws[/ws/lightState][2] connect
[537240][I][WebSocketServer.h:253] onWSEvent(): [WebSocket Server] ws[/ws/lightState][2] disconnect: 1070549080
[551064][I][WebSocketServer.h:144] onWSEvent(): [WebSocket Server] ws[/ws/lightState][3] connect
[557424][I][WebSocketServer.h:253] onWSEvent(): [WebSocket Server] ws[/ws/lightState][3] disconnect: 97
E (4545344) tsens: Do not configure the temp sensor when it's running!
E (4585341) tsens: Do not configure the temp sensor when it's running!
E (4775339) tsens: Do not configure the temp sensor when it's running!
[4805411][W][AsyncTCP.cpp:976] _poll(): pcb is NULL
E (10791926) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (10791926) task_wdt:  - IDLE (CPU 0)
E (10791926) task_wdt: Tasks currently running:
E (10791926) task_wdt: CPU 0: Analytics Servi
E (10791926) task_wdt: CPU 1: IDLE
E (10791926) task_wdt: Aborting.

abort() was called at PC 0x4202f5d8 on core 0


Backtrace: 0x403778de:0x3fc962b0 0x4037cf39:0x3fc962d0 0x40383611:0x3fc962f0 0x4202f5d8:0x3fc96370 0x40378c55:0x3fc96390 0x4202a76f:0x3fca7280 0x4202a7df:0x3fca72b0 0x420254c6:0x3fca7300 0x4201676c:0x3fca7330 0x42016979:0x3fca7870

  #0  0x403778de:0x3fc962b0 in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402
  #1  0x4037cf39:0x3fc962d0 in esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:128
  #2  0x40383611:0x3fc962f0 in abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/abort.c:46
  #3  0x4202f5d8:0x3fc96370 in task_wdt_isr at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/task_wdt.c:176 (discriminator 3)
  #4  0x40378c55:0x3fc96390 in _xt_lowint1 at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/port/xtensa/xtensa_vectors.S:1111
  #5  0x4202a76f:0x3fca7280 in temp_sensor_read_raw at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/driver/esp32s3/rtc_tempsensor.c:122 (discriminator 2)
  #6  0x4202a7df:0x3fca72b0 in temp_sensor_read_celsius at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/driver/esp32s3/rtc_tempsensor.c:158
  #7  0x420254c6:0x3fca7300 in temperatureRead at /Users/jep/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-misc.c:73
  #8  0x4201676c:0x3fca7330 in AnalyticsService::_loop() at lib/framework/AnalyticsService.h:64 (discriminator 3)
  #9  0x42016979:0x3fca7870 in AnalyticsService::_loopImpl(void*) at lib/framework/AnalyticsService.h:48



MQTT - Check/Uncheck/Check kills MQTT

After updating to version 0.3.0, I conducted some tests and noticed an issue.
I will describe the conditions to reproduce it:

  1. Configured the WiFi network:
    WiFi icon in the status bar displayed correctly.

  2. Configured MQTT:
    URI: mqtt://192.168.1.12:1883
    Clean Session? (enable or disable)
    MQTT Status: Connected

  3. Disabled the check box "[ ]Enable MQTT" checkbox:
    Applied settings
    MQTT Status: MQTT Disable

  4. Enabled MQTT again:
    Checked the "[ X ] Enable MQTT" checkbox
    Applied settings
    MQTT Status: None
    WiFi icon in the status bar changed to WiFiOff
    MQTT stopped functioning
    On the WiFi Station screen, the status remained as "Status: Connected"
    WiFi continued to operate
    MQTT functionality was restored only after performing a RESTART on the System Status screen.

Steps 2, 3, 4 : These steps repeat after the restart.

I conducted this test under two conditions:
a) SDK Version > ESP-IDF v4.4.6-dirty / Arduino v2.0.14
b) SDK Version > ESP-IDF v4.4.4 / Arduino v2.0.9

ESP32-sveltekit is crashing with latest platform 6.4.0

Problem. Code builds with both 6.4.0 ( platform = [email protected] )and 6.3.2 ( platform = [email protected] ). But crashes during startup when platform 6.4.0 is used.

ESP32-sveltekit:*
https://github.com/theelims/ESP32-sveltekit/releases/tag/v0.2.0

Added to platformio.ini
[env:nodemcu-32s]
board = nodemcu-32s
board_build.partitions = min_spiffs.csv

Hardware:
https://www.aliexpress.com/item/1005001636295529.html

Log when using 6.4.0
esptool.py v4.5.1
Creating esp32 image...
Merged 25 ELF sections
Successfully created esp32 image.
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: /dev/ttyUSB0
Uploading .pio/build/nodemcu-32s/firmware.bin
esptool.py v4.5.1
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: b0:a7:32:28:a6:20
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00164fff...
Compressed 17536 bytes to 12203...
Writing at 0x00001000... (100 %)
Wrote 17536 bytes (12203 compressed) at 0x00001000 in 0.4 seconds (effective 358.0 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 1073.2 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 1635.5 kbit/s)...
Hash of data verified.
Compressed 1394048 bytes to 925247...
Writing at 0x00010000... (1 %)
Writing at 0x00014c6e... (3 %)
Writing at 0x00018c8f... (5 %)
Writing at 0x0001cd63... (7 %)
Writing at 0x00020d5d... (8 %)
Writing at 0x00024d60... (10 %)
Writing at 0x00028d58... (12 %)
Writing at 0x0002cd53... (14 %)
Writing at 0x00030d4e... (15 %)
Writing at 0x00035ea0... (17 %)
Writing at 0x00039e87... (19 %)
Writing at 0x00044150... (21 %)
Writing at 0x0004fd11... (22 %)
Writing at 0x0005b3fe... (24 %)
Writing at 0x0006686a... (26 %)
Writing at 0x00077ce5... (28 %)
Writing at 0x0007d291... (29 %)
Writing at 0x00082e24... (31 %)
Writing at 0x00089a76... (33 %)
Writing at 0x0008fe75... (35 %)
Writing at 0x00096990... (36 %)
Writing at 0x0009dd58... (38 %)
Writing at 0x000a3adf... (40 %)
Writing at 0x000a92f4... (42 %)
Writing at 0x000aed52... (43 %)
Writing at 0x000b407b... (45 %)
Writing at 0x000b93c1... (47 %)
Writing at 0x000be65c... (49 %)
Writing at 0x000c3d00... (50 %)
Writing at 0x000c9064... (52 %)
Writing at 0x000ce27e... (54 %)
Writing at 0x000d37ed... (56 %)
Writing at 0x000d88ea... (57 %)
Writing at 0x000ddd28... (59 %)
Writing at 0x000e2d29... (61 %)
Writing at 0x000e82aa... (63 %)
Writing at 0x000ede72... (64 %)
Writing at 0x000f3511... (66 %)
Writing at 0x000f8986... (68 %)
Writing at 0x000fdb4d... (70 %)
Writing at 0x00103002... (71 %)
Writing at 0x001081e6... (73 %)
Writing at 0x0010d90e... (75 %)
Writing at 0x0011302f... (77 %)
Writing at 0x00118c50... (78 %)
Writing at 0x0011e788... (80 %)
Writing at 0x001241c5... (82 %)
Writing at 0x00129d9f... (84 %)
Writing at 0x0012f5eb... (85 %)
Writing at 0x00134708... (87 %)
Writing at 0x0013a3fe... (89 %)
Writing at 0x00142b2e... (91 %)
Writing at 0x0014b998... (92 %)
Writing at 0x0015181f... (94 %)
Writing at 0x00156cb3... (96 %)
Writing at 0x0015c1eb... (98 %)
Writing at 0x00161a28... (100 %)
Wrote 1394048 bytes (925247 compressed) at 0x00010000 in 20.7 seconds (effective 538.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Please build project in debug configuration to get more details about an exception.
See https://docs.platformio.org/page/projectconf/build_configurations.html

--- Terminal on /dev/ttyUSB0 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ets Jul 29 2019 12:21:46

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4
ets Jul 29 2019 12:21:46

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4
ets Jul 29 2019 12:21:46

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4

Log when using 6.3.2

Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [== ] 16.2% (used 53036 bytes from 327680 bytes)
Flash: [======= ] 70.5% (used 1385797 bytes from 1966080 bytes)
Building .pio/build/nodemcu-32s/firmware.bin
esptool.py v4.5.1
Creating esp32 image...
Merged 25 ELF sections
Successfully created esp32 image.
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: /dev/ttyUSB0
Uploading .pio/build/nodemcu-32s/firmware.bin
esptool.py v4.5.1
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: b0:a7:32:28:a6:20
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00163fff...
Compressed 17488 bytes to 12168...
Writing at 0x00001000... (100 %)
Wrote 17488 bytes (12168 compressed) at 0x00001000 in 0.4 seconds (effective 356.2 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 1064.7 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 1614.9 kbit/s)...
Hash of data verified.
Compressed 1391680 bytes to 924200...
Writing at 0x00010000... (1 %)
Writing at 0x000157ab... (3 %)
Writing at 0x000197cb... (5 %)
Writing at 0x0001d899... (7 %)
Writing at 0x0002189d... (8 %)
Writing at 0x0002589a... (10 %)
Writing at 0x0002989e... (12 %)
Writing at 0x0002d899... (14 %)
Writing at 0x00031894... (15 %)
Writing at 0x000369e3... (17 %)
Writing at 0x0003a9cb... (19 %)
Writing at 0x00043d0e... (21 %)
Writing at 0x0004fcdd... (22 %)
Writing at 0x0005b2ac... (24 %)
Writing at 0x000667d9... (26 %)
Writing at 0x00077b09... (28 %)
Writing at 0x0007d07c... (29 %)
Writing at 0x00082c4d... (31 %)
Writing at 0x000898a5... (33 %)
Writing at 0x0008fc6a... (35 %)
Writing at 0x0009677d... (36 %)
Writing at 0x0009dae0... (38 %)
Writing at 0x000a383e... (40 %)
Writing at 0x000a90a8... (42 %)
Writing at 0x000aeaee... (43 %)
Writing at 0x000b3e02... (45 %)
Writing at 0x000b9163... (47 %)
Writing at 0x000be403... (49 %)
Writing at 0x000c3aa8... (50 %)
Writing at 0x000c8e71... (52 %)
Writing at 0x000cdf9f... (54 %)
Writing at 0x000d34a2... (56 %)
Writing at 0x000d854b... (57 %)
Writing at 0x000dd95b... (59 %)
Writing at 0x000e2985... (61 %)
Writing at 0x000e7f0c... (63 %)
Writing at 0x000eda5e... (64 %)
Writing at 0x000f310a... (66 %)
Writing at 0x000f8618... (68 %)
Writing at 0x000fd77e... (70 %)
Writing at 0x00102c10... (71 %)
Writing at 0x00107daa... (73 %)
Writing at 0x0010d4b5... (75 %)
Writing at 0x00112bf9... (77 %)
Writing at 0x001188e0... (78 %)
Writing at 0x0011e470... (80 %)
Writing at 0x00123db8... (82 %)
Writing at 0x001299be... (84 %)
Writing at 0x0012f116... (85 %)
Writing at 0x00134280... (87 %)
Writing at 0x0013a03f... (89 %)
Writing at 0x0014263f... (91 %)
Writing at 0x0014bb72... (92 %)
Writing at 0x0015131a... (94 %)
Writing at 0x001569ec... (96 %)
Writing at 0x0015bd4a... (98 %)
Writing at 0x001616b4... (100 %)
Wrote 1391680 bytes (924200 compressed) at 0x00010000 in 20.7 seconds (effective 537.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Please build project in debug configuration to get more details about an exception.
See https://docs.platformio.org/page/projectconf/build_configurations.html

--- Terminal on /dev/ttyUSB0 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
[ 8][E][WiFiGeneric.cpp:680] wifiLowLevelInit(): esp_wifi_init 4353
[ 45][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
Running Firmware Version: 0.2.0
Starting software access point
[ 288][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 0 - WIFI_READY
[ 394][V][WiFiGeneric.cpp:392] _arduino_event_cb(): AP Started
[ 395][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 10 - AP_START
[ 399][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring SoftAP static IP: 192.168.4.1, MASK: 255.255.255.0, GW: 192.168.4.1
[ 408][V][WiFiGeneric.cpp:143] set_esp_interface_ip(): SoftAP: 192.168.4.1 | Gateway: 192.168.4.1 | DHCP Start: 0.0.0.0 | Netmask: 255.255.255.0
[ 421][V][WiFiGeneric.cpp:190] set_esp_interface_ip(): DHCP Server Range: 192.168.4.2 to 192.168.4.12
[ 987][V][WiFiGeneric.cpp:395] _arduino_event_cb(): AP Stopped
[ 988][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 11 - AP_STOP
[ 988][V][WiFiGeneric.cpp:392] _arduino_event_cb(): AP Started
[ 995][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 10 - AP_START
Starting captive portal on 192.168.4.1

Error Handling in API Requests

Problem

Currently if a request fails the end user does not get notified of the result of the request.
Most fetch call is wrapped in a try catch that silently logs the error with console.error().

Proposal

An api service, which handles the unsuccessful requests and return a typed response. Something like:

await get<Networks>('/rest/listNetworks')

The service should:

  • Fetch the data with appropriate authentication
  • Notify the user (maybe via toast service) of any errors that occurred
  • Cast the json response to T type
  • return the data

Let me know if you are interested in the proposed feature.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.