Compare commits

...

7 Commits

Author SHA1 Message Date
J. Nick Koston
6faed6cd98
Explicitly document ESPHome options flow (#38622) 2025-04-17 22:59:06 -10:00
J. Nick Koston
839e28e04d
Add supported functionality to ESPHome (#38614) 2025-04-17 22:30:30 -10:00
J. Nick Koston
c74127550f
Add troubleshooting section to ESPHome (#38615) 2025-04-17 22:26:22 -10:00
J. Nick Koston
52fa076b93
Add use cases section to ESPHome (#38616) 2025-04-17 22:26:09 -10:00
J. Nick Koston
ac04afa6c3
Add known limitations section to ESPHome (#38618) 2025-04-17 22:22:59 -10:00
J. Nick Koston
8f130abde0
Add supported devices and updating data section to ESPHome (#38613) 2025-04-17 22:22:45 -10:00
J. Nick Koston
fa78a9ca76
Document required manual inputs for ESPHome new entry config flow (#38612) 2025-04-17 22:09:57 -10:00

View File

@ -46,20 +46,109 @@ works_with:
- local
---
## Overview
This integration allows [ESPHome](https://esphome.io) devices to connect directly to Home Assistant with the [native ESPHome API](https://esphome.io/components/api.html).
ESPHome is a firmware generator and configuration system that enables the transformation of microcontrollers into fully customizable smart home devices. Using a simple YAML configuration file, ESPHome allows users to define hardware components like sensors, actuators, and peripherals. These configurations are then compiled into custom firmware that can be flashed onto the target device.
### Key Features
- **YAML Configuration**: Specify hardware components, sensors, actuators, and integrations using a clean and straightforward YAML syntax.
- **Custom Firmware Generation**: ESPHome compiles the provided configuration into a highly optimized, device-specific firmware image that is ready to be flashed onto microcontrollers.
- **Seamless Integration**: After flashing, ESPHome devices can integrate seamlessly with Home Assistant using the ESPHome native API. This documentation page focuses on the [native API](https://esphome.io/components/api.html), which allows devices to communicate directly with Home Assistant for real-time automation and monitoring. For other integrations, such as MQTT or HTTP, please refer to the relevant sections of the [ESPHome documentation](https://esphome.io/).
ESPHome supports a variety of microcontrollers beyond just the ESP family. These include:
- **ESP32**: A powerful microcontroller with Wi-Fi and Bluetooth capabilities.
- **ESP8266**: A low-cost microcontroller with Wi-Fi support.
- **BK72xx**: A series of microcontrollers from Beken, commonly used in smart home applications.
- **RP2040**: A microcontroller developed by Raspberry Pi, known for its flexibility and cost-effectiveness.
- **RTL87xx**: A series of microcontrollers from Realtek, supporting various wireless communication protocols.
For a list of officially supported microcontrollers and devices, refer to the [ESPHome device database](https://devices.esphome.io/). Keep in mind that this database represents only a portion of the ecosystem—many other devices and peripherals are supported but may not appear in the database.
For inspiration and examples of complete, ready-to-use configurations, check out the [ESPHome ready-made projects](https://esphome.io/projects/index.html). These include useful setups like [Bluetooth proxies](https://esphome.io/components/bluetooth_proxy.html), which can expand the [Bluetooth](/integrations/bluetooth/#remote-adapters-bluetooth-proxies) range of Home Assistant.
For detailed information on configuring unsupported or custom devices, consult the official [ESPHome documentation](https://esphome.io/), which provides in-depth guides on expanding and customizing your setup beyond the pre-configured devices.
{% include integrations/config_flow.md %}
### Required manual input
To configure an ESPHome device, enter the following information:
{% configuration_basic %}
host:
description: "IP address or hostname of the ESPHome device. <br> This will be pre-filled if the device was auto-discovered."
port:
description: "Port used by the ESPHome native API (default: 6053). <br> This will be pre-filled if the device was auto-discovered."
noise_psk:
description: "The pre-shared key used for encryption. <br> This is a 32byte base64encoded string. Leave blank if native encryption is not enabled."
password:
description: "Device password (deprecated). <br> Use a Noise PSK (encryption key) instead password support will be removed in a future release."
{% endconfiguration_basic %}
For more information, see the [ESPHome Native API Component documentation](https://esphome.io/components/api.html).
## Removing the integration
This integration follows the standard integration removal process; no extra steps are required.
{% include integrations/remove_device_service.md %}
## Home Assistant actions
ESPHome devices can perform actions to any [Home Assistant action](https://esphome.io/components/api.html#homeassistant-service-action). This functionality is not enabled by default for newly configured device, but can be turned on the options flow on a per device basis.
{% include integrations/option_flow.md %}
These options are disabled by default and not required—only set them if specifically needed.
{% configuration_basic %}
Allow the device to perform Home Assistant actions:
description: "No/Yes <br> When enabled, ESPHome devices can perform Home Assistant actions, such as calling services or sending events. Only enable this if you trust the device."
Subscribe to logs from the device:
description: "No/Yes <br> When enabled, the device will send logs to Home Assistant and you can view them in the logs panel."
{% endconfiguration_basic %}
## Supported devices
The ESPHome integration works with devices that run ESPHome firmware and expose their functionality through the [native ESPHome API](https://esphome.io/components/api.html). This API is designed for tight, efficient integration with Home Assistant, enabling ESPHome devices to push updates directly to Home Assistant in **near real time**.
## Updating data
Rather than polling for sensor values or device states, Home Assistant maintains a persistent connection to each ESPHome device using the native API. This allows state changes—such as a temperature sensor update, a button press, or a binary sensor trigger—to be sent immediately as they happen, reducing latency and improving responsiveness in automations.
### Additional Technical Details
- **Efficient Communication Protocol**: ESPHome uses a lightweight, bi-directional protocol over TCP, optimized for microcontrollers. This protocol is implemented in [aioesphomeapi](https://github.com/esphome/aioesphomeapi), the async Python library used by Home Assistant to handle real-time communication with ESPHome devices. It enables low-latency updates and near instant command execution.
- **Automatic Reconnection**: Home Assistant maintains a persistent connection to each ESPHome device and will automatically attempt to reconnect if the connection is lost. This includes support for "sleepy" or battery-powered devices that periodically wake from deep sleep. When such a device comes online, Home Assistant quickly re-establishes the connection—especially when **mDNS** (Multicast DNS) is available—allowing the device to be discovered and connected without requiring static IPs or manual configuration.
This real-time behavior enables fast, reactive automations and a smooth user experience compared to traditional polling-based integrations.
## Supported Functionality
### Entities
The available entities depend on the components defined in the ESPHome YAML configuration for each device. These entities are exposed through the [Native API Component](https://esphome.io/components/api.html).
### Firing Events on the Home Assistant Event Bus
When using the native API with Home Assistant, you can trigger events on the Home Assistant event bus directly from ESPHome. For more details, see the [homeassistant.event Action](https://esphome.io/components/api.html#homeassistant-event-action).
### Actions
Each device can define Home Assistant Actions based on its ESPHome YAML configuration. For more information, refer to the [Actions](https://esphome.io/components/api.html#actions) section in the [Native API Component](https://esphome.io/components/api.html) documentation.
### Retrieving Data from Home Assistant
ESPHome can retrieve the state of Home Assistant entities using the [Native API](https://esphome.io/components/api.html) with [User-Defined Actions](https://esphome.io/components/api.html#user-defined-actions).
### Home Assistant Actions
ESPHome devices can call any [Home Assistant Action](https://esphome.io/components/api.html#homeassistant-service-action). This feature is not enabled by default for newly added devices but can be enabled through the options flow on a per-device basis.
### Tag Scanning Support
The [Native API Component](https://esphome.io/components/api.html) also supports sending tag scan events to Home Assistant. See the [homeassistant.tag_scanned Action](https://esphome.io/components/api.html#homeassistant-tag-scanned-action) for more information.
## Entity naming and IDs
ESPHome uses different naming and entity ID rules based on the configuration of the ESPHome device. It is recommended to set a `friendly_name` in the ESPHome {% term "`configuration.yaml`" %} to take advantage of the newer naming structure, which is consistent with Home Assistant naming standards and makes it much easier to tell similar devices apart. The legacy naming rules apply when the `friendly_name` is not set in the {% term "`configuration.yaml`" %}.
@ -100,7 +189,22 @@ sensor:
The entity will be named `Temperature` and will default to having an entity_id of `sensor.temperature`.
## Obtaining logs from the device
## Troubleshooting
### Viewing Live Logs
To troubleshoot your ESPHome devices, you can easily view live logs, whether you're using the [**ESPHome Device Builder Add-on**](https://my.home-assistant.io/redirect/supervisor_addon/?addon=5c53de3b_esphome&repository_url=https%3A%2F%2Fgithub.com%2Fesphome%2Fhome-assistant-addon) or the **ESPHome CLI**. The logs contain detailed information such as Wi-Fi connection status, errors, and debug messages, which can help you identify and resolve issues with your device.
#### Using the [**ESPHome Device Builder Add-on**](https://my.home-assistant.io/redirect/supervisor_addon/?addon=5c53de3b_esphome&repository_url=https%3A%2F%2Fgithub.com%2Fesphome%2Fhome-assistant-addon)
1. In the [**ESPHome Device Builder Add-on**](https://my.home-assistant.io/redirect/supervisor_addon/?addon=5c53de3b_esphome&repository_url=https%3A%2F%2Fgithub.com%2Fesphome%2Fhome-assistant-addon) add-on, find the device you're working with.
2. Click the **LOGS** button to open the log view.
#### Using the **ESPHome CLI**
If you're using the **ESPHome CLI**, follow the instructions for the [logs Command](https://esphome.io/guides/cli.html#logs-command) to access the logs.
### Obtaining Logs from the Device
If you want the device to send logs without requiring you to be actively monitoring, follow these steps:
1. To have the device send logs to Home Assistant, in the [options flow](#options), enable `Subscribe to logs from the device`.
- They are logged under the `homeassistant.components.esphome` logger at the equivalent level.
@ -114,3 +218,9 @@ The entity will be named `Temperature` and will default to having an entity_id o
data:
homeassistant.components.esphome: debug
```
## Known Limitations
Each ESPHome device must have a **unique name**. This name is important for mDNS announcements, ensuring that the device can be properly discovered, quickly reconnected when it comes online or wakes from deep sleep (for devices that support deep sleep), and correctly linked to the [**ESPHome Device Builder Add-on**](https://my.home-assistant.io/redirect/supervisor_addon/?addon=5c53de3b_esphome&repository_url=https%3A%2F%2Fgithub.com%2Fesphome%2Fhome-assistant-addon). It's also crucial for **DHCP discovery** if mDNS is not available.
Using duplicate names can lead to connection issues, failed discovery, and unexpected behavior with both the integration and the add-on.