custom-mygrid

Architecture and contributor guide

The project focuses on two Python device libraries and two hand-maintained custom integrations. Make protocol changes in the library for the device, and Home Assistant behavior changes in its integration repository.

Libraries own the device interface

These libraries own device communication and protocol decoding. The python-mygrid-* names are repository names only; use the mygrid-* package names when declaring dependencies.

Custom integration repositories own the HA guides and behavior

Both repositories are hand-maintained and are the source of truth for their integration code and tests. They import their library from PyPI. The library version pin lives in both the integration’s manifest.json and the dev dependency group in pyproject.toml; scripts/validate_metadata.py fails if those pins differ.

Marketplace and HACS allow one integration (one domain) per repository, so each device has its own HACS repository. The naming convention is ha-mygrid-<library>, such as ha-mygrid-modbus for mygrid-modbus.

Dormant Home Assistant core overlay

ha-mygrid-core is a dormant overlay using the mygrid domain, retained for a possible Home Assistant core contribution. It is not the source of the HACS repositories. Do not run scripts/sync_hacs.py against the HACS repositories.

A future core PR would be ported from the HACS integrations once the ModuleTwo is validated on hardware. A core contribution is not guaranteed. Existing HACS entries would not migrate to a core entry because the domains differ.

Release flow

  1. Tag the library release as vX.Y.Z in its repository.
  2. Approve the publish workflow in the pypi environment. Publishing uses PyPI trusted publishing.
  3. In the corresponding HACS repository, bump the library pin in both manifest.json and the dev dependency group of pyproject.toml, then run uv lock to update the lockfile.
  4. Run metadata validation and the repository’s checks, then release the HACS integration. Both HACS repositories build versioned manual-install ZIPs; release tags must exactly match the integration manifest version (for example, 0.1.0). Custom-repository installation does not imply Marketplace catalog listing. Follow each repository’s release instructions: ModuleTwo and VoltBridge.

Contributor tooling

The repositories use uv for dependency and environment management, hatch-vcs for versioning, Ruff with ALL rules, and mypy in strict mode. Integration tests use pytest-homeassistant-custom-component.

Live tests are selected with -m live; provide VOLTBRIDGE_HOST for VoltBridge or MYGRID_HOST for ModuleTwo. Follow the target repository’s test instructions and hardware requirements before running them. ModuleTwo read-only library tests and partial integration acceptance passed on 2026-11-09; see the setup guide and its linked acceptance record for remaining checks.

Website tooling

This hub uses Astro with static output on GitHub Pages. See website development and publishing for the project structure, Markdown routing, repository prefix, local commands and CI conventions that other projects can reuse.

Why older commits look different

Until 2026-10-24, the HACS repositories were generated from ha-mygrid-core, with the libraries vendored byte for byte. That model was replaced to focus on the libraries and custom HACS integrations. The transition was prepared on own-the-source in both HACS repositories and park-core in the core repository, and all three branches were merged on 2026-10-24. The HACS repositories are now hand-maintained, and ha-mygrid-core is the dormant overlay described above. Historical generator and vendoring references describe the earlier model.

See the documentation index for device setup and protocol guides.

Documentation ownership

The hub renders authoritative integration and library Markdown from pinned upstream snapshots. HA setup, configuration, entities and automation examples belong in their integration repository; Python usage, protocol references and library validation belong in their library repository. This repository owns cross-device introductions, navigation and architecture. Edit each topic in its owning repository rather than maintaining a second guide here.

See upstream documentation publishing for the source manifest, update PR workflow and link handling.