Autodetecting OTA the way the Arduino IDE does

espcurt
Posts: 6
Joined: Wed Oct 11, 2023 6:04 pm

Autodetecting OTA the way the Arduino IDE does

Postby espcurt » Wed Oct 11, 2023 6:11 pm

I have tried finding an answer to this question and my google-foo has let me down.

I am creating a product I would like to automatically update an ESP32 using OTA. How does the Arduino IDE autodetect available esp32-OTA? I assume it has to do with subscribing to broadcast mDNS messages over the network, or does it just brute-force check every IP on the subnet for the right open port and send a query?

To be clear: I have no trouble enabling OTA/web/programming examples on my module, and the Arduino IDE works just fine for dev, but I want to integrate that functionality into my standalone+idiotproof (c++) app.

I am sure this is a common problem/solution, sorry for the repeat.

username
Posts: 508
Joined: Thu May 03, 2018 1:18 pm

Re: Autodetecting OTA the way the Arduino IDE does

Postby username » Thu Oct 12, 2023 2:47 am

Google the source for Arduino OTA. Thats what I did when I had the same question as you.
Since then I just rolled my own

lbernstone
Posts: 798
Joined: Mon Jul 22, 2019 3:20 pm

Re: Autodetecting OTA the way the Arduino IDE does

Postby lbernstone » Thu Oct 12, 2023 3:58 am

The code is all open source. The device puts a multicast advertisement on mDNS, and the client just has to scan mDNS for the service.
https://github.com/espressif/arduino-es ... A.cpp#L135

espcurt
Posts: 6
Joined: Wed Oct 11, 2023 6:04 pm

Re: Autodetecting OTA the way the Arduino IDE does

Postby espcurt » Sat Oct 21, 2023 2:47 am

perfect thank you this is just what I needed.

Who is online

Users browsing this forum: No registered users and 45 guests