Adopted tab: curation editor for adopted entities - #14
Merged
Conversation
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`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
src/core/adopted-model.ts):filterGroups,buildSavePlan,registryPayload(omitsdisabled_bywhenever 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.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_increasingand statistics-removal get an inline Cancel / Save-anyway confirmation; server warnings render after save.span_panel/adopted/listandspan_panel/adopted/curatecommands (Adopted-entity curation: user-asserted metadata from a new Adopted tab span#266) and to Core'sconfig/entity_registry/get|update; unit/precision controls additionally require a non-emptysensor/device_class_convertible_unitsanswer.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.