Pio remote details

I have gone through the docs of pio remote but couldn’t get the conditions for doing remote:-

  1. does the OTA sequence needs to be there in devices(ESP8266)?
  2. does the higher delay may cause failed upload to remote device?
  3. How can I make the remote upload command to wait for device in case of deep-sleep?

One of my ESP8266 having OTA sequence implemented, is connected to MQTT broker on raspberry pi. The ESP8266 sends data every 3.5min and when I try to do “pio remote” it always gives error:-

Looking for upload port…
Use manually specified:
Uploading .pioenvs/esp8266/firmware.bin
09:37:18 [DEBUG]: Options: {‘esp_ip’: ‘’, ‘host_port’: 51012, ‘image’: ‘.pioenvs/esp8266/firmware.bin’,
‘host_ip’: ‘’, ‘auth’: ‘’, ‘esp_port’: 8266, ‘spiffs’: False, ‘debug’: True, ‘progress’: True}
09:37:18 [INFO]: Starting on
09:37:18 [INFO]: Upload size: 254960
09:37:18 [INFO]: Sending invitation to:
09:37:28 [ERROR]: No Answer
*** [upload] Error 1

Could you flash this device directly from a side where PIO Remote agent is started?

Means I should connect my source-code laptop and raspberry-pi and ESP8266 on same Wi-Fi network and perform the pio remote -t upload -upload-port OR pio -t upload --upload-port ?
The first one doesn’t seems valid as both are local.

Could you flash your device using RPi without PIO Remote (just for test)? See