fix(config_flow): 🐛 stop DHCP discovery double-reloading config entries#670
Merged
Conversation
- DHCP rediscovery updates the entry's host/port via _abort_if_unique_id_configured(updates=...), which by default also has core schedule its own reload - our update listener already reloads the entry on any data/options change, so the core-scheduled reload was redundant and triggered HA's "has an update listener and should use it for scheduling a reload" deprecation warning, set to break in 2026.12.0 - pass reload_on_update=False so core skips its own reload and leaves it to our listener Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Base automatically changed from
fix/options-flow-update-interval-serialization
to
main
July 4, 2026 11:43
Closed
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.
🐞 Problem
🔍 Root cause
__init__.pyregisters a generic update listener (entry.add_update_listener(update_listener)) whose body unconditionally callshass.config_entries.async_reload(...). Home Assistant firesupdate_listenerson any entry change, not just options-flow changes — including data changes.async_step_dhcpinconfig_flow.pycalls_abort_if_unique_id_configured(updates={...})to silently keep a rediscovered device's host/port in sync. That data update:update_listener, which schedules a reload, andreload_on_updatedefaults toTrue, core also schedules its own reload for the same entry, logging this deprecation warning in the process.So a single DHCP rediscovery currently triggers two redundant reload schedules for the same entry. HA is deprecating this combination and it will stop working in 2026.12.0.
🔧 Fix
Pass
reload_on_update=Falseto_abort_if_unique_id_configuredinasync_step_dhcp, since our own update listener already reloads the entry whenever its data changes. Core no longer needs to (and shouldn't) schedule a second reload.🧪 Testing
pytest -k dhcp -q— 5 passedruff check— cleanbasedpyright— 0 errors✅ Test plan
🤖 Generated with Claude Code