Skip to main content
Native functions are built-in capabilities provided directly by the Extended OpenAI Conversation component. These functions are implemented in Python and offer core functionality.

Available Native Functions

execute_service

Call any Home Assistant service with specified parameters.
string
required
The domain of the service (e.g., light, switch, climate)
string
required
The service to call (e.g., turn_on, turn_off, set_temperature)
object
required
Service data object with the following properties:
  • entity_id (string): Target entity ID
  • device_id (string): Target device ID (optional)
  • area_id (string): Target area ID (optional)
Control Home Assistant devices and services:

add_automation

Create Home Assistant automations dynamically through conversation.
Before using this function, set up notifications for the automation_registered_via_extended_openai_conversation event. Automations can be created even if the conversation fails to get a response.
string
required
Automation configuration in valid YAML format. Newline characters should be \n.
  1. Create a separate assistant for automation creation to avoid accidental automation registration
  2. Set up event notifications to monitor created automations
  3. Review automations before enabling them in production
Create Separate Assistant
Create Assistant
Notify on Created
Notification Setup
English Configuration:
Korean Configuration:For Korean language, use \\n instead of \n for newline characters:
Automation Example

get_history

Retrieve historical state data for specified entities.
array
required
List of entity IDs to retrieve history for
string
Start of the history period in %Y-%m-%dT%H:%M:%S%z format. Defaults to 1 day before the request time.
string
End of the history period in %Y-%m-%dT%H:%M:%S%z format. Defaults to current time.
boolean
Only return last_changed and state for non-first/last states. Default: true
boolean
Skip returning attributes from the database. Default: true
boolean
Only return significant state changes. Default: true
Retrieve historical state data for entities. For advanced formatting with templates, see the composite function example.
History Example

get_energy

Retrieve energy configuration and preferences from Home Assistant’s energy management system.
This function returns the energy dashboard configuration including solar, grid, battery, and gas sources. No parameters required.
Retrieve energy management configuration:

get_statistics

Retrieve statistical data for specified entities over a time period.
array
List of statistic IDs to retrieve data for
string
required
Start of the statistics period in %Y-%m-%dT%H:%M:%S%z format
string
required
End of the statistics period in %Y-%m-%dT%H:%M:%S%z format
string
Aggregation period. Options: 5minute, hour, day, month. Default: day
object
Unit conversion configuration (optional)
array
Types of statistics to return. Default: ["change"]
Retrieve statistical data for energy consumption or other long-term statistics:

Use Cases

Control Devices

Use execute_service to control lights, switches, and other devices

Create Automations

Use add_automation to create automations through conversation

Analyze History

Use get_history to analyze entity state changes over time

Energy Monitoring

Use get_energy to retrieve energy dashboard configuration

Statistical Analysis

Use get_statistics for long-term statistical data and trends

Monitor Events

Combine functions to create monitoring and notification workflows

Next Steps

Template Functions

Dynamic templates

Script Functions

Service sequences

Composite Functions

Chain functions