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 a DataUpdateCoordinator to Hydrawise. #92305

Closed
wants to merge 70 commits into from

Conversation

dknowles2
Copy link
Contributor

Proposed change

This adds a DataUpdateCoordinator to the Hydrawise integration.

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 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:

@home-assistant
Copy link

Hey there @ptcryan, mind taking a look at this pull request as it has been labeled with an integration (hydrawise) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of hydrawise can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign hydrawise Removes the current integration label and assignees on the pull request, add the integration domain after the command.

Copy link
Member

@gjohansson-ST gjohansson-ST left a comment

Choose a reason for hiding this comment

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

Some initial comments

homeassistant/components/hydrawise/__init__.py Outdated Show resolved Hide resolved
except (ConnectTimeout, HTTPError) as ex:
_LOGGER.error("Unable to connect to Hydrawise cloud service: %s", str(ex))
LOGGER.error("Unable to connect to Hydrawise cloud service: %s", str(ex))
Copy link
Member

Choose a reason for hiding this comment

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

Remove logger and persistent notification and raise ConfigEntryNotReady


async def _async_update_data(self):
"""Fetch the latest data from Hydrawise."""
result = await self.hass.async_add_executor_job(self.api.update_controller_info)
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't look like we use the coordinator to fetch any data?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does. The update_controller_info() method caches the data inside the api object. (Not how I would have designed the API, but it's what I'm working with)

I can pull out the relevant data if you really want me to, but I also want to replace the API eventually with https://github.com/dknowles2/pydrawise/ which uses the newer GraphQL version of the Hydrawise service. The data returned by that API will be vastly different than this one, so I'd rather not create more work for myself later.

@home-assistant home-assistant bot marked this pull request as draft May 3, 2023 11:57
@home-assistant
Copy link

home-assistant bot commented May 3, 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.

allenporter and others added 18 commits May 4, 2023 13:23
…2313)

* Retry onvif setup when it is unexpectedly cancelled

fixes home-assistant#92308

* Retry onvif setup when it is unexpectedly cancelled

fixes home-assistant#92308
home-assistant#92312)

* Reduce size of migration transactions to accommodate slow/busy systems

related issue home-assistant#91489

* handle overloaded RPIs better
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
* db_url fix

* Add test

* assert entry.options
Co-authored-by: Franck Nijhof <git@frenck.dev>
* Migrate unique IDs of Rituals Perfume Genie

* Fix doc string
bdraco and others added 26 commits May 4, 2023 13:23
* Bump bluetooth-auto-recovery to 1.1.0

https://github.com/Bluetooth-Devices/bluetooth-auto-recovery/releases/tag/v1.1.0

In home-assistant/operating-system#2485 is was discovered that a more aggressive reset strategy is needed due to a yet unsolved bug in the linux 6.1.x kernel series

* bump to 1.1.1 since event 47 cannot be decoded (newer kernels only)
* Migrate cloud settings for all Alexa entities

* Also set settings for unknown entities
…nt#92450)

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
* Fix lingering timer in lifx

* Remove duplicate code
@dknowles2
Copy link
Contributor Author

Ah crap, I screwed up my branch trying to remerge. I'm going to close this and send a clean version.

(One day I'll figure out how to use git properly)

@dknowles2 dknowles2 closed this May 4, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 5, 2023
@dknowles2 dknowles2 deleted the hydrawise-duc branch May 24, 2023 23:03
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