ESP Mini D1 Upload Error

I am trying to upload first piece of code to ESP8266 MiniD1 via ESP Home Dashboard to perform some test and continuously getting below error any help appreciated:
ERROR Connecting to failed: [Errno 111] Connection refused

The challenge I see that ESP Dashboard has only option of OTA (Over The Air) to transfer code, no option for physical USB connection. I tried both wired USB and wifi options.

I am able to ping MiniD1 at and have fixed IP assigned in my router.

First few attempts failed because MiniD1 was not able to connect to Wifi via OTA option then used Arduino IDE to flash simple code to blink onboard LED and configure wifi. Now MiniD1 working with LED flash program but not letting me transfer any new program to overwrite MiniD1. Any help/advice appreciated.

There are 2 options:

  1. USB - Are you not getting an option on USB device when you connect the mini directly to the PC/ Raspi/etc hosting the HA? DO a restart of the HA or worst case machine if required
  2. If above is not working, you could choose a compile option. click on the 3 dots from the wemo_mini_d1 profile in esphome -> compile. This will allow you to download the compiled .bin file. You can take that bin file and flash through ESPhome Flasher tool in your PC. you Mini will need to be connected to PC

I did a clean restart on RESPI running HA, connected ESP8266 directly on USB port via micro USB connector. OTA upload is still failing with same error message “connection refused” but on HA ESP dashboard I found another drop down option of /dev/ttyUSB0 (USB2.0-Serial) besides OTA and with that option I was able to establish communication. I was able to upload my code successfully and could integrate ESP8266 to my HA.
Manju thanks for your advice it really helped in fixing my roadblock.

Glad that you got it working. However, would like to correct you on your approach. As I understand you were trying to do a OTA for the first time, it will NOT work since ESP will not have any firmware to accept the OTA. Once you have flashed the firmware through either of the process I highlighted earlier, then you will be able to flash it OTA (provided you have included OTA option in the yaml).

Also not, many a times the WIFI does not connect for various reason, connecting esp directly to a PCs USB and debugging through a serial console like Arduino IDE or esphome flasher is a preferred way