mirror of
https://github.com/smkrv/ha-text-ai.git
synced 2026-07-22 07:03:58 +08:00
2.0 KiB
2.0 KiB
HA text AI
This is a Home Assistant custom integration that allows you to interact with OpenAI's API and compatible endpoints to generate AI responses.
Features
- Configure all settings through the Home Assistant UI
- Support for OpenAI API and compatible endpoints
- Configurable parameters (temperature, max tokens, etc.)
- Request queue system to prevent API rate limiting
- Long response storage
- Multiple parallel questions support
- Real-time updates
Installation
HACS Installation
- Go to HACS in your Home Assistant installation
- Click on "Integrations"
- Click the "+" button
- Search for "HA text AI"
- Click "Install"
- Restart Home Assistant
Manual Installation
- Copy the
custom_components/ha_text_aidirectory to your Home Assistant'scustom_componentsdirectory - Restart Home Assistant
Configuration
- Go to Configuration -> Integrations
- Click "+" to add a new integration
- Search for "HA text AI"
- Enter your OpenAI API key and configure other settings
Usage
Service Calls
You can use the ha_text_ai.ask_question service to ask questions:
service: ha_text_ai.ask_question
data:
question: "What is the weather like today?"
Automation Example
automation:
- alias: "Daily Weather Question"
trigger:
platform: time
at: "07:00:00"
action:
- service: ha_text_ai.ask_question
data:
question: "What's the weather forecast for today?"
Configuration Options
| Option | Description | Default |
|---|---|---|
api_key |
Your OpenAI API key | Required |
model |
The AI model to use | gpt-3.5-turbo |
temperature |
Response randomness (0-1) | 0.7 |
max_tokens |
Maximum response length | 1000 |
api_endpoint |
Custom API endpoint | https://api.openai.com/v1 |
request_interval |
Minimum time between requests | 1.0 |
Support
For bugs and feature requests, please create an issue on GitHub.
License
This project is licensed under the MIT License.