Running a config web server in parallel to Rainmaker

mottibz
Posts: 24
Joined: Tue Jun 02, 2020 12:20 pm

Running a config web server in parallel to Rainmaker

Postby mottibz » Mon Sep 11, 2023 3:13 pm

Hello,
I would like to run in parallel to the Rainmaker code a web server to enable local configuration of some parameters and for my own monitoring.
I tried to run ESPAsyncWebserver with no luck (the ESP kept rebooting itself). I started checking. One option may be becuase it is using AsyncTCP and it conflicts with the Rainmaker code. Another one may be the fact that there is no SPIFFS partition defined in the partition table. Or there is another issue...
Does anybody have experience with that and can help in making this work?
If the issue is flash space, I have an ESP32-S3 with 16MB flash that I can use...
Please help!
Thanks!

ESP_Piyush
Posts: 309
Joined: Wed Feb 20, 2019 7:02 am

Re: Running a config web server in parallel to Rainmaker

Postby ESP_Piyush » Mon Sep 11, 2023 4:47 pm

At least for the esp-idf RainMaker, a web server can co-exist and that is what is done for local control. However, this web server is also part of esp-idf and so, has better integration with RainMaker. Unfortunately, I have no experience with the Arduino libraries for web server. Can you share the error prints you see, or are they not helpful?

mottibz
Posts: 24
Joined: Tue Jun 02, 2020 12:20 pm

Re: Running a config web server in parallel to Rainmaker

Postby mottibz » Mon Sep 11, 2023 5:13 pm

Hi Piyush,
Thanks for your reply!
1. I am using the Arduino framework and was forced to move to the Arduino IDE v2 since VSCode + PlatformIO that I usually use, do not support developing for Rainmaker using the Arduino framework and the PlatformIO guys did not reply to my multiple queries about that.
2. The Arduino framework also has a built-in web server but it is less efficiant compared with ESPAsyncWebserver that runs as a thread and does not require special handling via the loop() function. For any web server that I will use, I need flash space to store my HTML/CSS/JS/IMG files and the Rainmaker partition table defined in the Arduino IDE does not have a SPIFFS partition defined for that.
3. What I tried:
- Use the ESPAsyncWebserver - the ESP32 keeps rebooting itself
- Check if I can start the SPIFFS or LittleFS filesystem failed as there is no partition defined for that in the Rainmaker partition table
4. What I need:
- Help in modifying the partition table to support having a SPIFFS or LittleFS file system so that I can upload the web data files
- Help in deciding what web server library to use. Can the default installed web sever library be used? Is that the only one possible? Is there a better web server library that I can use that will not conflict with Rainmaker?
- When will local control be available when using the Arduino framework? And, will it conflict with the web server that I will be using?
Thanks a lot!!!

mottibz
Posts: 24
Joined: Tue Jun 02, 2020 12:20 pm

Re: Running a config web server in parallel to Rainmaker

Postby mottibz » Tue Sep 12, 2023 8:52 am

Hi Piyush, Any update on this? Thanks!

ESP_Piyush
Posts: 309
Joined: Wed Feb 20, 2019 7:02 am

Re: Running a config web server in parallel to Rainmaker

Postby ESP_Piyush » Thu Sep 21, 2023 5:04 pm

Local control support could be enabled only at compile time and with Arduino, we had experience some memory issues, because of which it was kept disabled. We have now made some changes to allow enabling it at runtime, so that it can be enabled after provisioning has ended and the memory re-claimed. This will allow adding support for local control in Arduino soon. However, can you let us know the use case for which you need the local webserver?

mottibz
Posts: 24
Joined: Tue Jun 02, 2020 12:20 pm

Re: Running a config web server in parallel to Rainmaker

Postby mottibz » Thu Sep 21, 2023 5:37 pm

Hi Piyush, Thanks for your reply.
1. Can you point us to instructions how to enable the new local control when using the Arduino Framework? Do we need to install a specific version of something to enable that? Thanks!
2. Regarding the need for the webserver, as I am managing a smart home system (control is done using a CAN protocol over UDP), I need a way to setup the smart home side of the system (smart devices names, IDs, types, etc.) instead of having it hard-coded in the source code. I would like to build a web based UI to support that.
Thanks a lot, Motti

ESP_Piyush
Posts: 309
Joined: Wed Feb 20, 2019 7:02 am

Re: Running a config web server in parallel to Rainmaker

Postby ESP_Piyush » Thu Sep 21, 2023 5:42 pm

Any reason why these cannot be done using custom Rainmaker device/service and custom params? Just that the configuration would then be from the Rainmaker app instead of a web browser.

mottibz
Posts: 24
Joined: Tue Jun 02, 2020 12:20 pm

Re: Running a config web server in parallel to Rainmaker

Postby mottibz » Thu Sep 21, 2023 7:51 pm

There are global parameters such as the CAN Gateway IP address and Communication Ports, and per controlled device, its name, switch ID, device ID on the switch, and device type. Is there a way in which I can configure this interactively once before the system starts working? Is there a way that I can do this and hide this from the users (I don't want them to be able to access this setup section)?
With my other products, I used an embedded webserver to do that and to monitor and manage the product.

ESP_Piyush
Posts: 309
Joined: Wed Feb 20, 2019 7:02 am

Re: Running a config web server in parallel to Rainmaker

Postby ESP_Piyush » Mon Oct 02, 2023 10:00 am

Can you explain the workflow of your setup and configurations? Would your end user first configure the device to connect to the Wi-Fi network and then the installer does the configurations from a different interface?

mottibz
Posts: 24
Joined: Tue Jun 02, 2020 12:20 pm

Re: Running a config web server in parallel to Rainmaker

Postby mottibz » Mon Oct 02, 2023 10:14 am

Hi Piyush,
I envision something like that:
- ESP32 boots for the first time and provisioning is done using the Rainmaker process
- Following that, the device is up and connected to the home WiFi network, and Rainmaker has 0 controlled devices
- Admin connects to the webserver that is running in parallel to Rainmaker, configures the smart home setup, and reboots the ESP32
- Following reboot, the controlled devices will be registered with Rainmaker and all is set for operation by the users
- In addition to the above, the webserver will continue to be accessible by the admin, in order to monitor internal execution, modify setup, etc.
Best regards,
Motti

Who is online

Users browsing this forum: No registered users and 7 guests