-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
This guide will help you get up and running with the Home Assistant Integration Development Template.
Before you begin, ensure you have:
- Python 3.14.2 or higher installed
- Git for version control
- Home Assistant understanding (basic familiarity)
- A code editor (VS Code recommended)
- Terminal/Command line access
On GitHub, click the "Use this template" button to create your own repository.
git clone https://github.com/your-username/your-integration.git
cd your-integrationThe template comes with a pre-configured virtual environment. Just activate it:
Linux/macOS:
source venv/bin/activateWindows:
venv\Scripts\activatepython scripts/verify_environment.pyYou should see all checks pass with green checkmarks (✓).
pytest tests/ -vAll tests should pass.
After setup, you have:
✅ Complete Python Environment
- Python 3.14.2 with Home Assistant 2026.2.0
- All required dependencies pre-installed
- Development tools configured
✅ Testing Framework
- pytest with HA custom component support
- Example test suite
- Coverage reporting configured
✅ Code Quality Tools
- Ruff for linting and formatting
- mypy for type checking
- pre-commit hooks (install to enable)
✅ Example Integration
- Working reference implementation
- Follows HA best practices
- Includes coordinator, config flow, and entities
✅ CI/CD Pipeline
- GitHub Actions workflows
- Automated testing and quality checks
- Ready for continuous integration
Explore custom_components/example_integration/ to understand:
- How DataUpdateCoordinator works
- Config flow implementation
- Entity platform setup
- Testing patterns
-
Copy the example:
cp -r custom_components/example_integration custom_components/your_integration
-
Update manifest.json:
- Change
domainto your integration name - Update
name,documentation,issue_tracker - Add your GitHub username to
codeowners
- Change
-
Follow the Development Guide for detailed steps
pre-commit installThis automatically runs quality checks before each commit.
HA-Dev-Template/
├── custom_components/ # Your integrations go here
│ └── example_integration/ # Reference implementation
├── tests/ # Test files
│ ├── conftest.py # Shared test fixtures
│ └── test_*.py # Individual test files
├── docs/ # Documentation
│ ├── QUALITY_CHECKLIST.md # Quality tier tracking
│ ├── HACS_INTEGRATION.md # Publishing guide
│ └── ... # More guides
├── scripts/ # Utility scripts
│ └── verify_environment.py # Environment checker
├── .github/ # GitHub configuration
│ └── workflows/ # CI/CD pipelines
├── venv/ # Pre-configured virtual environment
├── pyproject.toml # Python project config
├── mypy.ini # Type checking config
└── README.md # Main documentation
pytest tests/ -v -k example_integration# Lint
ruff check custom_components/
# Format
ruff format custom_components/
# Type check
mypy custom_components/example_integration/Go to .github/workflows/ci.yml to see what runs in CI:
- Linting (Ruff)
- Formatting checks
- Type checking (mypy)
- Tests (pytest)
Check docs/QUALITY_CHECKLIST.md to understand Bronze → Platinum tiers.
Symptom: source venv/bin/activate doesn't change your prompt
Solution:
# On Windows, use:
venv\Scripts\activate.bat
# Or PowerShell:
venv\Scripts\Activate.ps1Symptom: ModuleNotFoundError: No module named 'homeassistant'
Solution:
# Make sure venv is activated (you should see (venv) in prompt)
source venv/bin/activate
# If dependencies are missing, reinstall:
pip install -r requirements.txtSymptom: verify_environment.py shows red X marks
Solution:
- Check which specific checks failed
- Most common: virtual environment not activated
- If dependencies are missing:
pip install -r requirements.txt - Retry verification
Symptom: Tests can't import custom_components
Solution: This is already fixed in conftest.py, but if you see it:
# Make sure you're in the project root
cd /path/to/your-integration
# Run tests from project root
pytest tests/Symptom: Verification shows Python < 3.14
Solution:
# Check your Python version
python --version
# Install Python 3.14.2 or higher
# Then recreate venv:
python3.14 -m venv venv
source venv/bin/activate
pip install -r requirements.txtDocumentation:
- Development Guide - Detailed workflow
- Testing Guide - How to write tests
- Troubleshooting - Common issues
Community:
- Discussions - Ask questions
- Issues - Report bugs
Resources:
Now that you're set up, continue to:
- Development Guide - Learn the development workflow
- Common Patterns - See code examples
- Quality Scale Guide - Understand quality tiers
Happy coding! 🚀