I’m trying to setup esphome with docker. I figure I might as well document the process for future reference.
I have the following in my docker-compose file:
esphome:
container_name: esphome
image: esphome/esphome
privileged: true
ports:
- 6052:6052
volumes:
- ${USERDIR}/stacks/homeautomation/esphome:/config:rw
network_mode: host
restart: unless-stopped
I’m able to start the container and used the wizard to create a node. However, I’m getting when trying to upload (via USB).
INFO Reading configuration...
INFO Generating C++ source...
INFO Compiling app...
INFO Running: platformio run -d /config/mbabme280
Processing mbabme280 (platform: [email protected]; framework: arduino; board: d1_mini)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini.html
PLATFORM: Espressif 8266 > WeMos D1 R2 & mini
HARDWARE: ESP8266 80MHz 80KB RAM (4MB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 27 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS>
| |-- <ESP8266WiFi> 1.0
|-- <ESPAsyncTCP> 1.2.0
| |-- <ESP8266WiFi> 1.0
|-- <Hash> 1.0
|-- <esphome-core> 1.12.2
| |-- <ArduinoJson-esphomelib> 5.13.3
| |-- <ESP8266WiFi> 1.0
| |-- <ESP8266mDNS>
| | |-- <ESP8266WiFi> 1.0
| |-- <ESPAsyncTCP> 1.2.0
| | |-- <ESP8266WiFi> 1.0
Retrieving maximum program size .pioenvs/mbabme280/firmware.elf
Checking size .pioenvs/mbabme280/firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA: [==== ] 37.9% (used 31076 bytes from 81920 bytes)
PROGRAM: [=== ] 30.8% (used 321492 bytes from 1044464 bytes)
========================= [SUCCESS] Took 7.18 seconds =========================
INFO Successfully compiled program.
INFO Running: esptool.py --before default_reset --after hard_reset --chip esp8266 --port /dev/ttyACM0 write_flash 0x0 /config/mbabme280/.pioenvs/mbabme280/firmware.bin
esptool.py v2.6
Serial port /dev/ttyACM0
Connecting........_____....._____....._____....._____....._____....._____....._____
A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header
Found the problem. I’m using VirtualBox and I had to enable USB passthrough and select the new USB device, and use that for the upload.