2024-11-18 11:58:27 +03:00
2024-11-18 00:57:27 +03:00
2024-11-18 02:06:15 +03:00
2024-11-14 18:24:39 +03:00
2024-11-18 11:58:27 +03:00
2024-11-18 11:10:55 +03:00
2024-11-14 18:56:15 +03:00
2024-11-18 11:19:28 +03:00
2024-11-18 00:57:27 +03:00

🤖 HA text AI Integration for Home Assistant

GitHub release GitHub stars GitHub forks GitHub issues hacs_badge License: MIT

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

  1. Ensure HACS is installed
  2. Search for "HA text AI" in HACS
  3. Click Install
  4. 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 history
  • ha-text-ai.get_history: Retrieve past interactions
  • ha-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:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Submit a pull request

Languages
Python 100%