Skip to content

Allow loading UniFi entities on config options change#88762

Merged
frenck merged 3 commits into
home-assistant:devfrom
Kane610:unifi-load_entities_on_options_change
Mar 6, 2023
Merged

Allow loading UniFi entities on config options change#88762
frenck merged 3 commits into
home-assistant:devfrom
Kane610:unifi-load_entities_on_options_change

Conversation

@Kane610
Copy link
Copy Markdown
Member

@Kane610 Kane610 commented Feb 25, 2023

Breaking change

Proposed change

Builds on #88571
Unblocks #84942
During the refactoring of UniFi I didn't take care of how to trigger loading of entities based on changed config options. This PR brings this functionality back.

PR consists of two parts

  1. Controller and entity keep registry of loaded objects
  2. Fix tests to once again validate loading entities on changed options work

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
  • The code has been formatted using Black (black --fast 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:

@Kane610 Kane610 force-pushed the unifi-load_entities_on_options_change branch from beb4fe1 to 6036472 Compare March 3, 2023 18:36
@Kane610 Kane610 mentioned this pull request Mar 3, 2023
19 tasks
Copy link
Copy Markdown
Contributor

@starkillerOG starkillerOG left a comment

Choose a reason for hiding this comment

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

Looks good to me :)
Took me a while to figure out how it works ;)

@Kane610
Copy link
Copy Markdown
Member Author

Kane610 commented Mar 3, 2023

Looks good to me :)
Took me a while to figure out how it works ;)

Thanks! Well yes, lots of mechanisms going on :)

@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label Mar 5, 2023
Comment thread homeassistant/components/unifi/controller.py Outdated
Comment thread homeassistant/components/unifi/entity.py
Comment thread tests/components/unifi/test_sensor.py
@home-assistant home-assistant Bot marked this pull request as draft March 6, 2023 09:36
@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented Mar 6, 2023

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.

@frenck frenck removed the smash Indicator this PR is close to finish for merging or closing label Mar 6, 2023
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
@Kane610 Kane610 marked this pull request as ready for review March 6, 2023 10:52
@home-assistant home-assistant Bot requested a review from frenck March 6, 2023 10:52
Copy link
Copy Markdown
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @Kane610

@frenck frenck merged commit 9ff45ca into home-assistant:dev Mar 6, 2023
@Kane610 Kane610 deleted the unifi-load_entities_on_options_change branch March 6, 2023 16:41
@Kane610
Copy link
Copy Markdown
Member Author

Kane610 commented Mar 6, 2023

Thank you @frenck 🎉

Comment thread tests/components/unifi/test_sensor.py
jpbaltazar pushed a commit to jpbaltazar/inels-home-assistant that referenced this pull request Mar 8, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 9, 2023
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.

4 participants