I am posting this because I could not reply on one of the old posts regarding “No response from the device” problem while using OTA updates for ESP8266 through the Arduino IDE
Let me explain the problem that I faced and how I found the solution for it
I was struggling with the OTA updates for my ESP8266. I use two machines for development, Windows and Ubuntu. On my Windows machine, the OTA updates worked just fine while I was having trouble doing the same on the Ubuntu machine.
Now, a few nice people in the forum did point out that the problem is the system Firewall. That is absolutely right. The problem is not with the ESP not responding but rather the Firewall blocking the response. On my Windows machine, I did not have the firewall settings blocking the TCP ports required by the espota.py script. On my ubuntu machine however, my ‘ufw’ settings had limited ports enabled.
Some people suggested disabling the firewall completely, which was not practical for me as I had some other critical services running and disabling the firewall was not an option
So the workaround was to directly use the ‘espota.py’ script using the command as follows:
python3 espota.py -i <ESP_IP_address> -I <Host_IP_address> -p <ESP_port> -P <Host_port> [-a password] -f <sketch.bin>
This works fine if you have done ‘sudo ufw allow <Host_port>/tcp’. So I used it for a day but then it gets a bit annoying if you are in the development phase and have to move out of the Arduino IDE environment every time to the command line and execute the above command
Next question. Why cant you do this using the Arduino IDE?
Because, you dont have an option to choose what host port on your machine to use for OTA update (May be an option can be provided in future updates)
So, I did some more digging into the espota.py tool and I felt there was an issue. If you dont assign the host port, the script assigns a random port between 10000 and 60000. Now, unless you allow the whole range of ports between 10000 and 60000 for TCP connections or have the firewall disabled, you cant be sure that the OTA updates can work every time. So the quick fix that I have done so far on my machine is to make a small change in the ‘espota.py’ script and assign the default port parameter to a particular port and allow my firewall for that one port alone.
In case, anyone has a better solution or if I missed something really trivial, please feel free to reply to this thread.