An integration for Home Assistant that leverages AI models to analyze your entities and suggest potential automations. Now supporting multiple providers including OpenAI, Google, and local models for enhanced privacy.
If you find this project helpful and would like to support its development, you can buy me a coffee!
Your support is greatly appreciated and helps maintain and improve this project!
- Background and Purpose
- Features
- Prerequisites
- Installation
- Configuration
- Usage
- Sensors
- Important Notes
- Troubleshooting
- Roadmap
- License
- Acknowledgments
- Contributions
- Disclaimer
- Support the Project
- Additional Information
- Frequently Asked Questions (FAQ)
Managing and automating devices in a smart home can be complex, especially as the number of devices grows. The AI Automation Suggester integration aims to simplify this process by leveraging AI models to analyze your entities in Home Assistant and provide intelligent automation suggestions.
- Automatic Automation Suggestions: Receive AI-generated automation ideas whenever new entities are added to your Home Assistant instance.
- Manual Analysis Trigger: Allows you to manually trigger the AI analysis at any time, providing flexibility and control.
- Supports Multiple AI Providers: Choose from a variety of AI models including OpenAI, Anthropic, Google, Groq, and local models like LocalAI and Ollama for privacy-focused users.
- Customizable Prompts: Override the default system prompt to tailor the suggestions to your specific needs.
- Custom LLM Variants: Users can select their preferred AI model variant, such as OpenAI's
gpt-3.5-turbo
. - Persistent Notifications: Suggestions are delivered via Home Assistant's persistent notifications.
- Sensor Entities: Provides sensors to display the status of suggestions and provider connection status.
- German Translation: Added support for German language to reach a global audience.
- Home Assistant: Version 2023.5 or later.
- API Keys: Depending on the provider you choose, you may need API keys for OpenAI, Anthropic, Google, or Groq.
- Local AI Setup: For LocalAI and Ollama, you need to have the respective servers running on your local network.
The easiest way to install the AI Automation Suggester is through HACS (Home Assistant Community Store).
If you haven't installed HACS yet, follow the official installation guide to set it up.
-
Open your Home Assistant instance.
-
Navigate to HACS in the sidebar.
-
Click on the Integrations tab.
-
Click on the three-dot menu (â‹®) in the top right corner.
-
Select Custom repositories.
-
In the Add custom repository URL field, enter:
https://github.com/ITSpecialist111/ai_automation_suggester
-
In the Category dropdown, select Integration.
-
Click Add.
- After adding the repository, search for AI Automation Suggester in HACS.
- Click on the integration to view details.
- Click Download to install the integration.
After installation, you need to restart Home Assistant for the integration to be recognized.
- Go to Settings > System > Restart.
- Click Restart and wait for Home Assistant to restart.
If you prefer to install the integration manually, follow these steps:
-
Download the Integration
- Clone or download the
ai_automation_suggester
repository from GitHub.
- Clone or download the
-
Copy to Home Assistant
-
Place the
ai_automation_suggester
directory inside thecustom_components
directory of your Home Assistant configuration folder. -
Your directory structure should look like this:
└── config/ ├── configuration.yaml └── custom_components/ └── ai_automation_suggester/ ├── __init__.py ├── config_flow.py ├── const.py ├── coordinator.py ├── manifest.json ├── sensor.py ├── services.yaml ├── strings.json └── translations/ ├── en.json └── de.json
-
If the
custom_components
directory doesn't exist, create it.
-
-
Restart Home Assistant
- After copying the files, restart Home Assistant to recognize the new integration.
- Navigate to Settings > Devices & Services.
- Click on Add Integration.
- Search for AI Automation Suggester and select it.
- Provider: Choose your preferred AI provider from the list (OpenAI, Anthropic, Google, Groq, LocalAI, Ollama, or Custom OpenAI).
- API Key or Server Details: Depending on the provider, you may need to enter an API key or provide server details for local models.
- Model Selection: Choose the AI model variant you wish to use (e.g., OpenAI's
gpt-3.5-turbo
). - Maximum Output Tokens: Controls the length of the AI's response (default is 500). Increase if you need longer responses.
- Custom System Prompt: (Optional) Override the built-in system prompt with your own for more granular control.
- OpenAI: Obtain an API key from the OpenAI Dashboard.
- Anthropic: Sign up for an API key at Anthropic.
- Google: Get an API key from the Google Cloud Console.
- Groq: Register and obtain an API key from Groq.
- LocalAI/Ollama: Set up the respective servers on your local network.
Once configured, the integration will automatically generate automation suggestions when new entities are added to your Home Assistant instance. Suggestions are sent as persistent notifications.
You can manually trigger the AI analysis at any time:
- Go to Developer Tools > Services.
- Select
ai_automation_suggester.generate_suggestions
from the list. - In the service data, you can specify:
- Provider Configuration: If you have multiple providers configured, select which one to use.
- Custom Prompt: Provide a custom prompt to tailor the suggestions.
- Click Call Service.
- Review the suggestions provided in the persistent notifications.
- Implement the automations that suit your needs.
The integration provides two sensors:
- AI Automation Suggestions: Displays the status of suggestions and stores the latest suggestions in its attributes.
- AI Provider Status: Shows the connection status of the AI provider.
You can display the suggestions on your dashboard using an Entities card:
type: entities
entities:
- entity: sensor.ai_automation_suggestions
- entity: sensor.ai_provider_status
- Do Not Share Your API Keys: Keep your API keys confidential.
- Revoking Compromised Keys: If you suspect your API key has been compromised, revoke it immediately and generate a new one.
- Costs: Using AI provider APIs may incur costs. Monitor your usage in your provider's dashboard.
- Usage Limits: Set usage limits in your account to avoid unexpected charges.
- Home Assistant Version: Ensure you are running Home Assistant version 2023.5 or later.
- Local AI Models: If using local models, ensure your local servers are correctly set up and accessible.
- Data Sent to AI Providers: The integration sends entity information to the selected AI provider's API for analysis.
- User Consent: By using this integration, you consent to this data being sent to the chosen AI provider.
-
API Errors
- Symptom: Error messages related to AI provider APIs in notifications or logs.
- Solution:
- Verify your API key or server details are correct.
- Ensure your API key has not expired or been revoked.
- Check your account for any usage limits or account issues.
- If using local models, ensure the server is running and accessible.
-
Integration Not Showing Up
- Symptom: After installation, the integration doesn't appear in Home Assistant.
- Solution:
- Ensure the
ai_automation_suggester
directory is in the correct location. - Restart Home Assistant after adding the custom component.
- Check the logs for any errors during startup.
- Ensure the
-
No Suggestions Generated
- Symptom: The integration doesn't generate any suggestions.
- Solution:
- Ensure new entities have been added to trigger automatic suggestions.
- Manually trigger the service
ai_automation_suggester.generate_suggestions
. - Check if you have provided the necessary service data.
- Review logs for any errors during the analysis.
-
Dependency Issues
- Symptom: Errors related to missing dependencies or incorrect versions.
- Solution:
- Ensure all required libraries are installed.
- Clear Home Assistant's cache by deleting the
deps
directory and restart.
-
Enable debug logging for more detailed information:
logger: default: warning logs: custom_components.ai_automation_suggester: debug
-
View logs under Settings > System > Logs.
-
Interactive Suggestion Management
- User Feedback Mechanism: Allow users to provide feedback on suggestions to improve future results.
- Detailed Implementation Guides: Provide step-by-step instructions for implementing suggested automations.
-
Automated Automation Creation
- One-Click Deployment: Enable users to automatically implement suggested automations.
- Safety Measures: Implement safeguards to ensure automations are created securely.
-
Enhanced Localization
- Additional Language Support: Expand language support beyond English and German.
- Community Translations: Collaborate with the community for translations and localization efforts.
-
Community Integration Sharing
- Platform for Sharing: Allow users to share their automations and suggestions with the community.
- Moderation and Quality Control: Implement mechanisms to ensure shared content is valuable and safe.
This project is licensed under the MIT License - see the LICENSE file for details.
- Home Assistant Community: For providing an amazing platform and community support.
- AI Providers: OpenAI, Anthropic, Google, Groq, LocalAI, and Ollama for their AI models and APIs.
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This integration is a third-party custom component and is not affiliated with or endorsed by Home Assistant or any of the AI providers.
If you find this project helpful and would like to support its development, you can buy me a coffee!
Your support is greatly appreciated and helps maintain and improve this project!
For any questions or support, please open an issue on GitHub.
- If installed via HACS, you can update the integration through the HACS interface:
- Navigate to HACS > Integrations.
- Find AI Automation Suggester in the list.
- If an update is available, click Update.
- Yes, if you choose to use local AI models like LocalAI or Ollama, you do not need an external API key. However, you need to have the local servers set up and running.
- The integration sends entity information to the selected AI provider's API for analysis. If you use local models, your data remains within your local network. For cloud providers, you should review their privacy policies to understand how your data is handled.
- Please open an issue on the GitHub repository with details about the bug or your feature request.
- We welcome community contributions for translations. Please submit a pull request with the new language files in the
translations
directory.
- The integration monitors for new entities added to your Home Assistant instance. When new entities are detected, it automatically generates automation suggestions using the configured AI provider.
Feel free to reach out if you need further assistance or have any other questions!