Skip to content

Add option to ignore flows#30008

Merged
balloob merged 1 commit into
devfrom
ignore-flows
Dec 18, 2019
Merged

Add option to ignore flows#30008
balloob merged 1 commit into
devfrom
ignore-flows

Conversation

@balloob
Copy link
Copy Markdown
Member

@balloob balloob commented Dec 16, 2019

Description:

Add option to create "ignored" config entries. Can be created based off any config flow in progress that have a unique ID set. Includes websocket API for this too.

Hue has been updated to still show the ignored hosts as options to configure when starting a manual configuration.

Config entry that is ignored will not be set up and thus not be passed to async_setup_entry.

@bramkragten will work on a UI piece for this.

Only config flows that have unique IDs can be ignored. Since it depends per integration on what is a unique ID, we can't automatically fill this in. Each integration needs to add it themselves. Example of Hue inside ssdp and homekit:

https://github.com/home-assistant/home-assistant/blob/58b5833d64cd66401d313206595ce582125f8f9f/homeassistant/components/hue/config_flow.py#L167-L168

Calling self.async_set_unique_id will by default abort the current config flow if another config flow is already in progress. To abort if the unique ID is part of a config entry, call self._abort_if_unique_id_configured().

I am not 100% sure yet if this is the right abstraction or that we can move the "abort if in progress" part to the self._abort_if… call. I'll revisit this pattern if a few more config flows are updated.

Builds on top of #29806 and #30000.

CC @Jc2k

Related issue (if applicable): fixes home-assistant/architecture#250

Pull request with documentation for home-assistant.io (if applicable): TBD

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@probot-home-assistant
Copy link
Copy Markdown

Hey there @home-assistant/core, mind taking a look at this pull request as its been labeled with a integration (config) you are listed as a codeowner for? Thanks!

@Jc2k
Copy link
Copy Markdown
Member

Jc2k commented Dec 16, 2019

@balloob Looking good! I’ve pushed a branch to my github that adds async_set_unique_id to homekit_controller, will try and finish this off ASAP.

@balloob balloob merged commit 9c7caaa into dev Dec 18, 2019
@delete-merged-branch delete-merged-branch Bot deleted the ignore-flows branch December 18, 2019 06:41
@lock lock Bot locked and limited conversation to collaborators Dec 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce friction around discovery and persistent notifications

3 participants