ESPHome: upload to IP directly?

Hi everybody,

I just flashed ESPHome onto a testing ESP32; I flashed via dev/ttyUSB0, which worked just fine. It also gave me the option to flash over the air (nodemcu32main.local).

I know that nodemcu32main.local) will not be the devices address; it is in a different network than my computer, as I have a VLAN for IOT devices. Also, my router blocks the .local by default.

So I looked at the docs and tried esphome nodemcu_main.yaml run --host-port <ip>; also tried prepending sudo, but it does not make a difference. I get

usage: esphome [-h] [-v] [-q]
               [configuration [configuration ...]] {config,compile,upload,logs,run,clean-mqtt,wizard,mqtt-fingerprint,version,clean,dashboard,vscode,update-all} ...
esphome: error: unrecognized arguments: --host-port <ip>

I tried putting the parameter elsewhere, for example esphome --host-port (...) or esphome nodemcu_main.yaml --host-port (...) etc. etc., even though I was pretty sure that it didn’t matter. Just wanted to see if I could do anything to get this to work.

I ran sudo pip-review --auto, which I have as an alias to upgrade pip; also tried sudo pip install esphome to see whether there was an update. I did not forget pip3 (as stated in the docs) as I am using a distribution that defaults to pip3; so just to be extra sure I tried pip3 instead of pip, without any success…

How can I flash OTA without resorting to the .local? I want my ESPHomes spred around the house, so flashing via USB is not an option. Unfortunately I could not figure this out on my own.

Thank you for your ideas :slight_smile:

See the section on manual op addresses, if you set one it uses that for OTA updates, rather than the .local name.

1 Like

I have second option to do it

compile and download in laptop then flashing it iot spot.

but I have no idea when you use Vlan.

Thank you @eggman :pray:

While this works, do you know another way (especially since this ought to work via command line)? I usually use static IPs via router (so don’t need to set them in the configuration), so if there is a way to avoid having to set the IP “twice” (as I have to set it in my router anyway), I’d prefer that.

@minsuke thank you. What do you mean “flashing it iot spot”?

when OTA is not available, I make a compile and download firmware in dashboard

then go to the ESPHOME node and connect by USB

and execute ESPHOME-flahser.exe and upload my new firmware.

Funnily enough the documentation points out that you can specify the OTA IP address to use

--upload-port UPLOAD_PORT

Manually specify the upload port/ip to use. For example /dev/cu.SLAB_USBtoUART .

See RTFM

You can specify the device’s name on the network in there without having to use a static IP. See the use_address setting. And possibly also the domain setting to change the .local.

Doh! I was working too long on this when I wrote the initial post (concentration was gone)… of course --host-port is my local machine and --upload-port is the target one.

1 Like