Configuration
array
required
List of service calls to execute in order
Basic Examples
Add Item to Shopping Cart
Send Notification
Advanced Examples
Get Calendar Events
Useresponse_variable to pass service results back to the AI:
Set
response_variable: _function_result to return the service response to the AI.Play YouTube on TV
Chain multiple service calls with delays:Play Netflix on TV
Get Weather Forecasts
Script Features
Service Targeting
Service Targeting
Target entities, devices, or areas:
Delays
Delays
Add delays between service calls:
Response Variables
Response Variables
Capture service responses:The response is passed back to the AI as the function result.
Templates in Data
Templates in Data
Use Jinja2 templates in service data:
Use Cases
Multi-step Actions
Execute sequences of services in order
Data Retrieval
Call services and return responses to AI
Media Control
Control media players with complex payloads
Notifications
Send messages through various notification services
Best Practices
1
Use response_variable for data
When you need the AI to process service results, always set
response_variable: _function_result2
Add delays when needed
Some devices need time to process commands. Add appropriate delays between service calls.
3
Target correctly
Use the most appropriate targeting method:
entity_idfor specific entitiesdevice_idfor all entities of a devicearea_idfor all entities in an area
4
Keep sequences focused
Each function should accomplish one logical task. For complex workflows, use composite functions.
Next Steps
REST Functions
Fetch external data
Composite Functions
Chain multiple functions
Script Integration
Home Assistant scripts