home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.09k stars 29.16k forks source link

todo.remove_completed_items does nothing for google_tasks integration #115497

Open ejpenney opened 3 months ago

ejpenney commented 3 months ago

The problem

I would expect when making this service call:

service: todo.remove_completed_items
target:
  entity_id: todo.home_assistant_chores

All "completed" items in the Google Task list associated with that entity would be deleted, but they are not. I've tried running this with debug enabled but no messages appear, no errors. I see nothing related to todo or google_tasks. It simply does nothing.

What version of Home Assistant Core has the issue?

2024.4.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[bot] commented 3 months ago

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 commented 3 months ago

You're running 2024.3? Interesting, there was a bug with removing tasks where it would fail, but this was addressed in #115258

allenporter commented 3 months ago

I'm not able to reproduce this. Does it work when you use the UI to remove all completed items? Both the service and the UI work fine for me.

Maybe manually turning up debug logging in the logger for googleapiclient can give us more detail.

ejpenney commented 3 months ago

Neat, it does work from the UI, only service calls are failing.

Screenshot_20240413-090857.png

I enabled googleapiclient debug logging and see nothing in the logs.

Screenshot_20240413-090916.png

allenporter commented 3 months ago

Does the debug logging show anything when run from the UI?

ejpenney commented 3 months ago

No, I'm not seeing anything in the logs there either. Never sure if I get the config right for debugging:

Screenshot_20240413-102711.png

Sorry about the screen shots, I'd c+p but I'm out of town without my laptop...

I also noticed that when calling the service the completed items are disappearing from the list in Home Assistant but not from Google Tasks. Whereas if I press the UI button they disappear in both places.

allenporter commented 3 months ago

Google tasks has no local state, so home assistant only reflects what is on the server. That is when removing items, it sends a remove call then a query.

Are you sure this is using Google tasks?

ejpenney commented 3 months ago

Yes this is definitely Google Tasks:

Screenshot_20240413-125137.png

I tried reloading the integration and the "removed task" is still not visible in Home Assistant but is still present when I open Tasks via the Android app and the webpage:

Screenshot_20240413-125428.png

Screenshot_20240413-125404.png

ejpenney commented 1 month ago

Sorry about the delay, that weekend I was out of town ended with my dog dying and this fell off my radar...

I think giving this some space I was able to figure out what's going on. I did some more experimenting today and I created this TODO list: image

I then executed the completions as described in each task item, you can see the result here in GTasks: image

But interestingly this is not what I see in Home Assistant: image

I tried running:

service: todo.get_items
data:
  status:
    - completed
target:
  entity_id: todo.home_assistant_chores

But the items checked off via Google Tasks still do not appear on the list, they have completely disappeared and Home Assistant won't acknowledge them! So naturally when I tell Home Assistant to do the remove the items don't get removed. I suspect that this is why I'm seeing this behavior, that's typically our usage: The kids check their chores off in GTasks, HA clears the completed items (and allow repeats to re-create) every evening.

allenporter commented 1 month ago

So the issue is that completing a task in Google tasks doesn't show it on the home assistant side? Presumably they are not being returned from the tasks api anymore but there may be some status filtering