mirror of
https://github.com/esphome/esphome.git
synced 2026-09-27 23:10:21 +00:00
This adds the ability for ESPHome-defined actions (services) to send
responses back to Home Assistant. This is the complement to the existing
feature that allows ESPHome to receive responses from HA actions.
New features:
- ExecuteServiceResponse protobuf message (ID 131) for sending responses
- call_id field in ExecuteServiceRequest for tracking service calls
- api.respond action for sending responses from YAML automations
- Support for JSON response data via data: lambda
Example usage:
```yaml
api:
actions:
- action: get_sensor_value
variables:
sensor_name: string
then:
- api.respond:
data: |-
root["value"] = id(my_sensor).state;
root["unit"] = "°C";
```
Note: This requires corresponding changes in aioesphomeapi and
home-assistant/core to handle the new messages.