ITSpecialist111 / ai_automation_suggester

This custom Home Assistant integration periodically scans entities, detects new devices, and uses AI (via OpenAI's API) to suggest automations. It provides a user-friendly interface for accepting or rejecting automations, with placeholder entity mapping for privacy. This aims to enhance smart home automation via AI to identify new automations.
MIT License
7 stars 0 forks source link
ai automatic-suggestions automations builder-design-pattern home-assistant suggester

AI Automation Suggester

Validate with hassfest HACS Validation GitHub release (latest by date) hacs_badge

An integration for Home Assistant that uses OpenAI's GPT models to analyze your newly added entities and suggest potential automations.


Support the Project

If you find this project helpful and would like to support its development, you can buy me a coffee!

Buy Me A Coffee

Your support is greatly appreciated and helps maintain and improve this project!


Table of Contents


Background and Purpose

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 OpenAI's GPT models to analyze newly added entities in your Home Assistant setup and provide intelligent automation suggestions.


Features


Prerequisites


Installation

Installing via HACS (Recommended)

The easiest way to install the AI Automation Suggester is through HACS (Home Assistant Community Store).

Step 1: Install HACS

If you haven't installed HACS yet, follow the official installation guide to set it up.

Step 2: Add Custom Repository

  1. Open your Home Assistant instance.

  2. Navigate to HACS in the sidebar.

  3. Click on the Integrations tab.

  4. Click on the three-dot menu (⋮) in the top right corner.

  5. Select Custom repositories.

    Custom Repositories

  6. In the Add custom repository URL field, enter:

    https://github.com/ITSpecialist111/ai_automation_suggester
  7. In the Category dropdown, select Integration.

  8. Click Add.

Step 3: Install the Integration

  1. After adding the repository, search for AI Automation Suggester in HACS.
  2. Click on the integration to view details.
  3. Click Download to install the integration.

Step 4: Restart Home Assistant

After installation, you need to restart Home Assistant for the integration to be recognized.

  1. Go to Settings > System > Restart.
  2. Click Restart and wait for Home Assistant to restart.

Manual Installation

If you prefer to install the integration manually, follow these steps:

  1. Download the Integration

    • Clone or download the ai_automation_suggester repository from GitHub.
  2. Copy to Home Assistant

    • Place the ai_suggester directory inside the custom_components directory of your Home Assistant configuration folder.

    • Your directory structure should look like this:

      └── config/
       ├── configuration.yaml
       └── custom_components/
           └── ai_suggester/
               ├── __init__.py
               ├── config_flow.py
               ├── const.py
               ├── coordinator.py
               ├── manifest.json
               ├── sensor.py
               ├── services.yaml
               ├── strings.json
               └── translations/
                   └── en.json
    • If the custom_components directory doesn't exist, create it.

  3. Restart Home Assistant

    • After copying the files, restart Home Assistant to recognize the new integration.

Configuration

1. Add the Integration via Home Assistant UI

2. Configure the Integration

3. Obtain an OpenAI API Key


Known Issues

1. Generic Suggestions on Initial Setup

After the initial setup of the integration, the suggester will create a new persistent notification in Home Assistant. The initial suggestions are a generic list; however, you can manually trigger new suggestions that will look at your specific entities (or wait for the schedule to run).

You can manually trigger this by going to Developer Tools -> Actions -> AI Automation Suggester: Generate Suggestions -> Perform Action.


Usage

1. Automatic Suggestions

2. Manual Trigger

3. Viewing Suggestions

4. Adding to Lovelace Dashboard


Important Notes

OpenAI API Key Security

OpenAI API Usage

Compatibility

Data Privacy


Troubleshooting

Common Issues

  1. OpenAI API Errors

    • Symptom: Error messages related to OpenAI API in notifications or logs.
    • Solution:
      • Verify your OpenAI API key is correct.
      • Ensure your API key has not expired or been revoked.
      • Check your OpenAI account for any usage limits or account issues.
  2. Integration Not Showing Up

    • Symptom: After installation, the integration doesn't appear in Home Assistant.
    • Solution:
      • Ensure the ai_suggester directory is in the correct location.
      • Restart Home Assistant after adding the custom component.
      • Check the logs for any errors during startup.
  3. No Suggestions Generated

    • Symptom: The integration doesn't generate any suggestions.
    • Solution:
      • Manually trigger the service ai_suggester.generate_suggestions.
      • Check if there are any new entities to analyze.
      • Review logs for any errors during the analysis.
  4. Dependency Issues

    • Symptom: Errors related to the OpenAI Python library version.
    • Solution:
      • Ensure that the OpenAI library version is >=1.0.0.
      • Clear Home Assistant's cache by deleting the deps directory and restart.

Logging and Debugging


Roadmap

We have an ambitious roadmap for the AI Automation Suggester integration to enhance its capabilities and provide even more value to Home Assistant users. Below is a list of planned features and improvements:


Phase 1: Enhanced Entity Analysis

1. Comprehensive Integration and Sensor Discovery

2. Advanced Automation Suggestions


Phase 2: Interactive Suggestion Management

1. User Feedback Mechanism

2. Detailed Implementation Guides


Phase 3: Automated Automation Creation

1. One-Click Automation Deployment

2. Safety and Privacy Measures


Future Enhancements

1. Local AI Processing

2. Multi-Language Support

3. Community Integration Sharing


Contributing to the Roadmap

We welcome contributions and feedback from the community to help shape the future of the AI Automation Suggester integration. If you have ideas, feature requests, or would like to contribute to the development, please open an issue or submit a pull request on our GitHub repository.


Timeline and Updates

We aim to implement these features progressively, with regular updates provided through the repository. Please check back frequently for the latest news and release notes.


Note: The features listed in this roadmap are subject to change based on feasibility, user feedback, and ongoing development efforts. Our goal is to provide the most valuable and user-friendly experience possible.


License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments


Contributions

Contributions are welcome! Please open an issue or submit a pull request on GitHub.


Disclaimer

This integration is a third-party custom component and is not affiliated with or endorsed by Home Assistant or OpenAI.


Support the Project

If you find this project helpful and would like to support its development, you can buy me a coffee!

Buy Me A Coffee

Your support is greatly appreciated and helps maintain and improve this project!


Additional Information

For any questions or support, please open an issue on GitHub.


Frequently Asked Questions (FAQ)

1. How do I update the integration when a new version is released?

2. Can I use this integration without an OpenAI API key?

3. Is my data safe when using this integration?

4. I found a bug or have a feature request. How can I contribute?

5. Does the integration support local AI processing?


End of README

Feel free to reach out if you need further assistance or have any other questions!