-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
Update Hydrawise from the legacy API to the new GraphQL API #106904
Update Hydrawise from the legacy API to the new GraphQL API #106904
Conversation
Hey there @dknowles2, @ptcryan, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
419202a
to
66fb887
Compare
66fb887
to
9e2bf81
Compare
Still waiting for review after addressing all reviewer comments. |
9e2bf81
to
3caa569
Compare
Still waiting for a review. There are a number of issues that are batched up behind this PR. Would be nice to get it out of the way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a minor nit. Otherwise LGTM.
(I don't have commit permissions though, so we'll need @joostlek approval)
Ping? |
3caa569
to
a55256a
Compare
I rebased it. |
@joostlek ping? This has been open since January. What's missing to get this merged? We have more changes we'd like to make that are blocked on this. |
Mostly the fact that I am currently spending more time on my thesis so I have less time reviewing, but I'll try to find some time soon to take a look at it |
adding a +1 to get this reviewed so other features can be unblocked |
api_key: str | None = None, | ||
username: str | None = None, | ||
password: str | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this method have default values for its parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is called from two different places. It's either called with just the api_key or the username and password.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I see that, I'm just not a big fan of default values in cases like this.
I guess it's a matter of personal taste and it's OK like this.
# re-authenticate. | ||
return self.async_create_entry( | ||
title="Hydrawise", | ||
data={CONF_API_KEY: api_key} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we import the API key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate? This is the legacy path for old-style yaml files that contain the api key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this PR, the only reference to CONF_API_KEY
, outside tests and the config flow itself, is in async_setup_entry
. With the changes in this PR, there's no longer any reference left to CONF_API_KEY
, outside tests and the config flow itself, instead, async_setup_entry
checks for the absence of username + password.
I guess we still want to store the API key for backwards compatibility though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @thomaskistler,
When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es).
The commits that are missing a linked GitHub account are the following:
02604b9c9d43be08bc70c15d9606e0092970addc
- This commit has something that looks like an email address (thomase@uyei-kistler.com). Maybe try linking that to GitHub?.
Unfortunately, we are unable to accept this pull request until this situation is corrected.
Here are your options:
-
If you had an email address set for the commit that simply wasn't linked to your GitHub account you can link that email now and it will retroactively apply to your commits. The simplest way to do this is to click the link to one of the above commits and look for a blue question mark in a blue circle in the top left. Hovering over that bubble will show you what email address you used. Clicking on that button will take you to your email address settings on GitHub. Just add the email address on that page and you're all set. GitHub has more information about this option in their help center.
-
If you didn't use an email address at all, it was an invalid email, or it's one you can't link to your GitHub, you will need to change the authorship information of the commit and your global Git settings so this doesn't happen again going forward. GitHub provides some great instructions on how to change your authorship information in their help center.
- If you only made a single commit you should be able to run
(substituting "Author Name" and "
git commit --amend --author="Author Name <email@address.com>"
email@address.com
" for your actual information) to set the authorship information. - If you made more than one commit and the commit with the missing authorship information is not the most recent one you have two options:
- You can re-create all commits missing authorship information. This is going to be the easiest solution for developers that aren't extremely confident in their Git and command line skills.
- You can use this script that GitHub provides to rewrite history. Please note: this should be used only if you are very confident in your abilities and understand its impacts.
- Whichever method you choose, I will come by to re-check the pull request once you push the fixes to this branch.
- If you only made a single commit you should be able to run
We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community.
Thanks, I look forward to checking this PR again soon! ❤️
02604b9
to
0e6ebf0
Compare
result = await self._create_entry( | ||
import_data.get(CONF_API_KEY, ""), | ||
result = await self._create_or_update_entry( | ||
api_key=import_data.get(CONF_API_KEY, ""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not correct to use dict.get
here since configuring an API token is mandatory in the YAML schema.
api_key=import_data.get(CONF_API_KEY, ""), | |
api_key=import_data[CONF_API_KEY], |
According to issue description, the hydrawise import flow was scheduled for removal in Home Assistant Core 2024.4. I think it would be a good idea to remove the import flow first, and then rebase this PR after that's done since it would simplify this PR significantly. |
My, how time flies! |
@thomaskistler you should be good to rebase now. The old YAML support code was removed in #115966, which has been merged. |
7b5264d
to
e9a2e80
Compare
I rebased everything. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @thomaskistler 👍
…istant#106904) * Update Hydrawise from the legacy API to the new GraphQL API. * Cleanup
Breaking change
This change is fully backwards compatible in terms of functionality. However,
users will have to reauthenticate.
Proposed change
Move the Hydrawise integration from the old legacy Hydrawise API to the new
GraphQL API. This change is fully backwards compatible but will unlock new
functionality going forward.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: