Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually specify OTA ports in arduino Ide ? #2480

Open
penfold42 opened this issue Sep 4, 2016 · 32 comments
Open

Manually specify OTA ports in arduino Ide ? #2480

penfold42 opened this issue Sep 4, 2016 · 32 comments
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.

Comments

@penfold42
Copy link

My laptop has a firewall I can't administer and it blocks UDP 5353 inbound.
This stops AirTunes but also stops the OTA advertisements making it it.

How can I manually fake the existence of the ESP devices so they show up in the ide ?

Thanks !

@lucky62
Copy link

lucky62 commented Dec 3, 2016

+1 vote to add OTA port(s) into arduino IDE manually.

@vic10us
Copy link

vic10us commented Dec 11, 2016

+1 vote

@devyte
Copy link
Collaborator

devyte commented Oct 13, 2017

@penfold42 is this issue still valid? I understand that ArduinoOTA advertises using mDNS, and that you can specify which port to use. This is done in your code.

@devyte devyte added the waiting for feedback Waiting on additional info. If it's not received, the issue may be closed. label Oct 13, 2017
@penfold42
Copy link
Author

Yes, still an issue.

A way to fake / manually add the entries would be great

@igrr
Copy link
Member

igrr commented Oct 14, 2017 via email

@penfold42
Copy link
Author

Yes - I didn't realise the OTA subsystem is a base arduino IDE capability.

@atrent
Copy link

atrent commented Dec 7, 2017

Actually I don't think opening the 5353 port does solve the issue (I've tried adding a rule and it still fails the uploading process).

I tried using the CLI command:
python .arduino15/packages/esp8266/hardware/esp8266/2.3.0/tools/espota.py -i HOSTIPADDR -p HOSTPORT -I REMOTEIPADDR -P REMOTEPORT -f SKETCH.bin
and it JUST works (by adding a rule for HOSTPORT)

It would be great to be able to specify one port to listen onto, maybe in a config file

@atrent
Copy link

atrent commented Dec 7, 2017

SOLVED!

In file ".arduino15/packages/esp8266/hardware/esp8266/2.3.0/platform.txt"

change line:
tools.esptool.upload.network_pattern="{network_cmd}" "{runtime.platform.path}/tools/espota.py" -i "{serial.port}" -p "{network.port}" "--auth={network.password}" -f "{build.path}/{build.project_name}.bin"

to:
tools.esptool.upload.network_pattern="{network_cmd}" "{runtime.platform.path}/tools/espota.py" -i "{serial.port}" -p "{network.port}" -P 8266 "--auth={network.password}" -f "{build.path}/{build.project_name}.bin"

this way the LISTENING port on your development pc is fixed to 8266 (of course you can change it) and you can write a rule on your firewall

@atrent
Copy link

atrent commented Dec 7, 2017

better yet!

in "preferences.txt" add

ota.hostport=8266

and in file ".arduino15/packages/esp8266/hardware/esp8266/2.3.0/platform.txt" change the line in:

tools.esptool.upload.network_pattern="{network_cmd}" "{runtime.platform.path}/tools/espota.py" -i "{serial.port}" -p "{network.port}" -P "{ota.hostport}" "--auth={network.password}" -f "{build.path}/{build.project_name}.bin"

@herrold
Copy link
Contributor

herrold commented Dec 7, 2017

@devyte

he said, earlier that 5353 was being blocked

[herrold@centos-7 ~]$ grep 5353 /etc/services
mdns 5353/tcp # Multicast DNS
mdns 5353/udp # Multicast DNS

actually I would make the default in @atrent 's proposal, the IANA assigned $DEFAULT of 5353, rather than a local side port

@herrold
Copy link
Contributor

herrold commented Dec 7, 2017

@penfold42

This issue is in a closed state -- could you please re-open it so it does not get forgotten, and gets documented

@atrent
Copy link

atrent commented Dec 7, 2017

of course, you can change the config to any port you want :)

@atrent
Copy link

atrent commented Dec 7, 2017

actually, let me say that 5353 should NOT be used since it's dedicated to mdns service, while the upload of the new sketch via network is another service altogether, i.e. we should use an "unused" port

mdns is a discovery service, it's needed to find the device, the following communication is another story

@herrold
Copy link
Contributor

herrold commented Dec 7, 2017

@atrent

understood, but there is 'legacy' backward compatibility to match existing documentation -- a clean break at a major release epoch makes sense, though

I'd be thrilled on a small IoT friendly avahi daemon and hand-off for OTA purposes. I have not looked -- do you know of a less 'weighty' suite (the current Avahi tarball is 1.2 meg big)

@devyte
Copy link
Collaborator

devyte commented Dec 7, 2017

@igrr what do you think of @atrent 's proposal to change platform.txt?

@penfold42
Copy link
Author

The subject could be misleading.
Ports on my case refers to the list of ports in the arduino GUI where the OTA targets show up (next to COM3, COM17 etc)

This relies on mDNS advertisements making it past the firewall on port 5353.
As it is locked down, I was looking for a way to fake the entries in the GUI.

@atrent
Copy link

atrent commented Feb 14, 2018

Sorry for "bumping", did you think about my proposal?

@veleek
Copy link

veleek commented Mar 5, 2019

@atrent, there's a slight misunderstanding here I think. @penfold42 was looking for a way to manually specify a TARGET destination for an OTA upload in the Arduino GUI. As a good example of this, on Windows machines, it can be difficult to get mDNS working properly which means that even though I have an ESP OTA service running (I can see it using my mDNS browser on my iPhone) I'm unable to see the "Network Port" in the Arduino GUI.

However, I can still manually connect to the ESP using it's IP address, and since the IP doesn't change very often on my home network it would be very helpful to be able to manually setup a network port in the Arduino UI in order to be able to deploy an OTA update to my ESP from the UI.

@penfold42 - I still think this is a reasonable issue to be open. Could you re-open this bug so that we can at least have something tracking this and maintain a bit of the historical discussion?

@veleek
Copy link

veleek commented Mar 5, 2019

For anybody interested in a useful workaround, if you're using VSCode you can create a custom task to execute the espota.py directly and specify the IP and destination port. It's a quick, easy, reusable way of deploying OTA updates.

Example tasks.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "OTA Upload",
            "type": "shell",
            "command": "py",
            "args": [
                "%LOCALAPPDATA%\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0\\tools\\espota.py",
                "-i",
                "192.168.29.243",
                "-p",
                "8266",
                "-f",
                "${workspaceFolder}\\..\\build\\${fileBasename}.bin",
            ],
            "options": {
                "shell": {
                    "executable": "cmd.exe",
                    "args": [ "/c" ]
                }
            }
        }
    ]
}

This task assumes that you have specified that the build output go into ..\build and you'll need to update the location for espota.py if you're using a different version. Also by default it will look for a file .bin file with the same name as the .ino sketch you have open (e.g. sample.ino.bin).

@devyte devyte reopened this Mar 5, 2019
@colinl
Copy link

colinl commented Oct 9, 2019

Is there still no solution to this? The network port for OTA only rarely appears in Tools > Ports so I cannot upload OTA. I am running on Windows 10. If I could specify the device IP address manually then that would (I think) solve my problem.

@d-a-v
Copy link
Collaborator

d-a-v commented Oct 9, 2019

You can

  • run a terminal,
  • locate the build directory where you can find sketch.bin freshly compiled,
  • get into the core directory (cd \path\to\arduino15\hardware\...\esp8266\tools) where espota.py is,
  • run it: (fixed option -p => -i thanks @MaBi6411)
python3/python3.exe espota.py -i <ip-address> -f c:\path\to\sketch.bin
  • write the documentation
  • post it in a PR

@colinl
Copy link

colinl commented Oct 9, 2019

Thanks. I looked for that script earlier but couldn't find it. Will have another look.

@MaBi6411
Copy link

MaBi6411 commented May 2, 2020

@d-a-v

python3/python3.exe espota.py -p <ip-address> -f c:\path\to\sketch.bin

argument for < ip-address > is -i



I created a very easy tool that do the same thing with a GUI.

You can find it here.

@d-a-v
Copy link
Collaborator

d-a-v commented May 2, 2020

@MaBi6411 Thanks I fixed my comment.
Your tool is interesting, but it needs an external compiler and may be available only on windows.
You may make a pull request to mention in documentation,
You could also write one in python3 using tkinter as gui as it seems to me it is the most cross-platform and simple way to get a gui not requiring any further tool/compiler.

@JAndrassy
Copy link
Contributor

JAndrassy commented May 2, 2020

if espota were installed as an IDE tool, one could configure it as programmer (and it would be part of referred package problem solution too). examples for the arduinoOTA tool:

programmer.txt:

arduinoOTA104.name=Arduino OTA (192.168.1.104)
arduinoOTA104.program.tool=arduinoOTA
arduinoOTA104.ip=192.168.1.104

platform.local.txt

## arduinoOTA as programmer. add entries with {ip} into programmers.txt
tools.arduinoOTA.cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA
tools.arduinoOTA.program.params.verbose=
tools.arduinoOTA.program.params.quiet=
tools.arduinoOTA.program.pattern="{cmd}" -address {ip} -port 65280 -username arduino -password password -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b

@MaBi6411
Copy link

MaBi6411 commented May 4, 2020

@d-a-v
A program that makes the same compile functions of Arduino IDE except editing it's not easy for me... and I'm totally new with python.
I think it's easier to change the official IDE with possibility to insert IP and password of OTA target ...My solution is temporary

@MaBi6411
Copy link

MaBi6411 commented May 4, 2020

@d-a-v

You may make a pull request to mention in documentation

Where do I have to do it? Could you explain to me please? I'm totally new in GitHub.

@SheetLightning
Copy link

Just want to add another vote for manual specification of an OTA target. I have found the automated method to be hit-and-miss when it comes to showing the target in the target ports list.

@SheetLightning
Copy link

SheetLightning commented Jun 12, 2020

I would like to add another vote in favour of being able to manually specify the OTA target. Like others I have found the automated solution to be rather hit-and-miss when it comes to detecting and showing the OTA target. If I am to use this seriously then I need a reliable method of OTA updating my devices. My dev machine is running Linux so its not a Windows 10 issue.

@koshkamau
Copy link

I'm voting for manual specification of an OTA target too.
OTA is completely unreliable for me (Win10). Right now I was forced to reboot my laptop to see OTA targets in IDE.
Disabling firewall, reconnecting to WiFi and restarting IDE didn't help.

@TeguhTeknisi
Copy link

TeguhTeknisi commented Aug 26, 2022

I'm voting for manual specification of an OTA target too. ( IP Adress and Port )
for now, i use espota.py if Arduino IDE cannot detect the OTA Ports,

@JAndrassy
Copy link
Contributor

#8432

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.
Projects
None yet
Development

No branches or pull requests