mirror of
https://github.com/smkrv/ha-text-ai.git
synced 2026-07-22 07:03:58 +08:00
34bfd7dfe1237ab04adcfb18ba42a73ae3b6d84c
🤖 HA text AI Integration for Home Assistant
Powerful OpenAI integration for Home Assistant enabling natural language interaction with your smart home
📋 Table of Contents
✨ Features
- 🔄 Real-time AI Interaction: Seamless communication with OpenAI's latest models
- 📝 Conversation History: Track and manage your AI interactions
- ⚙️ Customizable Settings: Fine-tune AI behavior with adjustable parameters
- 🔌 Easy Integration: Simple setup process through HACS or manual installation
- 🎯 System Prompts: Set context for more relevant AI responses
🚀 Installation
HACS Installation (Recommended)
- Ensure HACS is installed
- Search for "HA text AI" in HACS
- Click Install
- Restart Home Assistant
Manual Installation Steps
# 1. Navigate to your Home Assistant configuration directory
cd ~/.homeassistant
# 2. Create custom_components directory if it doesn't exist
mkdir -p custom_components
# 3. Clone the repository
git clone https://github.com/smkrv/ha-text-ai.git custom_components/ha_text_ai
# 4. Restart Home Assistant
⚙️ Configuration
Basic Configuration
ha_text_ai:
api_key: your_openai_api_key
model: gpt-3.5-turbo
Advanced Configuration
ha_text_ai:
api_key: your_openai_api_key
model: gpt-4
temperature: 0.8
max_tokens: 2000
api_endpoint: https://custom-endpoint.com/v1
request_interval: 2.0
🛠 Services
Ask Question
service: ha_text_ai.ask_question
data:
question: "What's the weather like today?"
model: "gpt-4" # optional
temperature: 0.7 # optional
More Services
ha_text_ai.clear_history: Reset conversation historyha_text_ai.get_history: Retrieve past interactionsha_text_ai.set_system_prompt: Configure AI behavior
🔍 Advanced Usage
Automation Example
automation:
trigger:
platform: state
entity_id: binary_sensor.motion
to: 'on'
action:
service: ha_text_ai.ask_question
data:
question: "What should I do when motion is detected?"
🔧 Troubleshooting
Common Issues and Solutions
API Key Issues
- Verify API key format
- Check API key permissions
- Ensure proper configuration in secrets.yaml
Connection Problems
- Verify internet connection
- Check API endpoint accessibility
- Review Home Assistant logs
👥 Contributing
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Submit a pull request
Languages
Python
100%