Skip to content

fix(dev): generate the ATW testing dashboard from the entity registry - #276

Merged
andrew-blake merged 2 commits into
feat/atw-water-temp-report-unificationfrom
feat/dev-dashboard-generator
Aug 27, 2026
Merged

fix(dev): generate the ATW testing dashboard from the entity registry#276
andrew-blake merged 2 commits into
feat/atw-water-temp-report-unificationfrom
feat/dev-dashboard-generator

Conversation

@andrew-blake

Copy link
Copy Markdown
Owner

Summary

Builds on feat/atw-water-temp-report-unification, whose water-temperature behaviour these cards are there to exercise; that branch has no PR number yet, so expect one to replace the branch name here.

tools/build_dev_dashboard.py generates the dev ATW testing dashboard from the live HA entity and device registries: one view per ATW unit, with zone 2 and the device's display name resolved at run time. Entity IDs carry the building name as a prefix, and for real devices that prefix is personal data, so --mock-only limits the output to the mock server's synthetic buildings and that filtered form is what is committed under dev-config-template/.storage/, where it survives make dev-reset. The water-temperature cards cover every vendor-defined series, including the ones #266's capability gating leaves uncreated. Design rationale lives in the module docstring; last_reading semantics are in ADR-022 (docs/decisions/022-reading-provenance.md) and the report source in ADR-023 (docs/decisions/023-atw-water-temperatures-from-report.md).

Risks accepted

Regenerating the committed template without --mock-only writes real building and device names into the repo. The generator's building allowlist only decides which units that flag keeps, so nothing blocks the unfiltered form, and detection rests on diff review at commit time because these names are not a pattern gitleaks matches. Undo is a regenerate with the flag, plus a history rewrite if the leak has already landed.

AI Disclosure

  • No AI/agent tooling was used
  • AI/agent tooling assisted; I reviewed and ran the change myself before submitting

Testing

  • make pre-commit: all 12 hooks pass, gitleaks included.
  • --mock-only output is byte-identical to the committed dev-config-template/.storage/lovelace.melcloudhome_testing, so that file is regenerable and holds only the mock server's two synthetic buildings.
  • Full run against the live dev registry emits 4 views for 4 ATW units, 2 mock and 2 real, with zone-2 detection firing on the one dual-zone unit.
  • 6 of the 77 entity references in that output are absent from the registry, all zone-2 flow and return water temperatures on single-zone units, which is the generator's intended behaviour.
  • The unprefixed entity IDs the committed dashboard carried match none of the 177 melcloudhome entities in the live dev registry, spread across 12 entity-id prefixes.
  • The ha-melcloud-dev container serves the generated 4-view dashboard with no lovelace or dashboard errors across its startups; its only melcloudhome warnings come from the mock's randomised telemetry.
  • make test-api, make test-integration, make test-e2e: not run here; the diff is one dev-only script and a lovelace JSON, neither on a test path.
  • Automated coverage for tools/build_dev_dashboard.py: none exists.
  • Dashboard confirmed visually in a browser: not done here.
  • Prod deployment and soak: not applicable, tools/ sits outside custom_components/ so nothing in this layer ships to users.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.21%. Comparing base (c1a6b47) to head (f8709fc).

Additional details and impacted files

Impacted file tree graph

@@                           Coverage Diff                           @@
##           feat/atw-water-temp-report-unification     #276   +/-   ##
=======================================================================
  Coverage                                   93.21%   93.21%           
=======================================================================
  Files                                          44       44           
  Lines                                        2904     2904           
=======================================================================
  Hits                                         2707     2707           
  Misses                                        197      197           
Flag Coverage Δ
unittests 93.21% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c1a6b47...f8709fc. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andrew-blake
andrew-blake force-pushed the feat/dev-dashboard-generator branch from 71738d6 to fcfb53a Compare August 24, 2026 06:32
@andrew-blake
andrew-blake force-pushed the feat/dev-dashboard-generator branch from fcfb53a to 4e1c466 Compare August 24, 2026 06:34
andrew-blake and others added 2 commits August 27, 2026 19:50
The dev dashboard's entity IDs went stale: every card read "Entity not found"
because the IDs predate the building-name prefix that entity IDs carry today.
A saved snapshot cannot be committed to fix that — for real devices the prefix
is the building name, and one of those is a street address — so the design is
committed as a generator instead.

- tools/build_dev_dashboard.py discovers ATW units from the entity registry (a
  water heater identifies a unit, a second climate entity identifies zone 2)
  and reads device names at runtime, so nothing personal reaches the repo
- --mock-only emits just the mock server's two buildings, which is what the
  committed template is built with; an unrecognised building is treated as real
  and excluded, so a stale list costs a missing view rather than a leak
- each unit gets live tiles, a 7-day statistics graph, a 24h raw-state graph
  and a last_reading table, following the prod ATW dashboards' card vocabulary
- every water-temperature series is graphed whether or not its entity still
  exists: #266 stopped creating the ones for absent hardware, and where a
  series stops is the discontinuity worth comparing against the vendor's app
- the raw-state graph exists because statistics hide what ADR-023 changed: a
  missing reading is a gap there, not a flat line

make dev-reset restores dev-config-template/.storage, so the mock views now
survive a reset; re-run the generator to add the real units back.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The tool had no reference anywhere: not in DEV-SETUP.md, tools/README.md,
CLAUDE.md or the Makefile, so its usage lived only in its own docstring.

- DEV-SETUP.md gains a section next to `make dev-reset`, which is what the
  committed template exists to survive, and states why the committed copy is
  built with `--mock-only`
- tools/README.md gains a short entry beside the deployment tool

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@andrew-blake
andrew-blake force-pushed the feat/dev-dashboard-generator branch from 4e1c466 to f8709fc Compare August 27, 2026 18:50
@andrew-blake
andrew-blake merged commit 323e9c4 into main Aug 27, 2026
22 of 30 checks passed
@andrew-blake
andrew-blake deleted the feat/dev-dashboard-generator branch August 27, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant