Is there a way to do this with OTA? (reboot, flash only a specific device, ping for information, etc)

statusquo
Posts: 4
Joined: Mon May 23, 2022 3:32 pm

Is there a way to do this with OTA? (reboot, flash only a specific device, ping for information, etc)

Postby statusquo » Mon Jun 20, 2022 8:32 am

I have a bunch of ESP32s across the country that are all flashed with OTA.
Essentially, I upload a new bin file and JSON file on a web server and have ESP32 compare its version with the version from the JSON file and if it is lower than that it updates.

However, if I want to only update one of them, there is no way to do it without updating the other ones too.

I have their mac addresses somewhere, but is there a way to perhaps have them ping a web server so that I get exact mac addresses, and have it so that it firstly compares the mac address with mac address in json file and if it is the same mac address + it is a lower version that it updates?

Second, sometimes, they will lose internet connection and reboot seems to fix it
So, after getting their mac addresses or whatever is necessary to identify them one by one, is there a way to reboot only one of them?
(this is perhaps the most important function to me)

Thirdly, they all have 2 led indicators, first is if the important process is ongoing (it has a connection to the remote PC) and second is if it has wifi connection. I'd like to be able to see those indicators for each one of these one by one, if the process is ongoing and if it has wifi connection without someone being there physically.

So TLDR:
I need to have a list of all ESP32s, their current status (process is ongoing, wifi is found), ability to reboot one of them or even put them in provisioning mode and put a new update to only one of them.
Last edited by statusquo on Wed Sep 28, 2022 9:26 am, edited 1 time in total.

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: Is there a way to do this with OTA? (reboot, flash only a specific device, ping for information, etc)

Postby chegewara » Mon Jun 20, 2022 1:47 pm

There is few options to do it. Here you can find 2 of them:
- mqtt; device can report itself, with status, mac etc and can listen to messages from server; messages can be sent to all devices or to just one
- http/s; esp32 can polling server and to check if there is required any action.

sergiomarina
Posts: 48
Joined: Wed Feb 05, 2020 6:29 pm

Re: Is there a way to do this with OTA? (reboot, flash only a specific device, ping for information, etc)

Postby sergiomarina » Mon Jun 27, 2022 10:17 am

Hi statusquo and All,
I'm doing this exercise as well. The way I'm pursuing is based on MAC addr identity. The web server, which is also a file server and a WiFi access point, stores the new exe file with the MAC address as a preamble. As per previous tip the client polls the web server supplying its MAC address in the GET request. If the MAC address matches the preamble then the web server replies with the filename to download (as an additional precaution the target MAC address is added to the filename as a preamble so the station/client can check it, too)
Both the server and the client are ESP32 devices.

I'm now stacked with the file sending. I can easily send files up to few KB, but not the size of 950KB since the client always crashes :-(

Did you succeed in OTA file sending? Thank you!

Added on June the 30th
The crash described here above has been solved including part of the "native OTA" exercise.

statusquo
Posts: 4
Joined: Mon May 23, 2022 3:32 pm

Re: Is there a way to do this with OTA? (reboot, flash only a specific device, ping for information, etc)

Postby statusquo » Tue Jul 12, 2022 9:56 am

sergiomarina wrote:
Mon Jun 27, 2022 10:17 am
Hi statusquo and All,
I'm doing this exercise as well. The way I'm pursuing is based on MAC addr identity. The web server, which is also a file server and a WiFi access point, stores the new exe file with the MAC address as a preamble. As per previous tip the client polls the web server supplying its MAC address in the GET request. If the MAC address matches the preamble then the web server replies with the filename to download (as an additional precaution the target MAC address is added to the filename as a preamble so the station/client can check it, too)
Both the server and the client are ESP32 devices.

I'm now stacked with the file sending. I can easily send files up to few KB, but not the size of 950KB since the client always crashes :-(

Did you succeed in OTA file sending? Thank you!

Added on June the 30th
The crash described here above has been solved including part of the "native OTA" exercise.
Hey, sorry man! I'm not used to this forum, so I didn't see any notifications.
Hope you solved your OTA issue.

We are currently testing the MAC address thing.

sergiomarina
Posts: 48
Joined: Wed Feb 05, 2020 6:29 pm

Re: Is there a way to do this with OTA? (reboot, flash only a specific device, ping for information, etc)

Postby sergiomarina » Sun Nov 13, 2022 7:41 am

Good to hear that. On my side the bin transfer is now ok.
So far, the solution I described works.
Since the url has a length constraint I add only the ending three bytes of the MAC address (good enough)
To limit the number of http handlers the GET messages ending portion is segmented by tokens so to achieve distinction.
Reorganizing the coding I might add a task to manage the OTA. It can be an improvement for the future

Who is online

Users browsing this forum: No registered users and 166 guests