A powerful Home Assistant custom integration that connects your Home Assistant instance with multiple AI providers (OpenAI, Google Gemini, Anthropic (Claude), OpenRouter, and Llama) to translate user requests into valid Home Assistant operations, including creating automations automatically!
Click the button above to install AI Agent HA directly through HACS, or see the detailed installation instructions below.
If you find this integration helpful and would like to support its development, you can buy me a coffee! Your support helps keep this project active and maintained. Currently I am the only Dev on that project and looking to have more paretners here.
Every contribution, no matter how small, is greatly appreciated and helps fund the continued development and improvement of AI Agent HA.
Another way to support me will be to try my new project. Askie - AI for kids. I am looking for feedback on this one: โ Web: https://kidsai.app โข โ iOS: https://apps.apple.com/app/id6749299565 โ Android: https://play.google.com/store/apps/details?id=com.askie.app
- ๐ค Multiple AI Provider Support: OpenAI, Google Gemini, Anthropic (Claude), OpenRouter, and Llama
- ๐ฏ Model Selection: Choose from predefined models or use custom model names
- ๐ Smart Home Control: Turn lights on/off, control climate, and manage devices
- โก Automation Creation: Automatically create automations based on natural language
- ๐ Dashboard Creation: Create and customize Home Assistant dashboards through natural language
- ๐ Data Access: Get entity states, history, weather, and more
- ๐ Secure: API keys stored securely in Home Assistant
- ๐จ Beautiful UI: Clean, modern chat interface
- ๐ Real-time: Instant responses and updates
AI Agent HA now supports creating and managing Home Assistant dashboards through natural language conversations! Simply describe what you want, and the AI will create a complete dashboard for you.
- Natural Language Request: Ask the AI to create a dashboard for any purpose
- Entity Discovery: The AI automatically finds relevant entities in your Home Assistant
- Smart Organization: Entities are organized by room, functionality, or domain
- Dashboard Generation: Complete dashboard with proper cards and layout is created
- Integration: Dashboard is automatically added to your Home Assistant sidebar
- Restart Required: You'll need to restart Home Assistant to see the new dashboard in your sidebar
"Create a dashboard for my living room lights"
The AI will find all living room light entities and create a dashboard with appropriate light control cards.
"Create a security dashboard with all door sensors, cameras, and alarm controls"
The AI will create a comprehensive security monitoring dashboard with sensor states, camera feeds, and alarm controls. After creation, restart Home Assistant to see the new dashboard in your sidebar.
"I want an energy dashboard showing power consumption and usage graphs"
The AI will create an energy monitoring dashboard with real-time power gauges, usage graphs, and cost tracking.
"Create a climate dashboard for temperature control throughout the house"
The AI will organize thermostats, temperature sensors, and HVAC controls in a logical layout.
- Smart Card Selection: Appropriate card types for each entity (lights, sensors, media players, etc.)
- Room-Based Organization: Entities automatically grouped by area when possible
- Interactive Clarification: AI asks follow-up questions to refine your requirements
- Template-Based Creation: Built-in templates for common dashboard types (security, energy, climate, etc.)
- Dynamic Layout: Optimized card arrangements and view organization
- Icon Integration: Automatic Material Design icon selection
- Room-Specific: Living room, bedroom, kitchen, etc.
- Functional: Security, energy, climate, media, lighting
- Device-Specific: All lights, all sensors, all switches
- Scenario-Based: Morning routine, evening security, vacation mode
- Custom: Any combination based on your specific needs
For detailed dashboard creation documentation, see: Dashboard Creation Guide
- Models: GPT-3.5 Turbo, GPT-4, GPT-4 Turbo, GPT-4o, GPT-5, O1-Preview, O1-Mini
- Setup: Get API key from OpenAI Platform
- Models: Gemini 1.5 Flash, Gemini 1.5 Pro, Gemini 1.0 Pro, Gemini 2.0 Flash Exp
- Setup: Get API key from Google AI Studio
- Models: Claude 3.5 Sonnet, Claude 3.5 Haiku, Claude 3 Opus, Claude 3 Sonnet, Claude 3 Haiku
- Setup: Get API key from Anthropic Console
- Popular Models:
claude-3-5-sonnet-20241022(Latest and most capable)claude-3-5-haiku-20241022(Fast and efficient)claude-3-opus-20240229(Most powerful for complex tasks)
- Models: Access to 100+ models including Claude, Llama, Mistral, and more
- Setup: Get API key from OpenRouter
- Popular Models:
anthropic/claude-3.5-sonnetmeta-llama/llama-3.1-70b-instructmistralai/mixtral-8x7b-instruct
- Models: Llama 4 Maverick, Llama 3.1, Llama 3.2
- Setup: Get API key from your Llama provider
Use the Quick Install button at the top of this README for the easiest installation, or manually add the repository:
- Open HACS in your Home Assistant instance
- Click on "Integrations"
- Click the three dots in the top right corner
- Select "Custom repositories"
- Add this repository:
https://github.com/sbenodiz/ai_agent_ha - Select "Integration" as the category
- Click "Add"
- Find "AI Agent HA" in the integration list
- Click "Download"
- Restart Home Assistant
- Go to Settings โ Devices & Services โ Add Integration
- Search for "AI Agent HA"
- Follow the setup wizard to configure your preferred AI provider
- Download the latest release from the releases page
- Extract the files
- Copy the
custom_components/ai_agent_hafolder to your Home Assistantcustom_componentsdirectory - Restart Home Assistant
- Go to Settings โ Devices & Services โ Add Integration
- Search for "AI Agent HA"
- Follow the setup wizard to configure your preferred AI provider
The integration uses a two-step configuration process:
Select your preferred AI provider from the dropdown:
- OpenAI
- Google Gemini
- Anthropic (Claude)
- OpenRouter
- Llama
Enter your API credentials and optionally select a model:
- API Key/Token: Your provider-specific API key
- Model: Choose from predefined models or enter a custom model name
# Example configuration.yaml (optional - integration supports config flow only)
ai_agent_ha:
ai_provider: anthropic
anthropic_token: "sk-ant-..."
models:
anthropic: "claude-3-5-sonnet-20241022"Access the beautiful chat interface at:
- Sidebar: AI Agent HA panel
- URL:
http://your-ha-instance:8123/ai_agent_ha
Enter any model name in the "Custom Model" field:
- OpenAI:
gpt-4-0125-preview - Anthropic:
claude-3-opus-20240229 - OpenRouter:
anthropic/claude-3-opus - Gemini:
gemini-pro-vision
The AI can create automations automatically:
- Ask: "Create an automation to turn on lights at sunset"
- Review the generated automation
- Approve or reject the suggestion
- Automation is added to your Home Assistant
The AI can create custom dashboards through conversation:
- Ask: "Create a security dashboard with cameras and sensors"
- AI discovers relevant entities and asks clarifying questions
- Dashboard is generated with appropriate cards and layout
- Dashboard is automatically added to your Home Assistant sidebar
- Restart Home Assistant to see the new dashboard
The AI can access comprehensive Home Assistant data:
- Entity states and history
- Weather information
- Person locations
- Device registry
- Area/room information
- Statistics and analytics
We welcome contributions from the community! Whether you're fixing bugs, adding features, or improving documentation, your help is appreciated.
Please check out our contribution guidelines for detailed information on how to contribute to this project.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For security issues, please review our security policy.
You can test the frontend UI locally without deploying to Home Assistant:
-
Start the local test server:
cd tests/frontend python3 serve.py -
Open your browser: Navigate to
http://localhost:8000/test_panel.html -
Test the interface: The test page provides a mock Home Assistant environment where you can test UI changes, styling, and component behavior without needing a full Home Assistant installation.
Test files location:
tests/frontend/test_panel.html- Standalone test pagetests/frontend/serve.py- Simple HTTP server for testing
This is particularly useful for:
- Testing CSS changes and styling
- Verifying UI layout and responsiveness
- Debugging frontend JavaScript issues
- Quick iteration on visual changes
This project uses GitHub Actions to ensure code quality and reliability:
- Quality Checks: Runs all checks in a single workflow (Python 3.12)
- Python Linting: Checks code style with flake8, black, and isort
- Python Type Checking: Verifies typing with mypy (Python 3.12 compatibility)
- Python Tests: Runs tests with pytest (Python 3.12)
- Security Scan: Checks for security vulnerabilities with Bandit
- Home Assistant Validation: Validates the integration with hassfest
- HACS Validation: Ensures compatibility with HACS
All workflows run automatically on push and pull requests using Python 3.12 to ensure compatibility with the latest Home Assistant versions. You can also run them manually via the "Actions" tab in the GitHub repository.
The integration provides these main components:
- AI Clients: Modular providers (OpenAI, Gemini, Claude, OpenRouter, Llama)
- Agent: Core logic for processing requests
- Config Flow: Setup and options management
- Frontend: Chat interface
- Dashboard Templates: Templates for dashboard creation
- Home Assistant 2023.3+
- Python 3.12+ (required for compatibility with Home Assistant 2025.1.x+)
- One of the supported AI provider API keys
Important: Starting with version 0.99.3, this integration requires Python 3.12 or later. This change was made to ensure compatibility with Home Assistant 2025.1.x and later versions, which use syntax features only available in Python 3.12+.
If you're running an older Home Assistant version with Python 3.11, please use version 0.99.2 or earlier of this integration.
- API keys are stored securely in Home Assistant's encrypted storage
- All communication uses HTTPS
- No data is stored outside your Home Assistant instance
- Provider-specific security practices are followed
This project is licensed under the MIT License - see the LICENSE file for details.
- Troubleshooting: Troubleshooting Guide - Common issues and solutions
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Wiki
- Home Assistant community for the excellent platform
- All AI providers for their powerful APIs
- Special thanks to @RmG152 for their valuable help with development
- Contributors and testers who help improve this integration
Made with โค๏ธ for the Home Assistant community
