Skip to content

Investigate Zone Configurator failure to persist manual mappings after EPL entity renaming - #420

Merged
EverythingSmartHome merged 1 commit into
mainfrom
b54b4acf-investigate-zone-configurator-failure-to
Oct 29, 2026
Merged

EverythingSmartHome merged 1 commit into
mainfrom
b54b4acf-investigate-zone-configurator-failure-to

Conversation

@EverythingSmartHome

Copy link
Copy Markdown
Owner

Summary

Entities a user maps manually in the Discovering Entities dialog are now saved correctly, kept on reload and re-sync, and never overwritten by auto-matches. Entities renamed in Home Assistant can still be matched automatically, assuming HA's registry keeps their original IDs (see the steps below).
Manual choices are saved as chosen
Manual overrides used to be written into the nested mapping under their template key. The flattening loops that run afterwards (settingsEntities, zoneConfigEntities, trackingTargets, polygon groups) then wrote the auto-matched values over the same stored keys. Sensors could also end up with presence and presenceEntity pointing at different entities. So a manual choice on an auto-matched field was lost, while one on an unmatched field such as Presence survived.
The new frontend/src/utils/manualOverrideMapping.ts fixes this:

  • templateKeyToStorageKey converts template keys to stored keys (e.g. settingsEntities.maxDistance → maxDistance, trackingTargets.target1.x → target1X).
  • applyOverridesToFlatMappings runs after all flattening in handleContinue, so manual choices are written last. Alias keys already present (presence/presenceEntity, distanceMinEntity/mmwaveDistanceMin) are updated too.
  • applyOverridesToNestedMappings updates every nested copy of an overridden field in the mappings passed to the room or wizard. It works on a deep copy, so the discovery result is never mutated.

Verification

  1. In everything-presence-mmwave-configurator/backend, run npm ci && npm test. All tests should pass, including src/domain/entityDiscovery.test.ts. Then run npm run build; tsc should report no errors.
  2. In everything-presence-mmwave-configurator/frontend, run npm ci && npm test. All tests should pass, including src/utils/seedManualOverrides.test.ts and src/utils/manualOverrideMapping.test.ts. Then run npm run build and npm run lint; both should succeed.
  3. In a dev Home Assistant with an Everything Presence Lite, rename binary_sensor.<node>_occupancy (e.g. to binary_sensor.prasenzmelder_esszimmer). Open Settings > Re-sync Entities. Presence should be auto-matched to the renamed entity.
  4. In the dialog, change several entities at once. Include at least one unmatched field and two auto-matched fields using the ✎ button: e.g. a Configuration setting like Max Distance, a Zone 1 coordinate, or a core sensor. Press Continue.
  5. Reopen Re-sync Entities. Every changed field should show your chosen entity. In the stored device mapping (GET api/device-mappings/<deviceId>), each changed key and its alias (e.g. presence and presenceEntity) should hold your chosen entity.
  6. Change two fields, click Re-discover entities without saving, and check both selections are kept. The dialog should show how many manual mappings are kept.
  7. Click Clear manual mappings & re-sync and cancel the warning: nothing should change. Click it again and confirm: only automatic matches should remain. Close with Cancel and reopen: the saved manual mappings should still be there. Clear again and press Continue: on reopening, only automatic matches should remain.

@EverythingSmartHome
EverythingSmartHome merged commit 2060c54 into main Oct 29, 2026
8 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