Skip to main content
Config entries are the modern way to configure integrations in Home Assistant. They provide a user-friendly UI for setting up and managing integrations, replacing the older YAML-based configuration.

Overview

A config entry consists of:
  • Config Flow: Handles the setup process through the UI
  • Config Entry: Stores the configuration data
  • Options Flow: Allows users to modify settings after setup

Config Entry Basics

The ConfigEntry Object

A ConfigEntry object stores configuration data and has several key properties:

Config Entry States

Config entries have different states:

Implementing a Config Flow

The config flow is the UI wizard that guides users through setting up your integration.

Basic Config Flow

config_flow.py

Config Flow Steps

Each step in the config flow is a method named async_step_<step_name>. Common steps include:
  • async_step_user: Initial user-initiated setup
  • async_step_import: Import from YAML configuration
  • async_step_discovery: Handle discovered devices
  • async_step_zeroconf: Handle Zeroconf/mDNS discovery
  • async_step_bluetooth: Handle Bluetooth discovery

Multi-Step Config Flows

For complex setups, you can chain multiple steps:

Discovery Flows

Integrations can be automatically discovered through various methods:

Zeroconf Discovery

Declare Zeroconf discovery in your manifest:
manifest.json

Bluetooth Discovery

Options Flow

Options flows allow users to modify integration settings after initial setup:

Handling Config Entry Updates

You can listen for config entry changes:
__init__.py

Reauthentication Flow

If credentials expire, trigger a reauth flow:

Reconfigure Flow

Allow users to reconfigure an existing entry:

Translations

Provide translations for your config flow in strings.json:
strings.json

Best Practices

Use Unique IDs

Always set a unique ID to prevent duplicate entries:

Validate Early

Validate user input as soon as possible to provide quick feedback.

Handle Errors Gracefully

Provide clear error messages for common failure scenarios.

Update Existing Entries

When rediscovering a device, update the existing entry:

Store Minimal Data

Only store essential configuration in data. Use runtime_data for temporary data.

Common Patterns

Single Config Entry

Prevent multiple config entries:
Or use in manifest:

Selectors

Use modern selectors for better UX:

Next Steps