Refer to resources like ESP32 OTA, I'm confused - #2 by ivankravets.
Really it’s just as easy as
- adding the ArduinoOTA init code in
setup()and the handle code inloop()like in the example - checking out what IP address your ESP32 has (e.g. in the router or serial monitor once), or using mDNS names
- adapting the
platformio.inito use the OTA upload code as shown in the docs above like
upload_protocol = espota
upload_port = IP_ADDRESS_HERE or mDNS_NAME.local
- using the normal upload button of the IDE.