OTA [ERROR]: No Answer

Hello. I have a problem with OTA and Platformio. With IDE Arduino run correct.
I desactive fireware and my platformio.ini is:

[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
lib_deps =
  #Using a library name
  PubSubClient

; Serial Monitor options
monitor_speed = 115200

; Configuración OTA
upload_port = 192.168.1.150
upload_protocol = espota

In my setup() funtion:

........
........
 //Actualización código por OTA
  ArduinoOTA.setPort(8266);
  ArduinoOTA.setHostname("Control_Acceso");
  ArduinoOTA.begin();

In my loop() funtion:

........
........
ArduinoOTA.handle(); // Actualización código por OTA

Fixed IP: 192.168.1.150 in the code.

Mistakes:

17:09:51 [DEBUG]: Options: {'esp_ip': '192.168.1.150', 'host_ip': '0.0.0.0', 'esp_port': 8266, 'host_port': 45206, 'auth': '', 'image': '.pio\\build\\d1_mini\\firmware.bin', 'spiffs': False, 'debug': True, 'progress': True}
17:09:51 [INFO]: Starting on 0.0.0.0:45206
17:09:51 [INFO]: Upload size: 318192
17:09:51 [INFO]: Sending invitation to: 192.168.1.150
17:10:01 [ERROR]: No Answer
*** [upload] Error 1

I have read everything related to OTA in the forum but I can’t find a solution, please help

Can you ping this IP, as a first test? What is the full sketch? Have you tried the official example sketch first with PIO? Arduino/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino at master · esp8266/Arduino · GitHub

1 Like

There is also no need for ArduinoOTA.setPort(8266); unless you want a port other than 8266, as this is the port the ArduinoOTA code will default to. I would be checking that the IP is pingable and that your firewall isn’t blocking access, assuming that you have tested this to be working with the stock example sketch first to make sure the fault isn’t somewhere in your code.

Thanks

I have tried BasicOTA.ino and error.

19:18:41 [DEBUG]: Options: {‘esp_ip’: ‘192.168.1.50’, ‘host_ip’: ‘0.0.0.0’, ‘esp_port’: 8266, ‘host_port’: 47288, ‘auth’: ‘’, ‘image’: ‘.pio\build\nodemcuv2\firmware.bin’, ‘spiffs’: False, ‘debug’: True, ‘progress’: True}
19:18:41 [INFO]: Starting on 0.0.0.0:47288
19:18:41 [INFO]: Upload size: 310576
19:18:41 [INFO]: Sending invitation to: 192.168.1.50
19:18:51 [ERROR]: No Answer
*** [upload] Error 1

ping 192.168.1.50

Haciendo ping a 192.168.1.50 con 32 bytes de datos:
Respuesta desde 192.168.1.50: bytes=32 tiempo=338ms TTL=255
Respuesta desde 192.168.1.50: bytes=32 tiempo=26ms TTL=255
Respuesta desde 192.168.1.50: bytes=32 tiempo=51ms TTL=255
Respuesta desde 192.168.1.50: bytes=32 tiempo=67ms TTL=255

Estadísticas de ping para 192.168.1.50:
Paquetes: enviados = 4, recibidos = 4, perdidos = 0
(0% perdidos),
Tiempos aproximados de ida y vuelta en milisegundos:
Mínimo = 26ms, Máximo = 338ms, Media = 120ms

With Arduino IDE BasicOTA.ino run ok.

¿Help please? I would like works with Platformio and OTA.

SOLVED

Problem with Firewall. I have given permisions to Visual Studio Code to use ports.

THANKS

2 Likes