Skip to content

Adopted tab: curation editor for adopted entities - #14

Merged
cayossarian merged 4 commits into
mainfrom
feat/adopted-curation
Sep 1, 2026
Merged

Adopted tab: curation editor for adopted entities#14
cayossarian merged 4 commits into
mainfrom
feat/adopted-curation

Conversation

@cayossarian

Copy link
Copy Markdown
Member

What

A new admin-only Adopted tab in the panel view: adopted entities grouped by device (VENDOR READINGS / ADOPTED DEVICE), a filter bar, and a per-row editor for device class, statistics class and prominence — plus name, icon, enable, display unit and precision, which are Home Assistant's own registry settings surfaced in place.

How

  • Pure model (src/core/adopted-model.ts): filterGroups, buildSavePlan, registryPayload (omits disabled_by whenever the enable control is untouched, so an integration-disabled entity is never re-attributed to the user), statisticsConfirmation, seeding and gating predicates — all unit-tested.
  • View (src/panel/tab-adopted.ts) follows the MonitoringTab pattern; selects populate from the server's allowed lists and hide when empty; stale curation fields are marked; total_increasing and statistics-removal get an inline Cancel / Save-anyway confirmation; server warnings render after save.
  • Talks to the integration's span_panel/adopted/list and span_panel/adopted/curate commands (Adopted-entity curation: user-asserted metadata from a new Adopted tab span#266) and to Core's config/entity_registry/get|update; unit/precision controls additionally require a non-empty sensor/device_class_convertible_units answer.
  • 50 i18n keys, translated in en/es/fr/ja/pt (validator-enforced parity).

Testing

343 tests across 27 files (71 new: 39 model, 30 view, plus regressions for the disabled_by preservation); tsc + rollup build, eslint, prettier, i18n validator all clean.

Companion to SpanPanel/span#266, whose bundled frontend dist is built from this branch.

The Adopted tab lists every property the panel publishes that nobody
modelled, grouped by the device it renders on, each row expandable into
an editor that routes each field to whichever store owns it: name, icon,
enabled-ness and the sensor display unit to Core's registry command,
device class, state class and prominence to span_panel/adopted/curate.

A registry write is issued only when something registry-owned actually
moved, so curating alone never touches disabled_by. The display unit and
precision controls appear only for a device class Core reports
convertible units for, asked of Core rather than restated here.
total_increasing and dropping a stored state class each hold the save
behind an inline confirmation.

The tab is admin-only and absent from the Favorites pseudo-panel, since
every command behind it requires admin and curation is one panel's
business.
An adopted entity is disabled by the integration, but Core's update
command accepts only null or "user" — so buildSavePlan's payload cannot
express the state such an entity is actually in. Skipping the write when
nothing registry-owned moved covered a curation-only save, but the
moment a name or icon moved, the payload rode along and turned an
integration-disabled entity into a user-disabled one behind an enable
control the user never touched.

registryPayload now drops disabled_by whenever the enable control still
agrees with the registry; Core applies only the keys present in the
message, so the disabler is left exactly as it was. appliedSeed carries
the same rule into the seed a write leaves behind, so a second save of
the same form finds nothing to write.
…settings cover it

The field wrote through `config/entity_registry/update`, which is the same
command Core's entity settings dialog issues, so the tab offered a second place
to set one thing and no reason to prefer either. What is left here is what Core
has nowhere to put -- a device class, a state class, prominence -- plus the
name and enable controls a save has to reconcile anyway.

`RegistrySeed` stops carrying an icon too: it existed only to tell an edited
icon from an untouched one, and nothing compares them now. The registry write a
save issues is `name` and, when the enable control moved, `disabled_by`.
@cayossarian
cayossarian merged commit af34b81 into main Sep 1, 2026
2 checks passed
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