Problem with OTA IP [SOLVED]

After fiddling with platformio vscode, I decided to use directly platformio core.

I am using ESP8266 with OTA programming.

If I type
pio run -t upload --upload-port 192.168.1.144

everything is fine. But I would prefer to insert the IP in the env setting of the project, to avoid errors (sending the code to the wrong device).

I thus set us the platformio.ini as

[env:nodemcuv2]
platform = espressif8266
lib_extra_dirs = …/Arduino_LIBS
lib_dir= lib
board = nodemcuv2
framework = arduino
upload-port = 192.168.1.144

But it does not work when I type

pio run -t upload

I get
Looking for upload port…
Error: Please specify upload_port for environment or use global --upload-port option.
For some development platforms it can be a USB flash drive (i.e. /media//)
*** [upload] Explicit exit, status 1

Thanks for any hint.

In your platformio.ini change upload-port to upload_port.

Thanks !

Now it works !

It is really confusing to have
–upload-port 192.168.1.144

in the command line
and

upload_port = 192.168.1.144

in the .ini file.

Will be more cautious now for copy/paste