Skip to content

Home Assistant integration template with HACS, hassfest and signed releases

A custom integration for Home Assistant, with the checks of Home Assistant itself in every pull request and a release that HACS installs from the first merge on.

Start one

uvx --from copier==9.19.1 copier copy --data project_type=home-assistant gh:Dennis-Otto/repo-blueprint my-integration
cd my-integration
python3 .github/blueprint.py create

With uv and the GitHub CLI, as the quick start shows. Copier asks for the name, the owner and the other answers, and create makes the repository on GitHub, applies the settings as code and prints the checklist.

What you get

  • The example: custom_components/<domain>/ with its manifest.json, a config flow, translations in English and German and the brand icons, hacs.json, and the tests in tests/ with pytest-homeassistant, on Python 3.14. Replace it with the real code; its tests show how.
  • Pictures of the integration: scripts/screenshots.sh starts Home Assistant in Docker with custom_components/, sets the integration up through the onboarding and its config flow, and photographs its page, as docs/images/screenshots/home-assistant.png and .dark.png, beside the home page of the website; the screenshot bot renews them when a change shows, and Renovate keeps the Home Assistant of the script current.
  • The steps of scripts/check.sh for this kind, the same on your machine and in the CI: Ruff, mypy and the tests with every line and branch covered, on every core. Their lock file is compiled for Linux, so they run on Linux as in the CI, on Windows in WSL 2 or in the dev container, and on macOS in the dev container, as the repository's CONTRIBUTING.md and AGENTS.md say.
  • The steps of every kind: the text files, the diagrams, the pages in one column, the files of the project, the fragments of the changelog, the accepted advisories, the lock files, the version, the Git hooks, ShellCheck for the shell scripts and the strict build of the website.
  • The advisories of the test tools that Home Assistant pins: the test plugin, pytest-homeassistant, comes with each release of Home Assistant at the same version and pins it, and Home Assistant pins packages such as Pillow exactly, so no update of the lock file can fix their advisories until Home Assistant moves on. osv-scanner.toml then accepts such a version with every advisory, with its reason and until a date, and .github/renovate-accepted.json5 keeps Renovate from a fix that the lock file can't take, as the troubleshooting shows. A new integration starts with what the blueprint accepts, none while the newest Home Assistant has fixed them.
  • Workflows of this kind: the property tests with new random inputs every night (properties.yml) and the mutation tests with mutmut every week, and in every pull request that changes the Python whether mutmut can mutate it (mutation.yml).
  • Everything that every repository gets: the PR coach and the fix bot, the release bot, Renovate, the settings as code, the issue assistant, the website in English and German, the security checks and the blueprint bot, as the guide lists them.

The checks that a pull request needs

The ruleset Protect main of .github/repository.toml lets a pull request merge once these checks pass:

  • check (home-assistant): scripts/check.sh with the tools of Home Assistant.
  • home-assistant: the HACS action and hassfest, the validation of Home Assistant, and the oldest Home Assistant that the integration promises.
  • lint, diagrams, docs, conventional title, codeql, dependency-review and gitleaks, which every kind needs: every linter in one job, the pictures of the diagrams, the strict build of the website, the title of the pull request with its entry in the changelog, CodeQL, the review of new dependencies and the secret scan.

The oldest Home Assistant

hacs.json names in homeassistant the oldest Home Assistant that the integration supports, and HACS offers each release to every Home Assistant from that one on. The tests run on the newer Home Assistant of the lock file, which Renovate moves on every month. So the check home-assistant starts the image of that oldest release, ghcr.io/home-assistant/home-assistant:<minimum>, installs the requirements of each manifest.json there as Home Assistant does, and imports every module of custom_components/ with its Python and its packages. A module that needs something newer, such as a helper that came with a later release, fails the check at its file, and the PR coach shows the two ways out: keep the code working on the minimum, or raise homeassistant in hacs.json and say so in the changelog. The minimum stays named once, in hacs.json, a file of the project.

Delivery

Merging the release pull request publishes a release with the zip of the integration, which hacs.json names, so HACS installs that zip. The release has its SBOM and the signed provenance of SLSA Build Level 3.

After every release, and every week for the latest one, verify-release.yml checks the zip as HACS installs it: the release has the zip that hacs.json names, its manifest.json lies at the root of the zip, with the domain of the folder in custom_components/ and the version of the release, and HACS offers it as it should, a release to every user and a beta only to those who show betas. A beta of the beta channel has its own version in the manifest.json of its zip, such as 1.3.0-beta.1, which Home Assistant shows to its testers (decision 0065).

Once by hand

python3 .github/blueprint.py checklist ticks off each step that it can see and names the rest, each with its link: the release app of the owner with its private key, as your own account shows, the token of the issue assistant unless its AI is off, OpenSSF Best Practices, the REUSE API and the social preview.

This kind adds these steps:

  • Give the repository the description and the topics that HACS lists and its check needs: the answer topics names them in .github/repository.toml, and settings apply sets them.
  • Submit the repository to the default repositories of HACS: https://github.com/hacs/default.

A real repository

HomeDarts for Autodarts is made from the blueprint: local real-time board control, games, tournaments and statistics, without a cloud account.

The Variants workflow tries every pull request of the blueprint that changes what the answers of HomeDarts for Autodarts render on them, before it merges.

How the blueprint compares with other templates: the comparison.