Blynk OTA for ESP32

Could you please help me with the OTA for ESP32?
I mean OTA native for Blynk (curl -v -F file=@Template_ESP8266.ino.nodemcu.bin --insecure -u admin@blynk.cc:admin https://localhost:9443/admin/ota/start?token=123)

I use Blynk.Inject/Template_ESP32 as an example.
I add BLYNK_WRITE(InternalPinOTA) and void enterOTA() to my project.
It produces a lot of errors like
src\main.cpp:140:3: error: 'BlynkState' has not been declared BlynkState::set(MODE_OTA_UPGRADE);

If I add #include <BlynkState.h> from this example (and copy this file to my …/include) it compiles but fails on linking:

Linking .pio\build\ttgo-t1\firmware.elf
.pio\build\ttgo-t1\src\main.cpp.o:(.literal.BlynkWidgetWriteInternalPinOTA+0xc): undefined reference to `BlynkState::set(State)'
.pio\build\ttgo-t1\src\main.cpp.o: In function `BlynkProtocol<BlynkArduinoClientSecure<WiFiClientSecure> >::disconnect()':
C:/users/arazumov/.platformio/lib/Blynk_ID415/src/Blynk/BlynkProtocol.h:65: undefined reference to `BlynkState::set(State)'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\ttgo-t1\firmware.elf] Error 1

What am I doing wrong?

I use VSCode with PlatformIO
I can run other OTA (by providing an URL to the external Web server). But I’d like to use native Blynk feature which includes project, token… And for ESP32

An additional question.
I’ve successfully compiled the Provisioning example for esp8266. It connects to my local Blynk server and sees that a new firmware is available for its OTA upgrade.
The only issue is incorrect IP address provided for this upgrade. Instead of using my “public IP” (XXX.ru) it tries to connect to the private Blynk server IP. In my case it is a Docker container. But I guess in case of NAT there will be similar issues.

[213740] Connecting to XXX.ru:8080
[214067] Ready (ping: 134ms).
[214134] CONNECTING_CLOUD => RUNNING
[214163] Configuration stored to flash
[415897] Disconnected
[415897] RUNNING => OTA_UPGRADE
[416397] Firmware update URL: http://172.17.0.2:8080/static/ota/FUp_10360400980015388435_upload.bin
[424532] Firmware update failed (error -1): HTTP error: connection refused
[424533] OTA_UPGRADE => ERROR
[434541] Restarting after error.

Can I fix it somehow by specifying an explicit public IP for the OTA server (on the local Blynk server)?
“restore.host” in the server.properties is already configured as an external hostname (XXX.ru)

Can you somehow compare the Provisioning example which already includes possibilities like the “initial setup of the SSID, Blynk token, etc” and 3-rd party solutions like a “WiFI Manager”?

Hi,
Could you add your code please?
Thanks

This post is almost 2 years old, and the OP hasn’t logged-in to the forum for the past 18 months.

The questions asked by the OP relate to Blynk Legacy with a local server, and using the inbuilt OTA function, which was the predecessor to Blynk.Air.
I’m not sure that anyone managed to get this working successfully, and most tended to use the Arduino OTA if their devices were connected to the same network as their local server.

Are you using a Legacy local server now?

Pete.