-
Notifications
You must be signed in to change notification settings - Fork 0
FAQ
Common questions about HA-Dev-Template and Home Assistant integration development.
A: This template provides a complete development environment for creating custom Home Assistant integrations. It includes:
- Python 3.14.2+ setup with Home Assistant
- Testing framework (pytest + HA-specific tools)
- Code quality tools (Ruff, mypy, pre-commit)
- Example integration following best practices
- CI/CD pipelines
- Comprehensive documentation
A: Basic familiarity with Home Assistant is recommended. You should understand:
- How integrations work in HA
- Basic concepts (entities, devices, services)
- How to use the HA UI
You don't need deep HA internals knowledge - the template guides you through development patterns.
A: Absolutely! This template is designed for both beginners and experienced developers. Start by studying the example integration, then follow the Getting Started guide.
A: Home Assistant integrations are written in Python, so Python knowledge is required. However, if you're new to Python, this template follows modern best practices and can help you learn.
A: Python 3.14.2 or higher. Home Assistant 2026.2+ requires Python 3.14.2+.
Check your version:
python --version # Should show 3.14.x or higherA: Yes! The template works on Windows, macOS, and Linux. Just note:
- Use Windows Subsystem for Linux (WSL) for best experience
- Or use native Windows with Python 3.14.2+
- File paths may differ (use
pathlib.Pathfor cross-platform code)
A: No! Tests mock Home Assistant, so you don't need HA running for development. However, for manual testing of your integration, you'll want:
- A test HA instance (dev container, VM, or spare Pi)
- DO NOT test on your production HA!
A: Yes, VS Code is recommended! This template includes:
-
.vscode/settings.jsonwith Python configuration - Integrated debugging support
- Extensions recommendations (Python, Ruff, mypy)
A: Yes, for ANY integration that polls data. DataUpdateCoordinator is:
- Required for Bronze tier
- Best practice for all polling integrations
- Handles errors, availability, and prevents redundant polls
Exceptions: Integrations that only provide services or utilities (no data fetching).
A: NO! New integrations must use config flow (UI-based setup). YAML configuration is:
- Deprecated for new integrations
- Not allowed in HA Core
- Required to be config flow for Bronze tier
A: Store credentials in ConfigEntry.data:
# In config flow
return self.async_create_entry(
title="My Integration",
data={CONF_API_KEY: user_input[CONF_API_KEY]},
)
# Access in setup
api_key = entry.data[CONF_API_KEY]NEVER:
- Log credentials
- Store in entity attributes
- Hardcode in source code
A: Always use async for I/O operations. Home Assistant is async, and blocking the event loop freezes the entire system.
# ✅ CORRECT
async def get_data(self):
async with aiohttp.ClientSession() as session:
async with session.get(url) as resp:
return await resp.json()
# ❌ WRONG - blocks event loop!
def get_data(self):
return requests.get(url).json()A: Yes! Tests are:
- Required for Bronze tier
- Required for HACS submission
- Essential for catching bugs
- Necessary for Gold tier (90%+ coverage)
A: Use mocks! Tests should NEVER make real API calls:
@pytest.fixture
def mock_api():
"""Mock API client."""
with patch("custom_components.my_integration.MyApiClient") as mock:
client = mock.return_value
client.async_get_data = AsyncMock(return_value={"temp": 20.5})
yield clientA: Common causes:
- Different Python versions (CI runs 3.13 and 3.14)
- Platform-specific code (paths, timezones)
- Missing dependencies
- Cached data
Solution: Run tests in clean environment matching CI.
A:
- Minimum: Bronze (functional, tested, linted)
- Recommended: Silver (reliable error handling, good UX)
- Ideal: Gold (robust, well-tested, fully typed)
- Aspirational: Platinum (excellent code, optimal performance)
Start with Bronze, iterate to Silver/Gold.
A:
- Test all config flow steps
- Test all error scenarios
- Test setup/unload
- Test coordinator updates
- Test all entity platforms
- Test entity availability
Run: pytest --cov=custom_components.my_integration --cov-report=html
A: For Gold tier, yes. Type hints:
- Catch bugs at development time
- Improve IDE autocomplete
- Document function contracts
- Required for HA Core contributions
Run: mypy custom_components/my_integration/
A: See Publishing Guide for full details.
Quick summary:
- Meet Bronze tier requirements
- Create public GitHub repository
- Add
hacs.jsonand LICENSE - Create v1.0.0 release
- Submit PR to
hacs/default
A: No, but it's highly recommended! HACS provides:
- Easy installation for users
- Automatic updates
- Larger audience
- Community trust
Alternative: Users can manually install from your GitHub repo.
A: NO! Only submit working, tested integrations. HACS will reject:
- Broken integrations
- Missing tests
- Invalid structure
- Poor documentation
A: Simply create a new GitHub release:
# Update manifest.json version
git tag v1.1.0
git push origin v1.1.0HACS automatically detects new releases. Users get update notifications.
A: Common causes:
- Coordinator update failed (check logs for errors)
- Entity availability check too strict
- Data structure mismatch
- Coordinator not refreshing
See Troubleshooting for solutions.
A: Error key mismatch between code and strings.json:
# config_flow.py
errors["base"] = "cannot_connect"
# strings.json - must match!
{
"error": {
"cannot_connect": "Failed to connect"
}
}A: This is already fixed in conftest.py, but ensure:
# tests/conftest.py
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))A:
- Small integrations: Single file OK
- Medium integrations: Split into logical modules (coordinator, entities, api)
- Large integrations: Use package structure with submodules
Example structure:
my_integration/
├── __init__.py
├── coordinator.py
├── config_flow.py
├── const.py
├── api.py
├── sensor.py
├── binary_sensor.py
└── switch.py
A: Depends on use case:
- Fast-changing data: 10-30 seconds
- Slow-changing data: 60-300 seconds
- Infrequent updates: 300+ seconds
Balance:
- Too frequent: Wastes resources, may hit rate limits
- Too infrequent: Stale data, poor UX
A: NO! If you must support legacy users:
- Use config flow as primary method
- Provide migration path from YAML
- Deprecate YAML in docs
- Plan removal timeline
New users should only use config flow.
A:
- Fork the repository
- Make improvements
- Add tests
- Create pull request
Ideas for contributions:
- Additional example integrations (OAuth2, multi-platform)
- Documentation improvements
- Bug fixes
- Additional automation
A: Yes! Open a Discussion to:
- Propose new features
- Suggest improvements
- Share ideas
A: Open an issue with:
- Description of the bug
- Steps to reproduce
- Expected vs actual behavior
- Error messages/logs
- Your environment (OS, Python version)
A:
- HA Developer Docs
- HA Discord - #devs_integrations channel
- HA Community Forum
- This template's wiki pages
A: Yes!
-
In this template:
custom_components/example_integration/ - HA Core: Browse core integrations
- Community: Search GitHub for custom integrations
A:
- Check Troubleshooting
- Search HA Developer Docs
- Ask in Discussions
- Join HA Discord - #devs_integrations
Can't find your answer?
- Getting Started - Setup guide
- Development Guide - Development workflow
- Testing Guide - Testing best practices
- Quality Scale Guide - Quality tiers
- Troubleshooting - Common issues
- Publishing Guide - Publish to HACS