ESPHome USB upload fails

In ESPHome 1.14.3 and 1.15-dev I’m unable to upload via a USB port. What’s happened, or what am I doing wrong?
The upload terminates with the message below (this is in 1.14.3).
I’ve tried “chmod a+rw /dev/ttyUSB1” in the esphome docker and outside.
I’ve tried connecting my ESP32 to a CP2102 usb interface, both 3.3v and 5v, both ground pins.
I don’t know what else to try. (OTA upload works fine, so it’s something with the usb)

Serial port /dev/ttyUSB1
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/serial/serialposix.py", line 265, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
OSError: [Errno 5] Input/output error: '/dev/ttyUSB1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.platformio/packages/tool-esptoolpy/esptool.py", line 2959, in <module>
    _main()
  File "/root/.platformio/packages/tool-esptoolpy/esptool.py", line 2952, in _main
    main()
  File "/root/.platformio/packages/tool-esptoolpy/esptool.py", line 2652, in main
    esp = chip_class(each_port, initial_baud, args.trace)
  File "/root/.platformio/packages/tool-esptoolpy/esptool.py", line 222, in init
    self._port = serial.serial_for_url(port)
  File "/usr/local/lib/python3.6/dist-packages/serial/init.py", line 88, in serial_for_url
    instance.open()
  File "/usr/local/lib/python3.6/dist-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 5] could not open port /dev/ttyUSB1: [Errno 5] Input/output error: '/dev/ttyUSB1'
*** [upload] Error 1

How sure are you that it is /dev/ttyUSB1? The first device plugged in will he /dev/ttyUSB0. Do you have another device plugged into usb?

100% sure. It’s the only new one that shows up after an ESPHome restart. And I know the other ports very well. Now I’ve tried a reboot too. No change.

1 Like

please post the output of

ls -l /dev/ttyUSB1

root@ha:/dev# ls -l ttyUSB1
crw-rw---- 1 root dialout 188, 1 Jan 12 00:02 ttyUSB1

Flashing with esphomeflasher (windows) works fine, so I guess that’s the way I’ll be doing it. I can live with that.
However, the esphome behaviour is still very strange.
The esphome docker still doesn’t recognize the esp32 on a usb port, even after a restart or reboot. The host OS (Debian stretch on an Intel NUC 5) sees it.

Do you have

--device=/dev/ttyUSB1

in your docker commandline? See https://esphome.io/guides/getting_started_command_line.html#first-uploading

1 Like

No, I don’t, so I’ll try it tonight.
I haven’t used this because I’m afraid of the linux random boot usb name assignment problem.

Well this is likely your problem then. If all else fails, follow the instructions!