ITSpecialist111/ai_automation_suggester
This custom Home Assistant integration automatically scans your entities, detects new devices, and uses AI (via cloud and local APIs) to suggest tailored automations. It supports multiple AI providers, including OpenAI, Anthropic, Google, Groq, Ollama and more! The integration provides automation suggestions via HASS notifications
AI Automation Suggester – Home Assistant integration
What it is – An official‑style Home Assistant custom integration that calls a large‑language‑model (LLM) to look at your current Home Assistant configuration (entities, devices, areas, existing automations) and returns ready‑to‑paste YAML automation snippets. It works with any OpenAI‑compatible provider (OpenAI, Anthropic, Google Gemini, Groq, Ollama, LocalAI, etc.) and presents the suggestions as persistent notifications, sensor attributes, or via a bundled Lovelace card.
Why you might want it
- Large Home Assistant setups quickly become hard to reason about; you may miss useful automations.
- Writing complex YAML by hand can be tedious, especially for newcomers.
- The integration gives you context‑aware ideas (energy‑saving, security, comfort) that are tailored to the exact devices you have, saving time and inspiring new automations.
How it works (step‑by‑step)
- Snapshot – On demand (or via a Home Assistant automation) the integration gathers a snapshot of entities, devices, areas, and existing automations. You can filter by domain, limit the number of entities, or exclude specific items.
- Prompt building – The snapshot is inserted into a system prompt. You may add a custom prompt to steer the output (e.g., “focus on presence lighting”).
- Provider call – The prompt is sent to the selected AI provider (OpenAI, Anthropic, Gemini, Groq, Ollama, etc.). Temperature, model, token limits, and endpoint are configurable.
- Parsing – The integration asks the model for structured JSON; if that fails it falls back to fenced‑YAML parsing, validates the YAML and records any truncation warnings.
- Surface – The resulting suggestion appears as a Home Assistant persistent notification, as attributes on a sensor, and is stored in a history log that the bundled dashboard card can read.
Key features
- Model‑agnostic – works with >100 back‑ends (cloud and local). Temperature, max‑tokens, and custom endpoints are configurable.
- Custom prompts & filters – limit domains, exclude entities/areas, set an entity limit, or add a one‑off custom instruction.
- Persistent suggestion history – each suggestion stores the model used, token usage, warnings, and a review status (accepted/declined/dismissed).
- Dashboard‑ready output – sensor attributes contain a human‑readable description and the raw YAML block, making it easy to build Lovelace cards.
- Randomized entity selection – prevents the same ideas from appearing repeatedly.
- Service‑based triggering – call
ai_automation_suggester.generate_suggestionswith optional parameters to run on demand or from automations (weekly review, new‑entity detection, startup, etc.).
Installation
- Install HACS (Home Assistant Community Store) if you haven’t already.
- In HACS → Integrations click the + button, search for AI Automation Suggester, and install.
- Restart Home Assistant.
- Add the integration via Settings → Devices & Services → Add Integration → AI Automation Suggester.
- (Alternatively, copy the
custom_components/ai_automation_suggesterfolder into yourcustom_componentsdirectory and restart.)
- (Alternatively, copy the
Configuration
- Choose your AI provider from the dropdown.
- Enter the required API key or local endpoint URL.
- Select a model, set temperature (0.0‑2.0, default 0.7), and define max input/output tokens.
- Optionally supply a custom system prompt to give the model a particular personality or focus.
- All options can be edited later via the integration’s options page.
Typical usage
- Manual – Open Developer Tools → Services, call
ai_automation_suggester.generate_suggestions(you can pass parameters likeall_entities: true,entity_limit: 50,custom_prompt: "Suggest night‑time lighting automations"). - Automatic – Create a Home Assistant automation that calls the same service on a schedule (e.g., weekly) or on events such as new entity added.
- Review the suggestion in the notification or on the sensor card, copy the YAML into your
automations.yaml, and enable it.
Prerequisites
- Home Assistant 2024.1 or newer.
- Access to an LLM provider (cloud API key or a running local server like Ollama/LocalAI).
Safety note – The integration never writes automations automatically; you must review and apply the YAML yourself, so there is no risk of unintended changes.
This summary is based solely on the repository’s README.
Related
- Project
- Project
- Project
- Project
- Project