Chapter 4 · Connect to Home Assistant 15 min

Connect to Home Assistant

Wire your LVGL UI to Home Assistant entities for live data and two-way control.

Do this first: pair your ESPHome device with Home Assistant below. Until this is done, the entity wiring in the next pages won't work.

0. Pair ESPHome with Home Assistant

One-time setup - takes under a minute

1

Open Settings → Devices & Services

Your ESPHome device should appear under "Discovered" at the top of the page. Click Add.

Home Assistant Settings → Devices & Services showing a discovered ESPHome device with Add button
Don't see your device under "Discovered"? Make sure it's powered on and connected to the same network. You can also click "+ Add integration" at the bottom right, search for "ESPHome", and enter the device's IP address manually.
2

Enter the API encryption key

Home Assistant asks for the encryption key from your device config. If you used the ESPHome dashboard wizard in Chapter 2, it was auto-generated. Find it in your YAML:

yamlFind this in your device YAML
# Find this in your device YAML (ESPHome dashboard → EDIT)
api:
  encryption:
    key: "gVegxdSrJJpwshDsExtKqozXoUqQBi7SlBzP7P+NoY4="

Copy the value from key: "...", paste it in the HA dialog, click Submit.

3

Your device appears in Home Assistant

After submitting the key, your ESPHome device shows up as a full HA device - with device info, controls (like the display backlight), and diagnostic entities. You can click "Add to dashboard" to put controls on your HA dashboard.

Home Assistant device page showing ESPHome device with Device info, Controls, Diagnostic, and Activity
Your ESP32 is now a Home Assistant device. Every sensor, switch, and light you define in ESPHome YAML automatically appears as an entity in HA. The next pages show you how to wire those entities to your LVGL widgets.
4

Allow the device to perform HA actions

This step is required if you want to control HA entities (lights, switches, etc.) from your display. Without it, homeassistant.service calls will silently fail.

  1. Go to Settings → Devices & Services → ESPHome
  2. Find your device and click the ⚙ gear icon (Configure)
  3. Check "Allow the device to perform Home Assistant actions"
  4. Click Submit
ESPHome integration Options dialog with 'Allow the device to perform Home Assistant actions' checkbox enabled
Skip this and your buttons won't work. If your switch or slider controls a HA entity but nothing happens when you tap - this checkbox is almost certainly the reason.

How it fits together

Home Assistant

Entities · Automations

Native API

ESP32

ESPHome firmware

LVGL

Display

Your designed UI

Now pick an entity scenario

Show a Sensor

5 min

Pull a Home Assistant entity (temperature, humidity, anything) and update an LVGL label or arc with its value.

Control a Light

5 min

Wire an LVGL switch or button to a Home Assistant light. Tap to toggle, with two-way state sync.

Slider Dimmer

5 min

Use an LVGL slider to control brightness - drag to dim, auto-sync when changed externally.

espboards.dev ESPboards.dev ·Made for the ESPHome community

ESPHome LVGL Designer · also known as ESPHome Designer, ESPHome LVGL UI Designer, ESPHome LVGL Editor, LVGL Designer for ESPHome, ESPHome LVGL online editor, and ESPHome LVGL GUI builder. A free online ESP32 LVGL UI editor for the ESPHome community.