Page 1 of 1

Autodetecting OTA the way the Arduino IDE does

Posted: Wed Oct 11, 2023 6:11 pm
by espcurt
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.

Re: Autodetecting OTA the way the Arduino IDE does

Posted: Thu Oct 12, 2023 2:47 am
by username
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

Re: Autodetecting OTA the way the Arduino IDE does

Posted: Thu Oct 12, 2023 3:58 am
by lbernstone
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

Re: Autodetecting OTA the way the Arduino IDE does

Posted: Sat Oct 21, 2023 2:47 am
by espcurt
perfect thank you this is just what I needed.