Getting Started
Before You Start
- Read the developer documentation at developers.home-assistant.io
- Set up your development environment - See Environment Setup
- Familiarize yourself with the codebase - Browse existing integrations and helpers
- Check existing issues and PRs - Avoid duplicating work
Ways to Contribute
- Fix bugs - Check the issue tracker
- Add new integrations - Support new devices and services
- Improve existing integrations - Add features or fix issues
- Write tests - Increase code coverage
- Improve documentation - Help at home-assistant.io
- Review pull requests - Help maintain code quality
Contributing Code
1. Fork and Clone
Fork the home-assistant/core repository on GitHub, then clone your fork:2. Create a Branch
Create a branch for your work from thedev branch:
fix/issue-description- For bug fixesfeature/new-feature-name- For new featuresintegration/device-name- For new integrations
3. Make Your Changes
Write your code following these guidelines:- Follow code style - Use ruff and pylint (see Code Quality)
- Add type hints - All functions should have type annotations
- Write docstrings - Use Google-style docstrings
- Keep it simple - Avoid unnecessary complexity
- Handle errors gracefully - Don’t let exceptions crash Home Assistant
4. Write Tests
All code changes must include tests:5. Run Quality Checks
Before committing, run all quality checks:6. Commit Your Changes
Write clear, descriptive commit messages:- Use present tense (“Add feature” not “Added feature”)
- First line should be 50 characters or less
- Reference issue numbers with
Fixes #123orCloses #123 - Explain what and why, not how
7. Push to Your Fork
8. Create a Pull Request
Create a pull request against thedev branch of home-assistant/core.
Pull request title:
- Be descriptive and concise
- Use present tense
- Examples: “Add XYZ integration”, “Fix light brightness issue”
- Explain what your PR does
- Reference related issues
- Include testing steps
- Add screenshots or videos if relevant
- Use the provided PR template
Pull Request Process
Review Process
- Automated checks run - All CI checks must pass
- Code review by maintainers - Be patient, maintainers are volunteers
- Requested changes - Address feedback and push updates
- Approval and merge - Once approved, a maintainer will merge
Getting Faster Reviews
Read How to get faster PR reviews by Kubernetes (skip steps 0-1). Key points:- Small PRs are better - Easier to review and merge
- One change per PR - Don’t mix unrelated changes
- Good descriptions - Help reviewers understand your changes
- Respond to feedback - Be responsive and respectful
- Pass all checks - Don’t submit PRs with failing tests
During Review
Do NOT:- Amend or squash commits after review starts
- Rebase your branch
- Force push to your PR branch
- Add new commits for changes requested
- Mark conversations as resolved when addressed
- Ask for clarification if feedback is unclear
- Be patient and respectful
After Merge
Once merged:- Delete your branch on GitHub
- Update your local repository:
Integration Development
New Integration Checklist
When adding a new integration:- Create integration directory:
homeassistant/components/your_integration/ - Add
manifest.jsonwith required metadata - Implement
__init__.pywith setup functions - Add config flow for UI configuration
- Create entity platforms (e.g.,
light.py,sensor.py) - Write comprehensive tests
- Add
strings.jsonfor translations - Create
services.yamlif adding services - Update documentation
Integration Requirements
manifest.json must include:Config Flow
New integrations should use config flows for UI-based setup:Code Review Guidelines
For Contributors
Before requesting review:- All CI checks pass
- Tests have good coverage
- Code follows style guidelines
- Documentation is updated
- PR description is clear and complete
- Respond promptly to feedback
- Ask questions if something is unclear
- Don’t take criticism personally
- Learn from the feedback
What Reviewers Look For
- Correctness - Does it work as intended?
- Tests - Are there adequate tests?
- Code quality - Is it clean and maintainable?
- Performance - Does it perform well?
- Security - Are there any security concerns?
- Breaking changes - Will this break existing setups?
- Documentation - Is it properly documented?
Dependencies
Adding Dependencies
When adding a new Python library:-
Add it to your integration’s
manifest.json: - Pin to a specific version
- Ensure the library is actively maintained
- Check the library’s license is compatible
Updating Dependencies
When updating dependency versions:- Test thoroughly
- Check for breaking changes in the library
- Update integration code if needed
Common Issues
Pre-commit Hooks Fail
Tests Fail Locally
CI Checks Fail
- Check the CI logs on GitHub
- Reproduce the failure locally
- Fix the issue and push updates
Merge Conflicts
Best Practices
Communication
- Be respectful - Everyone is volunteering their time
- Be patient - Reviews may take time
- Be clear - Explain your reasoning
- Be open to feedback - It makes the code better
Code Quality
- Read existing code - Learn from high-quality integrations (Platinum/Gold level)
- Keep PRs focused - One feature or fix per PR
- Write tests - They prevent regressions
- Document your code - Future you will thank you
Async Code
- Use async/await - Don’t block the event loop
- Await coroutines - Calling async functions without await is a bug
- Handle cancellation - Async operations can be cancelled
Error Handling
Feature Suggestions
If you want to suggest a new feature:- Start a discussion on GitHub
- Explain the use case
- Discuss implementation approaches
- Get feedback before starting work
Bug Reports
If you find a bug:- Create an issue on GitHub
- Provide detailed reproduction steps
- Include relevant logs and configuration
- Specify your Home Assistant version
Resources
- Developer Documentation
- Architecture Overview
- Creating Components
- Discord Chat - #devs channel
- Community Forum
Code of Conduct
Home Assistant has a Code of Conduct. All contributors are expected to follow it. Key points:- Be respectful and inclusive
- Welcome newcomers
- Accept constructive criticism gracefully
- Focus on what’s best for the community