Skip to content

Add reconfigure flow for GPS source device_tracker (3.3.0-rc4) - #42

Merged
Pascal-ZeGerman merged 6 commits into
mainfrom
worktree-reconfigure-device-tracker
Aug 26, 2026
Merged

Pascal-ZeGerman merged 6 commits into
mainfrom
worktree-reconfigure-device-tracker

Conversation

@Pascal-ZeGerman

Copy link
Copy Markdown
Owner

Summary

  • Add ASPParkingConfigFlow.async_step_reconfigure so the GPS source device_tracker entity can be changed via Settings > Devices & Services > ASP Parking > Reconfigure, without deleting and re-adding the integration.
  • Re-shows only the device_tracker EntitySelector, pre-filled with the currently configured entity. Submitting a new value merges into entry.data (data_updates=, not a replace) and schedules a reload; resubmitting the same value is a no-op (reload_even_if_entry_is_unchanged=False). All entry.options (thresholds, NYC311 key, notify service, parking area, CalDAV binding) are untouched.
  • Add matching i18n strings to strings.json and translations/en.json (kept byte-identical).
  • Bump manifest.json version 3.3.0-rc3 → 3.3.0-rc4.

Test plan

  • tests/test_config_flow_reconfigure.py — 8 new cases: handler advertises the step, form renders with current entity as default, single_config_entry doesn't block reconfigure, submit persists + reloads, options/CalDAV/NYC311 untouched, entry.data merged not replaced, resubmitting unchanged value is a no-op.
  • Full suite green except 6 pre-existing failures in tests/test_sign_retrieval.py (live NYC SODA API calls, blocked by pytest_socket), confirmed identical on unmodified main.
  • ruff check clean on changed files.
  • Manual check in a running HA instance: Reconfigure action appears on the integration card and swapping the tracker preserves all other settings.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

https://claude.ai/code/session_01VQxcp5EeadKNjM5u7WAR2r

Pascal-ZeGerman and others added 6 commits August 25, 2026 10:23
…S source

- ASPParkingConfigFlow.async_step_reconfigure: single-step form re-showing the
  device_tracker EntitySelector, pre-filled with the entry's current value
- Submit merges via data_updates= (never data=) and aborts with the default
  reconfigure_successful reason; reload_even_if_entry_is_unchanged=False makes
  an identical re-save a true no-op
- Docstrings note the new entry point; no manifest/coordinator/__init__ change
…lation files

- config.step.reconfigure: title (no 'Step N of 3:' prefix -- standalone flow),
  description noting the reload and that other settings are preserved, and the
  device_tracker data label reused verbatim from config.step.user
- config.abort.reconfigure_successful so the frontend renders a sentence instead
  of the bare abort key
- translations/en.json copied verbatim from strings.json to keep the
  CI-enforced byte identity; literal English only, no curly braces or %key refs
… tests

- handler advertises async_step_reconfigure (the exact predicate behind
  ConfigEntry.supports_reconfigure / the Reconfigure card action)
- form renders at step_id 'reconfigure' pre-filled with the current tracker
- single_config_entry: true does not abort the flow
- submit persists to entry.data, ends in ABORT/reconfigure_successful, and
  schedules exactly one reload
- entry.options (thresholds + notify service) verified bit-for-bit untouched
- data_updates= merge pinned by a sentinel-key guard; the no-op path pins
  reload_even_if_entry_is_unchanged=False
- async_schedule_reload patched with MagicMock (sync @callback) in every submit
  test so a never-set-up MockConfigEntry cannot load the spatial index
Reconfigure flow for the GPS source device_tracker entity.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQxcp5EeadKNjM5u7WAR2r
async_step_reconfigure called async_update_reload_and_abort(), which
schedules its own reload -- but changing entry.data also fires the
integration's existing update listener (_async_options_updated), which
independently reloads too. A device_tracker swap therefore ran two full
unload/setup cycles for one user action. Switch to updating the entry via
async_update_entry() directly so the registered listener is the sole
reload trigger.

Also: dedupe the device_tracker EntitySelector schema shared by the setup
wizard and the reconfigure step into _device_tracker_schema(), fix the
config flow's stale "two-step" docstring, trim the same "no shared state"
rationale repeated across three docstrings down to one, replace the
reconfigure test that asserted on a mocked async_schedule_reload call
with one that registers a real update listener (now doubling as a
regression guard for the double-reload bug), and inline the single-use
_OPTIONS test fixture.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQxcp5EeadKNjM5u7WAR2r
CI's ruff format --check failed on the double-reload fix commit.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQxcp5EeadKNjM5u7WAR2r
@Pascal-ZeGerman
Pascal-ZeGerman merged commit ed42da9 into main Aug 26, 2026
17 checks passed
@Pascal-ZeGerman
Pascal-ZeGerman deleted the worktree-reconfigure-device-tracker branch August 26, 2026 18:23
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