Create Home Assistant automations using natural language! Describe what you want in plain English, and AItomations uses AI (Google Gemini or local Ollama) to generate the YAML configuration for you.
This is the repository for the source code for the AITomations Home Assistant Add On. If you are looking to install and use the add on please go to The installation repo
The following information is for my reference and future contributors to the project. It might also serve as an example for efficently building Home Assistant Add Ons with a user interface and back end.
- Natural Language Automation - Just describe what you want in plain English
- Multiple LLM Providers - Use Google Gemini (cloud) or Ollama (local)
- Context-Aware - Automatically fetches your Home Assistant entities for accurate suggestions
- Conversational Interface - Chat with the AI to refine your automation
- Real-time Streaming - See the AI's response as it's generated
- Review Before Install - Preview the YAML and explanation before installing
- Modern UI - Clean interface built with Vue 3 and Vuetify
- Prerequisites
- Development Setup
- Running in Development Mode
- Debugging in VS Code
- Testing in Home Assistant
- Building and Deploying
- Project Structure
- Contributing
- License
Before you begin, ensure you have:
- Visual Studio Code - The primary editor for this project
- Docker Desktop - Required for VS Code Dev Containers
- VS Code Dev Containers Extension - For the development environment
This project uses VS Code Dev Containers for a consistent development environment with all tools pre-installed.
git clone https://github.com/gmatrangola/aitomations.git
cd aitomationsOpen the folder in VS Code. When prompted, click "Reopen in Container". The first build may take a few minutes.
The dev container automatically installs all dependencies. To validate everything is working:
# Quick validation (uses cache)
make validate
# Force full validation
make validate-force
# Run linter only
make lint
# Fix linting issues
make lint-fix
# Run type checking
make type-checkRun the backend and frontend simultaneously in separate terminals.
python aitomations/src/backend/app.pyThe server starts at http://localhost:8099
cd aitomations/src/frontend
pnpm run devThe dev server starts at http://localhost:5173
Open http://localhost:5173 in your browser. The Vite dev server automatically proxies API calls to the backend.
Debug both backend and frontend simultaneously with full breakpoint support.
Create .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask",
"type": "debugpy",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "aitomations/src/backend/app.py",
"FLASK_DEBUG": "1"
},
"args": [
"run",
"--no-debugger",
"--no-reload",
"--port=8099"
],
"jinja": true,
"justMyCode": true
},
{
"name": "Frontend: Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:5173",
"webRoot": "${workspaceFolder}/aitomations/src/frontend"
}
],
"compounds": [
{
"name": "Full Stack Debug",
"configurations": ["Python: Flask", "Frontend: Chrome"]
}
]
}- Stop any manually started servers
- Open Run and Debug panel (Ctrl+Shift+D)
- Select "Full Stack Debug" from the dropdown
- Press F5 or click the green play button
Set breakpoints in .py and .vue files - the debugger will pause execution as expected.
Test the add-on in a complete Home Assistant OS environment using a virtual machine.
UTM supports both Apple Silicon and Intel Macs with a single setup process.
-
Install UTM: Download from mac.getutm.app
-
Download HA OS: Get the appropriate image from the releases page:
- Apple Silicon:
haos_generic-aarch64-XX.X.qcow2.xz - Intel:
haos_ova-XX.X.qcow2.xz - Extract the
.xzfile (double-click in Finder)
- Apple Silicon:
-
Create VM:
- Open UTM β Click + β Virtualize β Linux
- Select the
.qcow2file as boot image - Accept defaults (4GB RAM recommended)
- Check "Open VM Settings" β Save
-
Fix Drives:
- Go to Drives section
- Delete the drive that is NOT your
haos...qcow2image - Save
-
Start and Configure:
- Start the VM
- Wait for boot (several minutes)
- Access at
http://homeassistant.local:8123or use the IP shown in console - Complete the onboarding wizard
Tip: Change hostname to avoid conflicts with existing HA instances:
Settings β System β Network β Change "Hostname" to ha-dev
-
Build the add-on:
make build
-
Start local web server:
python3 -m http.server 8080
-
Add repository in Home Assistant:
- Settings β Add-ons β Add-on Store
- Three-dots menu β Repositories
- Add:
http://host.docker.internal:8080
-
Install:
- Find AItomations Creator in "Local add-ons"
- Click Install
- Configure your API keys
- Start the add-on
- Click Open Web UI
For quick testing without full HA OS features:
# Start test container
docker-compose up -d
# Access Home Assistant
# http://localhost:8123
# User: admin
# Password: Adminpassword-123
# Shutdown
docker-compose downNote: This runs Home Assistant Core, which lacks the Supervisor and Add-on Store.
# Full build with validation
make build
# Quick build (skip type checking)
make build-incremental
# Frontend only
make build-frontendConfigure deployment in .deploy.test.env:
HA_HOST=192.168.1.100
HA_USER=root
HA_PORT=22
HA_PATH=/addons/local_aitomations-creatorDeploy:
# Build and deploy
make deploy TARGET=test
# Deploy without rebuilding
make deploy-quick TARGET=test
# Restart add-on
make restart TARGET=test
# View logs
make logs TARGET=test.
βββ .devcontainer/ # VS Code Dev Container config
βββ aitomations/ # Main add-on directory
β βββ src/
β β βββ backend/ # Python Flask API
β β β βββ app.py # Main Flask application
β β β βββ api/ # API routes and errors
β β β βββ llm/ # LLM provider implementations
β β βββ frontend/ # Vue 3 + Vuetify UI
β β βββ src/
β β β βββ components/ # Vue components
β β β βββ views/ # Page views
β β β βββ services/ # API and error services
β β β βββ composables/ # Vue composables
β βββ Dockerfile # Production container
β βββ config.json # Add-on manifest
β βββ run.sh # Add-on startup script
βββ build/ # Build output (git-ignored)
βββ Makefile # Build and deployment commands
βββ README.md
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Validate:
make validate - Commit:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - Open a Pull Request
- Python: Follow PEP 8, use
rufffor linting - TypeScript/Vue: Follow the ESLint configuration
- All code must pass:
make validatebefore committing
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Home Assistant Community: Community Forum
Made with β€οΈ for the Home Assistant community