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 Google tasks integration, with initial read-only To-do list #102629

Merged
merged 7 commits into from Oct 25, 2023

Conversation

allenporter
Copy link
Contributor

@allenporter allenporter commented Oct 24, 2023

Proposed change

Add Google tasks integration, with an initial todo platform implementation for a read-only To-do list. The scope is reduced to make the initial PR easier to review, focusing on the skeleton and minimal platform implementation.

Work plan includes the following PRs:

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:

async def async_get_authorization_server(hass: HomeAssistant) -> AuthorizationServer:
"""Return authorization server."""
return AuthorizationServer(
authorize_url=OAUTH2_AUTHORIZE,
Copy link
Member

Choose a reason for hiding this comment

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

Side note: Shared application credentials between integrations came to mind when I read this. I don't remember what we said about this in the architecture discussion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I did as well. We just punted given there weren't many use cases at the time, and the auth methods were different between this. Since then we added many more for google, and some older auth methods were removed. It would be even better if we could make google calendar (the most popular) support web auth, so all creds could be compatible.

I'm happy to consider and design if this is a priorty for core developers to discuss with me (i'm not interested if it takes many months :) )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Following up, #103570 is an attempt to make google calendar support web auth so it could have compatible creds with other google integrations.

homeassistant/components/google_tasks/manifest.json Outdated Show resolved Hide resolved
homeassistant/components/google_tasks/manifest.json Outdated Show resolved Hide resolved
homeassistant/components/google_tasks/todo.py Outdated Show resolved Hide resolved
async_add_entities(
(
GoogleTaskTodoListEntity(
TaskUpdateCoordinator(hass, api, task_list["id"]),
Copy link
Member

Choose a reason for hiding this comment

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

Why do we use a coordinator if there's one coordinator per entity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, agree it is not striclty necessary as there is no sharing of data.

I'm only using it because it seems to be the easist way to handle all the best practices to move up the quality scale (exception handling, logging on exceptions, re-auth handling, etc), and seems nice for separating responsibilities.

Copy link
Member

Choose a reason for hiding this comment

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

Ok.

homeassistant/components/google_tasks/todo.py Outdated Show resolved Hide resolved
@home-assistant home-assistant bot marked this pull request as draft October 24, 2023 14:52
@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.

allenporter and others added 2 commits October 24, 2023 09:10
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
@allenporter allenporter marked this pull request as ready for review October 25, 2023 02:49
@bdraco bdraco added the smash Indicator this PR is close to finish for merging or closing label Oct 25, 2023
@allenporter allenporter merged commit 0cb0e3c into home-assistant:dev Oct 25, 2023
53 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants