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 reauth flow to ring integration #103758

Merged
merged 3 commits into from Nov 15, 2023

Conversation

sdb9696
Copy link
Contributor

@sdb9696 sdb9696 commented Nov 10, 2023

Proposed change

Add reauthorisation flow to the ring integration. Currently token expiry requires users to delete and re-create the ring integration which is undesirable.

In order for this to work the ring_doorbell library that this integration uses has some new error types that need to be caught and handled by the integration. Hence it depended on PR Bump ring_doorbell to 0.8.0 and handle new exceptions which has now been merged.

N.B. I based these changes heavily on PR #103351 so many thanks to @dknowles2 and the reviewers on that PR.

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:

Copy link
Contributor

@allenporter allenporter left a comment

Choose a reason for hiding this comment

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

Overall looks great! I have some suggestions about readability improvements and think its best to do the dependency bump first in a separate PR fixing the compatibility issues, then doing reauth in a follow up. (I'll happily review quickly if you reference the bump pr)

homeassistant/components/ring/config_flow.py Show resolved Hide resolved
tests/components/ring/test_config_flow.py Show resolved Hide resolved
tests/components/ring/test_config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/ring/manifest.json Outdated Show resolved Hide resolved
homeassistant/components/ring/config_flow.py Outdated Show resolved Hide resolved
@home-assistant home-assistant bot marked this pull request as draft November 11, 2023 15:38
@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.

@sdb9696
Copy link
Contributor Author

sdb9696 commented Nov 12, 2023

Overall looks great! I have some suggestions about readability improvements and think its best to do the dependency bump first in a separate PR fixing the compatibility issues, then doing reauth in a follow up. (I'll happily review quickly if you reference the bump pr)

Thanks @allenporter, I have implemented all of your suggestions except for the dependency bump separation due to the reasons given on the other comment and in the PR description. Hopefully it makes sense and I cannot see another way on this occasion without making things very complicated. This is a one off issue as going forwards consumers of ring_doorbell will only catch the library specific exceptions rather than catching lower level implementation exceptions.

qq, should I Resolve Conversation myself when I've implemented the suggestion or wait for you to do it?

Many thanks!

@sdb9696 sdb9696 marked this pull request as ready for review November 12, 2023 13:29
@allenporter
Copy link
Contributor

qq, should I Resolve Conversation myself when I've implemented the suggestion or wait for you to do it?

My personal approach is:

  • Resolve comments I addressed that I believe were straight forward or non-controversial (e.g. i'm pretty confident I understood and addressed what they were asking me)
  • Leave open comments where either there was room for interpretation on what they were looking for and I'm not quite sure if i addressed it, or had additional questions, or I disagreed with the reviewer and have a different suggestion/stance.

tests/components/ring/test_init.py Outdated Show resolved Hide resolved
tests/components/ring/test_init.py Outdated Show resolved Hide resolved
@home-assistant home-assistant bot marked this pull request as draft November 12, 2023 15:37
@sdb9696 sdb9696 force-pushed the add_ring_reauth branch 2 times, most recently from 5e9f5f0 to 7a499a5 Compare November 13, 2023 16:30
@sdb9696 sdb9696 marked this pull request as ready for review November 14, 2023 07:50
@allenporter allenporter merged commit 182c40f into home-assistant:dev Nov 15, 2023
23 checks passed
@sdb9696
Copy link
Contributor Author

sdb9696 commented Nov 15, 2023

Many thanks @allenporter for all your help with this

@sdb9696 sdb9696 deleted the add_ring_reauth branch November 15, 2023 13:14
@github-actions github-actions bot locked and limited conversation to collaborators Nov 17, 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.

None yet

3 participants