Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper function to update and reload config entry to config flow #108034

Merged
merged 5 commits into from
Jan 22, 2024

Conversation

jpbede
Copy link
Member

@jpbede jpbede commented Jan 14, 2024

Proposed change

We currently use something like the following in a lot of our config flows:

self.hass.config_entries.async_update_entry(
    self.existing_entry,
    data={
        CONF_EMAIL: user_input[CONF_EMAIL],
        CONF_PASSWORD: user_input[CONF_PASSWORD],
    },
)
await self.hass.config_entries.async_reload(
    self.existing_entry.entry_id
)
return self.async_abort(reason="reauth_successful")

So I thought it would be nice to have an helper function for this.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

bdraco
bdraco previously requested changes Jan 15, 2024
Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are failing, please check. Thanks

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft January 15, 2024 07:01
@bdraco bdraco dismissed their stale review January 15, 2024 07:02

not a block

@jpbede jpbede marked this pull request as ready for review January 15, 2024 07:43
@jpbede jpbede merged commit 988d72b into home-assistant:dev Jan 22, 2024
53 checks passed
@jpbede jpbede deleted the config-flow-update-helper branch January 22, 2024 16:40
@jpbede
Copy link
Member Author

jpbede commented Jan 22, 2024

Thanks

bdraco added a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in august

uses the new helper from #108034
bdraco added a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in powerwall

uses the new helper from #108034
bdraco added a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in yalexs_ble

uses the new helper from #108034
bdraco added a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in bthome

uses the new helper from #108034
jpbede pushed a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in isy994

uses the new helper from #108034
joostlek pushed a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in enphase_envoy

uses the new helper from #108034
jpbede pushed a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in shelly

uses the new helper from #108034
jpbede pushed a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in samsungtv

uses the new helper from #108034
jpbede pushed a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in onvif

uses the new helper from #108034
bdraco added a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in apple_tv

uses the new helper from #108034
bdraco added a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in enphase_envoy

uses the new helper from #108034
bdraco added a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in bond

uses the new helper from #108034
bdraco added a commit that referenced this pull request Jan 22, 2024
Use new config entry update/abort helper in sense

uses the new helper from #108034
cgarwood pushed a commit that referenced this pull request Jan 22, 2024
…108689)

Use new config entry update/abort helper in enphase_envoy

uses the new helper from #108034
jpbede pushed a commit that referenced this pull request Jan 23, 2024
Use new config entry update/abort helper in bond

uses the new helper from #108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
…ome-assistant#108034)

* Add helper function to update and reload config entry to config flow

* Use async_create_task

* Remove await

* Reload only when update & add task name

* Rename function
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
…8673)

Use new config entry update/abort helper in august

uses the new helper from home-assistant#108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
…#108674)

Use new config entry update/abort helper in powerwall

uses the new helper from home-assistant#108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
…8676)

Use new config entry update/abort helper in bthome

uses the new helper from home-assistant#108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
…t#108677)

Use new config entry update/abort helper in xiaomi_ble

uses the new helper from home-assistant#108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
…t#108675)

Use new config entry update/abort helper in yalexs_ble

uses the new helper from home-assistant#108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
…8678)

Use new config entry update/abort helper in isy994

uses the new helper from home-assistant#108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
…tant#108679)

Use new config entry update/abort helper in enphase_envoy

uses the new helper from home-assistant#108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
…8684)

Use new config entry update/abort helper in shelly

uses the new helper from home-assistant#108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
…#108683)

Use new config entry update/abort helper in samsungtv

uses the new helper from home-assistant#108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
)

Use new config entry update/abort helper in onvif

uses the new helper from home-assistant#108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
…ome-assistant#108689)

Use new config entry update/abort helper in enphase_envoy

uses the new helper from home-assistant#108034
catsmanac pushed a commit to catsmanac/ha-core-dev that referenced this pull request Jan 23, 2024
Use new config entry update/abort helper in bond

uses the new helper from home-assistant#108034
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2024
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.

None yet

2 participants