ESPHome Setup

Flashing firmware with Raspberry Pi

ESPHomeYAML is a tool which creates custom firmware for ESP8266/ESP32 boards and sensors from a Yet-Another-Markup-Language (YAML) file. We're going to be using the official Home Assistant add-on for ESPHomeYAML to help generate firmware for the Feather. Then, we'll upload the firmware directly to the board.

Note: If you are using any single-board computer slower than a Pi 3, such as a Pi Zero, expect to wait a significant amount of time while the firmware compiles and uploads to the Feather Huzzah. 

Plug the Feather into a USB Cable, and then into one of the Raspberry Pi 3B+'s USB ports.

Since we'll be compiling and uploading the firmware directly from the Pi to the Feather, we'll connect the two before we begin.

Plug the Feather into a Micro-USB Cable, and then into one of the Raspberry Pi 3B+'s USB ports.

From the esphomeyaml add on page, click Start.

Once ESPHomeYAML is finished installing, a new button will appear Open Web UI.

Click Open Web UI

From the ESPHomeYAML dashboard, click the Plus Icon to launch the ESPHome Setup Wizard. 

The ESPHomeYAML wizard will walk you through setting up a ESP-powered device using ESPHome. 

  • First, name your device. If you're hooking up a lot of smart-devices to Home Assistant - make it as descriptive as possible.
  • Then, select Adafruit HUZZAH ESP8266 as the Device Type
  • Enter the WiFi SSID and password for your network.
    • You can also configure a password for performing Over-the-Air (OTA) updates at this step. This'll allow you to connect to the Feather Huzzah from Home Assistant without connecting a USB cable, and flash firmware to it. 
  • You're done with setup! Click Submit

After the setup wizard completes, a new node will appear on the ESPHome dashboard. We're not ready to upload the settings yet.

Click Edit

The feather_bme280.yaml file below is based off of the template provided in Boris Hajduk's guide `Using adafruit.io MQTT with esphomeyaml`

Copy and paste the file below into the ESPHome Dashboard file editor:

# ESPHomeYAML Configuration
# for Home Assistant and Adafruit IO

substitutions:
  device_name: feather_bme280
  io_username: YOUR_ADAFRUIT_IO_USERNAME
  io_key: YOUR_ADAFRUIT_IO_KEY
  update_interval: 30s

esphomeyaml:
  name: ${device_name}
  platform: ESP8266
  board: huzzah

# WiFi Configuration
wifi:
  ssid: 'YOUR_SSID'
  password: 'YOUR_SSID_PASSWORD'
  # Uncomment this for Static IP Configuration
  #manual_ip:
    # Set this to the IP of the ESP
    #static_ip: 10.0.0.0
    # Set this to the IP address of the router. Often ends with .1
    #gateway: 10.0.0.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    #subnet: 255.255.255.0

# Adafruit IO MQTT Setup
mqtt:
  broker: 'io.adafruit.com'
  username: ${io_username}
  password: ${io_key}
  topic_prefix: '${io_username}/feeds'
  birth_message:
    topic: ${io_username}/feeds/status
    payload: Online
  will_message:
    topic: ${io_username}/feeds/status
    payload: Offline
  log_topic:

# Enable Home Assistant API
api:

# Enable OTA Access
ota:

# Enable verbose logging over serial
logger:

# Create BME Sensor on I2C
i2c:
  sda: SDA
  scl: SCL
  scan: False
binary_sensor:
    - platform: status
      name: "BME280 Status"
      id: status
      internal: True
sensor:
  - platform: bme280
    address: 0x77
    temperature:
      name: "BME280 Temperature"
      id: temperature
      state_topic: ${io_username}/feeds/temperature
      discovery: False
      filters: []
    pressure:
      name: "BME280 Pressure"
      id: pressure
      state_topic: ${io_username}/feeds/pressure
      discovery: False
      filters: []
    humidity:
      name: "BME280 Humidity"
      id: humidity
      state_topic: ${io_username}/feeds/humidity
      discovery: False
      filters: []
    update_interval: ${update_interval}

Before uploading the file, we'll need to make the following adjustments to the YAML file under substitutions:

  • Change device_name to reflect the name of the device you created in the ESPHome Wizard.
  • Set io_username to your Adafruit IO Username
  • Set io_key to your Adafruit IO Key
  • Change update_interval to the frequency (in seconds) which you'd like the feather to read the sensor and send its data to Home Assistant and Adafruit IO.

We'll also need to configure the WiFi network:

  • Set ssid to your network's ssid
  • Set password to your network's password

After configuration of the YAML file is complete, click save.

After uploading, we'll need to check the YAML configuration. From the ESPHome Dashboard, click Validate

If everything is OK, the dialog will display INFO Configuration is Valid!

Finally, we'll move onto uploading the firmware to the ESP8266. 

On the top right corner of the ESPHome Dashboard, make sure you have selected the USB to UART Bridge Converter and not OTA (over-the-air).

The ESPHome Add-On is not capable of discovering new USB ports after the Add-On has started. If you started the application before plugging in the Feather, restart the Add-On before proceeding with this step.

Under the settings for the Feather, click UPLOAD.

This will compile the firmware for the Feather and upload it over USB.

Since we're compiling firmware from the Raspberry Pi, this process will take a while to complete.

If everything compiles and uploads successfully, the Feather on the ESPHomeYAML dashboard will display as Online.

Flashing firmware using the Command Line

You can also flash firmware from the command line by following the instructions on the esphomeyaml Getting Started documentation

Note: To use the PlatformIO Python dependency required by esphomeyaml CLI - you'll need to install Python 2.7.9. If you don't want to mess with multiple installations of Python on your computer - you can install this version through PyEnv.  

This guide was first published on Feb 07, 2019. It was last updated on Feb 07, 2019. This page (ESPHome Setup) was last updated on Dec 05, 2019.