Repository navigation
Add reconfigure flow for GPS source device_tracker (3.3.0-rc4) - #42
Merged
Merged
Conversation
…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
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.
Summary
ASPParkingConfigFlow.async_step_reconfigureso the GPS sourcedevice_trackerentity can be changed via Settings > Devices & Services > ASP Parking > Reconfigure, without deleting and re-adding the integration.device_trackerEntitySelector, pre-filled with the currently configured entity. Submitting a new value merges intoentry.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). Allentry.options(thresholds, NYC311 key, notify service, parking area, CalDAV binding) are untouched.strings.jsonandtranslations/en.json(kept byte-identical).manifest.jsonversion3.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_entrydoesn't block reconfigure, submit persists + reloads, options/CalDAV/NYC311 untouched,entry.datamerged not replaced, resubmitting unchanged value is a no-op.tests/test_sign_retrieval.py(live NYC SODA API calls, blocked bypytest_socket), confirmed identical on unmodifiedmain.ruff checkclean on changed files.Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
https://claude.ai/code/session_01VQxcp5EeadKNjM5u7WAR2r