Add unique ID to config entries#29806
Merged
Merged
Conversation
577d31d to
fa53ed9
Compare
pvizeli
reviewed
Dec 12, 2019
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description:
AbortFlowexception to allow aborting config flows via an exceptionasync_set_unique_idfunction toConfigFlow. This will automatically check if an entry with same unique ID is already in progress and abort if so.To do: update Hue to add unique ID.
Marked as WIP because the current checks byasync_set_unique_iddo not work well. Example where it's not useful: Hue bridges can remove auth credentials for Home Assistant. The Hue config entry will detect this while being set up and open a new config flow to authorize. Now during authorization, setting the unique ID will abort the flow because the bridge is already configured (but with no longer valid auth). We can't just go ahead and delete the entry, because that will remove all customization, instead of the current approach where the new config entry takes over the old devices/entities. Will need some more thought.This is a first step in allowing config entries to be ignored for home-assistant/architecture#250. The next step will be to allow ignoring config flows that have a unique ID set.
Checklist:
tox. Your PR cannot be merged unless tests passIf the code does not interact with devices: