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 config flow to Hydrawise #95589

Merged
merged 45 commits into from
Sep 23, 2023
Merged

Conversation

dknowles2
Copy link
Contributor

@dknowles2 dknowles2 commented Jun 29, 2023

Breaking change

Hydrawise integration no longer supports configuration by YAML. Existing YAML configurations will be imported automatically and can safely be removed.

Proposed change

Add config flow to Hydrawise.

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

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.

@smoki3
Copy link

smoki3 commented Jun 30, 2023

Hi,

I think you have to move the termination date for the yaml to 2024.1.

With 2023.7 they say it have to work at least 6 months:

https://github.com/home-assistant/architecture/blob/master/adr/0021-YAML-integration-configuration-deprecation-policy.md

@joostlek joostlek added the deprecation Indicates a breaking change to happen in the future label Jun 30, 2023
@smoki3
Copy link

smoki3 commented Jul 6, 2023

ping?

@dknowles2
Copy link
Contributor Author

Hi,

I think you have to move the termination date for the yaml to 2024.1.

With 2023.7 they say it have to work at least 6 months:

https://github.com/home-assistant/architecture/blob/master/adr/0021-YAML-integration-configuration-deprecation-policy.md

6 months is a long time. I wonder if I should go back to my original approach and migrate to the new API at the same time as introducing config flow. The old API seems to be broken for most people at this point (based on user reports), so I'm not sure it's even worth maintaining compatibility. Then we just keep the existing code for the old API with the 6 month deprecation window, and the new code can carry on without having to worry about it.

@gjohansson-ST
Copy link
Member

6 months is a long time. I wonder if I should go back to my original approach and migrate to the new API at the same time as introducing config flow. The old API seems to be broken for most people at this point (based on user reports), so I'm not sure it's even worth maintaining compatibility. Then we just keep the existing code for the old API with the 6 month deprecation window, and the new code can carry on without having to worry about it.

Not sure what a new api has anything to do with a config flow?
Perhaps what you mean with an api change makes sense but that should not stop this PR so I hope you continue this one as anyhow for anyone using the integration or want to set it up it's a good thing.

Thanks
G

@dknowles2
Copy link
Contributor Author

Not sure what a new api has anything to do with a config flow?

The new API uses user/password authentication instead of an API token. So if we do config flow now and then migrate to the new API, users will have two migrations in quick succession.

Making the switch to config flow at the same time as the API change means only a single breaking change. That seems nicer from a user's point of view.

@gjohansson-ST
Copy link
Member

Making the switch to config flow at the same time as the API change means only a single breaking change. That seems nicer from a user's point of view.

Nothing breaks with the config flow as we should do an import, we just need to tell people to remove the yaml after the import has been made.

The api change with all it considerations needs to be it's own PR/change anyhow so it would seem easier to me to do the config flow first and second the api change in a separate PR

@dknowles2
Copy link
Contributor Author

Making the switch to config flow at the same time as the API change means only a single breaking change. That seems nicer from a user's point of view.

Nothing breaks with the config flow as we should do an import, we just need to tell people to remove the yaml after the import has been made.

The api change with all it considerations needs to be it's own PR/change anyhow so it would seem easier to me to do the config flow first and second the api change in a separate PR

Okay, I updated the deprecation dates. We can leave this as-is and I'll do the full API migration separately.

homeassistant/components/hydrawise/strings.json Outdated Show resolved Hide resolved
homeassistant/components/hydrawise/switch.py Outdated Show resolved Hide resolved
homeassistant/components/hydrawise/switch.py Outdated Show resolved Hide resolved
@home-assistant home-assistant bot marked this pull request as draft August 19, 2023 10:02
@dknowles2 dknowles2 marked this pull request as ready for review August 29, 2023 11:30
@smoki3
Copy link

smoki3 commented Sep 21, 2023

Ping: Any update needed? as 2023.10 is coming soon.

@dknowles2
Copy link
Contributor Author

Ping: Any update needed? as 2023.10 is coming soon.

@gjohansson-ST If you don't have time to review this, can you unassign and let someone else review? This has been ongoing for almost 3 months, which is a long time for a relatively simple change that's blocking other updates.

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.

Looks good. Just need to fix so CI passes (requirements fails).

requirements_test_all.txt Outdated Show resolved Hide resolved
@home-assistant home-assistant bot marked this pull request as draft September 23, 2023 18:18
@dknowles2
Copy link
Contributor Author

Looks good. Just need to fix so CI passes (requirements fails).

Fixed.

@dknowles2 dknowles2 marked this pull request as ready for review September 23, 2023 19:19
@joostlek
Copy link
Member

Codeowners file doesnt seem up to date, please run hassfest

@dknowles2
Copy link
Contributor Author

Codeowners file doesnt seem up to date, please run hassfest

Done.

@joostlek
Copy link
Member

Huh, strange that it didnt get this change from the rebase

@joostlek
Copy link
Member

Oh right, something went wrong in another PR. We have to do another rebase soon as it doesnt belong here.

@dknowles2
Copy link
Contributor Author

Huh, strange that it didnt get this change from the rebase

Agreed. Running hassfest again fixed it. 🤷🏻

@gjohansson-ST
Copy link
Member

Once #100772 has merged do a rebase and this is fine to be merged (given no other CI errors)

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.

Thanks @dknowles2 👍

@joostlek joostlek merged commit f8a8fe7 into home-assistant:dev Sep 23, 2023
34 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2023
@dknowles2 dknowles2 deleted the hydrawise-config-flow branch October 13, 2023 12:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
by-code-owner cla-signed code-quality config-flow This integration migrates to the UI by adding a config flow deprecation Indicates a breaking change to happen in the future has-tests integration: hydrawise new-feature Quality Scale: No score
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants