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

Google Task Plugin only importing open (need_action) tasks, ignoring completed tasks #122359

Closed
CodePutz opened this issue Jul 22, 2024 · 3 comments · Fixed by #122437
Closed

Comments

@CodePutz
Copy link

The problem

Hi there. Not sure if this is the correct forum for this sort of bug report. The Google Tasks plugin can set task in HA as completed, which marks them as such and moves them down in the list. They also get updated at Google to show completed. And they can be unmarked again. All is well with HA->Google. However, when marking a task as completed at Google, upon sync, the local copy of that task simply disappears. It should probably be marked as completed and treated just like if it was completed in HA rather than removed. I suspect the sync (Google->HA) is only polling for open tasks (need_action) and not any task (need_action or completed). Seems like an easy fix, but I'm unsure where to correct that in the code. Would someone, or the author of that plugin, mind taking a look and correcting it such that completed task get pulled into HA as well?

What version of Home Assistant Core has the issue?

2024.7.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Google Tasks

Link to integration documentation on our website

https://www.home-assistant.io/integrations/google_tasks

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

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

Code owner commands

Code owners of google_tasks can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign google_tasks Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


google_tasks documentation
google_tasks source
(message by IssueLinks)

@allenporter
Copy link
Contributor

Thanks for the report. Reading the API docs, there is a field showCompleted which defaults to true.

However, it also says Note that showHidden must also be True to show tasks completed in first party clients, such as the web UI and Google's mobile apps. but showHidden is False. I think this is the case you are referring to deleting tasks from the google website.

So perhaps setting showHidden will fix this, but just need to be careful to see what else is returned when doing that.

@CodePutz
Copy link
Author

Ah, very nice. I fixed it by adding "showHidden=True" as well as "showCompleted=True" to your code (api.py). Restarted HA and now it's pulling in completed tasks!!

homeassistant:/usr/src/homeassistant/homeassistant/components/google_tasks# grep -n Hidden api.py

71: tasklist=task_list_id, maxResults=MAX_TASK_RESULTS, showHidden=True, showCompleted=True

I don't think this will have any ill effects. I can see where adding 'showDeleted' may cause problems though. :)

Anyway, it's working as intended for me now. Thank you so much for the nudge in the right direction. I would recommend making that change in the official repo so that others can benefit from it as well.

Thanks again!

@github-actions github-actions bot locked and limited conversation to collaborators Aug 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants