A Home Assistant custom component that integrates Anthropic Claude with Home Assistant, allowing you to use Claude as a voice assistant with your API key.
- Python 3.13 Compatibility: Fixed syntax error in conversation_agent.py that was causing issues with Python 3.13
- Improved Multilingual Support: Enhanced language handling to properly switch between languages
- Translation System Fixes: Improved how translations are loaded and fallbacks are handled
- Code Structure Improvements: Fixed indentation issues in the _async_generate_prompt method
- Enhanced Error Handling: Improved stability with robust error handling throughout the integration
- Fixed Critical Issues: Resolved issues with entity state processing that could cause conversation failures
- Brightness Attribute Fix: Fixed error when processing light entities with null brightness values
- Translation System Improvements: Added caching and better error handling for translations
- Overall Stability Improvements: Made the integration more resilient to unexpected conditions
- Multilingual Support: Automatically adapts to your Home Assistant interface language (English and Russian supported)
- Use Anthropic Claude as a conversation agent in Home Assistant
- Control your Home Assistant devices using natural language
- Configure Claude's behavior with custom instructions
- Choose from different Claude models (Claude 3 Opus, Sonnet, Haiku, and Claude 3.5 Sonnet)
- Adjust parameters like temperature and max tokens
- Direct API Integration: Uses direct HTTP requests to the Anthropic API for better compatibility
- Make sure you have HACS installed
- Go to HACS > Integrations
- Click the three dots in the top right corner and select "Custom repositories"
- Add this repository URL:
https://github.com/slawa19/anthropic-hass-api - Select "Integration" as the category
- Click "ADD"
- Search for "Anthropic" in the integrations tab
- Click "Install"
- Restart Home Assistant
- Download or clone this repository
- Copy the
custom_components/anthropicdirectory to your Home Assistantcustom_componentsdirectory - Restart Home Assistant
- Go to Settings > Devices & Services
- Click "Add Integration"
- Search for "Anthropic"
- Follow the configuration steps:
- Enter your Anthropic API key (get one at https://console.anthropic.com/settings/keys)
- Configure options like instructions, model, and parameters
This integration requires an Anthropic API key. To get one:
- Sign up or log in at Anthropic Console
- Enable billing with a valid credit card on the plans page
- Visit the API Keys page to generate an API key
Note: This is a paid service. Monitor your costs in the Anthropic portal.
This integration uses the official Anthropic API. Please note that the Anthropic API is intended for B2B and not for individual use, more info here. Therefore, this integration is intended for commercial uses.
Once configured, you can interact with Claude through:
- The conversation panel in Home Assistant
- Voice assistants that use Home Assistant's conversation agent
- The conversation.process service
Claude can only control or provide information about entities that are exposed to it. To manage which entities Claude can access:
- Go to Settings > Voice Assistants
- Select the "Exposed Entities" tab
- Toggle entities you want Claude to be able to control
- Custom Instructions for Claude: Instructions for the AI on how it should respond to your requests
- Allow Claude to Control Home Assistant: Enable/disable Claude's ability to control your devices
- Use Recommended Model & Settings: Quickly set up with optimal defaults or customize advanced settings
- Claude Model: Choose between different Claude models (when recommended settings are disabled)
- Maximum Response Length: Control how verbose Claude's responses are (when recommended settings are disabled)
- Response Creativity: Adjust the balance between focused/deterministic and creative/varied responses (when recommended settings are disabled)
The integration automatically adapts to your Home Assistant interface language:
- If your Home Assistant interface is set to English, the integration will display in English
- If your Home Assistant interface is set to Russian, the integration will display in Russian
- For other languages, English will be used as the default
To upload this project to your GitHub repository:
- Create a new repository on GitHub at https://github.com/slawa19/anthropic-hass-api
- Initialize a git repository in the project directory:
git init git add . git commit -m "Initial commit" git branch -M main git remote add origin https://github.com/slawa19/anthropic-hass-api.git git push -u origin main
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.