Skip to content

Dashboard: show settings read-only when a write tier is off - #19

Merged
basmeerman merged 1 commit into
mainfrom
fix/dashboard-tier-aware-controls
Sep 15, 2026
Merged

basmeerman merged 1 commit into
mainfrom
fix/dashboard-tier-aware-controls

Conversation

@basmeerman

Copy link
Copy Markdown
Owner

Summary

After 2.1.1 the dashboard's Basic settings and Safety thresholds rows disappeared on installs with write tiers off. The Controls section always referenced number.* / switch.*, but with a tier off the bridge publishes those settings as sensor / binary_sensor. The rows only worked because 2.1.0 left stale retained number/switch configs on the broker (#17), which 2.1.1 now clears.

Functional requirement: settings are always visible read-only; a write tier makes them editable; tiers are off by default.

  • Generator takes the tiers (--basic-writes / --safety-writes, default off) and renders each row in the matching domain via setting(). The note says per tier whether settings are editable or read-only.
  • The add-on passes enable_basic_writes / enable_safety_writes to the auto-installed dashboard, rewritten on every restart, which is also when a tier change takes effect.
  • Legacy naming: read-only variants are slugged from the setting description (e.g. sensor.bms_1_cell_voltage_below_which_the_bms_enters_smart_sleep), controls keep the register name. Verified against all 7 ids in the HA log from Read-only fallback publishes sensor/binary_sensor with entity_category "config", which Home Assistant rejects #16 and identical to python-slugify 9.0.0 for all 34 settings.
  • check_entities.py derives domains from the tiers; device naming checks all four tier combinations.
  • mqtt._writable_component → writable_component (shared by dashboard and check).
  • DOCS, dashboards README / PLAN / TESTPLAN updated; sample regenerated (tiers off); add-on 2.1.2.

Test plan

  • ruff check, mypy src, pytest (549 passed, 100 % coverage)
  • generate.py drift check; check_entities.py --naming legacy and --naming device (4 tier combos)
  • HA, tiers off: paste regenerated dashboard, verify-entities.jinja shows BMS n settings: 34/34, rows read-only
  • HA, enable basic tier + restart: basic rows editable, safety rows read-only, no Unavailable rows

🤖 Generated with Claude Code

The Controls section always referenced number/switch entities. With a
write tier off the bridge publishes those settings as sensor /
binary_sensor, so the rows only worked while 2.1.0 left stale retained
number/switch configs behind; 2.1.1 clears them and the rows vanished.

- The generator takes the write tiers (--basic-writes / --safety-writes,
  default off) and renders each setting row in the matching domain. The
  note states per tier whether settings are editable or read-only.
- The add-on passes its tier options to the auto-installed dashboard,
  which is rewritten on every restart, the same moment a tier change
  takes effect.
- Legacy installs slug the read-only variants from the setting's
  description (verified against a real install's HA log; identical to
  python-slugify for all 34 settings). Controls keep the register name.
- check_entities.py derives domains from the tiers and checks all four
  tier combinations in device naming.
- mqtt.writable_component is public so dashboard and check share it.
- Docs, TESTPLAN and regenerated sample; add-on version 2.1.2.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@basmeerman
basmeerman merged commit 857e277 into main Sep 15, 2026
4 checks passed
@basmeerman
basmeerman deleted the fix/dashboard-tier-aware-controls branch September 15, 2026 21:33
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