Custom component : Google Tasks (abandoned)

Nice, Iā€™ll check it out a bit when I have time.

I have actually done all the code for subtasks I just havenā€™t made it into a release yet. Iā€™ll do that in a bit but feel free to test it if you want. I think you just have to set your HACS to use Master instead of the latest version.

1 Like

Thanks for the hard work guys. Iā€™m stuck entering the auth code, Iā€™ve copied text between code= and & scope= , but Iā€™m getting unknown error occurred. Is there something Iā€™m doing wrong?

1 Like

How hard would it be to poll for new lists? I have added 2 new lists to google tasks and without deleting and reconfiguring the integration I canā€™t seem to get them to show up in HA.

@dopacak - what does your log say when it fails? I might be able to help you with more information from your logs.

Hello, the same thing happens here, did you manage to solve it?

Yep. I was trying to add this component too and Iā€™m getting the same error. Does anyone solved this problem?

For anyone who is installing this on Home Assistant Snap I was using path:

/var/snap/home-assistant-snap/current/custom_components/gtasks/credentials.json

and

/var/snap/home-assistant-snap/current/custom_components/gtasks/

Thanks

EDIT: Iā€™ve solved issue by checking HA logs. There is info:

HttpError 403 when requesting https://tasks.googleapis.com/tasks/v1/users/@me/lists?alt=json returned "Tasks API has not been used in project ā€¦before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/tasks.googleapis.com/overview?.ā€¦ then retry.

Iā€™ve opened this URL, enabled Google Tasks API and it worked :slight_smile:

I am using Gtasks-Ha (0.5.2) together with gtasks-card (0.1.4) and I am facing an Error message at Dashboard once I set a task to done:

Failed to call service homeassistant/update_entity. Entity ID sensor.gtasks_šŸ§ā€ā™‚ļø Bastian is an invalid entity ID for dictionary value @ data['entity_id']

I am wondering if someone also notices this message?
Propably it is caused because I am using Icons in my different Tasklists Names:

What does the binary sensor check?
and is there still no time only date in the api?

/fredrik

I believe the binary sensor just tells you if the task list is empty or not. I have never used it. It has some attributes as well but I havenā€™t updated these.

At the moment only date is used. Showing time would be a good additional feature.

I tried to replicate this but for me it was working with a task list called ā€˜Test :smiley:ā€™ and tasks both with and without emojiā€™s. I could create them and set them to done.

Are you having the same issue with lists without the emoji?

ok cool.
Yes time would be cool. looking into to use the sensor to trigger an automation to disable or turn of entities if tasks in a list is not done
like turning of my ps4 if I have not done a task or something like that or preventing me to start it if I am not finished with a task.
to help me to stop procrastinating.

Iā€™ve just looked into exposing the due time as I thought it would be simple to add. Turns out it canā€™t be done.

https://issuetracker.google.com/issues/128979662?pli=1

Google does not expose the due time in the public api. Also confirmed in the API documentation, REST Resource: tasks Ā |Ā  Google Tasks Ā |Ā  Google Developers

If google ever updates the API which seems unlikely after 3 years Iā€™ll make sure to implement it.

1 Like

Thank you for checking. They will probably not fix that but itā€™s ok. I can work around it. I checked and it looks like the binary_sensor tells if a task is overdue and what task it is.

Finally I was able to test on my instance also without emoji. Here I did not received that message.
Then I thought probably the icon at the end of the name, like yours, could be different, but also for another task list ā€˜Test :smiley:ā€™ Iā€™ve received the error message again.
During this ecexise I deinstalled and installed the component several times as the system option ā€œEnable newly added entitiesā€ is not considering new task lists automatically. So also a clean re-install doesnā€™t help.

Thanks for the further report. Iā€™ve looked into this a little more. On my setup when I hit the ā€˜tickā€™ button the entity_id (which is this.config.entity) value doesnā€™t include the emojis and so it goes through just fine, home assistant doesnā€™t seem to mind that the emojiā€™s are excluded. If I manually set the entity_id to include any emoji then I get the same issue as you.

It may be that this is due to some difference in browsers or environment. What browser and OS are you using? What type of Home Assistant install do you have? I tried on a few different browsers but all still worked fine.

It seems the error message can be ignored and the list will update by itself a few minutes later as well at least for me. If I can find an environment that replicates the issue then hopefully I can fix it otherwise I think you can either ignore it or drop the emojiā€™s from the list name.

I had this (awesome) component working up until a couple of days ago and now I canā€™t get it set up again. I canā€™t remember what the paths were and after trying to set it up fresh I believe it is there it stops for me.
I have a path to credentials as follows:
/config/custom_components/gtasks/credentials/credentials.json
and in the setup of the integration, Iā€™ve tried many different paths. Some give ā€œCouldnā€™t find credentialsā€ and some give ā€œUnknown errorā€.
From logs: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packa - Pastebin.com
Any help is much appreciated.

update: solved it, I messed up and missed a part of the documentation. had my app i test.
a couple of days ago tuesday/wednesday. the integration stoped working due to the token not working.
ā€œinvalid_grant: Token has been expired or revoked.ā€™, {ā€˜errorā€™: ā€˜invalid_grantā€™, ā€˜error_descriptionā€™: ā€˜Token has been expired or revoked.ā€™})ā€
i have tried to create token file but to no avail.

any tips on what is goind on?

Thanks for looking into it again!
As you said it is not a critical bug, I can easily bypass by avoiding emojies at Tasklist names, but I am a fan of supporting by reporting such oberservations.

My system is
Home Assistant 2023.3.3
Supervisor 2023.03.1
Operating System 9.5
Frontend 20230309.0 - latest

Browser is Chrome, but the same message occures with Edge and even with HA Android App.

I also played a bit with renaming the entities w/o emoji within HA only. For reading open tasks no negatibve impact at dashboard is visible, but ticking off a task is not working anymore.

I am also wondering about the data model as the device is shown twice with, once with sensor ON/OFF and once with task numbers #. Probably this can be merged to reflect at device level the task list only.

I also recognized that the icon on device view is missing, probably due to the fact that the integration has no icon.

Iā€™ve now been trying to create new credentials, and even a new project, but still the same ā€œunknown errorā€. Any help is really appreciated. This is very frustrating as I see this integration as crucial for my family dashboard.

It appears as if details are being loaded from the ā€˜token.pickleā€™ file rather than the credentials.json. Have you tried deleting the token.pickle file? Otherwise you could just change the writable path.

If you get your ā€˜Unknown Errorā€™ then you credentials path is right and there is no need to change that.

Do you ever get through to the stage where you get a URL to click so you can copy the authorisation code?

If you still get an error after deleting the token.pickle file please provide a paste of that as it may help narrow the issue.

I may make an update so that the token.pickle file is deleted if it fails to refresh the token. Otherwise it does seem you may get stuck at this point. New credentials.json are ignored while the component tries to keep refreshing from the previous token.

Thanks for the further details. Seems we can rule out the browser. Although if I canā€™t duplicate your issue I might ask for some more details.

I also have the issue with the duplicates (this is due to the binary_sensor and the sensor, Iā€™ll have to look into binary_sensor to see if it completely redundant can can just be removed it marks overdue tasks I believe) and the icons so I donā€™t think that is causing the emoji list. I might fix those up if I find the motivation but they all existed when I forked the repo. Otherwise pull requests are welcome :slight_smile:

I run ā€˜Home Assistant Coreā€™ but I assume you are running ā€˜Home Assistant Operating Systemā€™ from those specs. I do have a spare raspberry pi with that installed so I will try get some time to test on that one. What hardware are you using?

I believe that the error you are getting is from the ā€˜updateā€™ process initiated by the card. The way the component works is that the card first requests the component change the task list and when that is complete with google it then requests home assistant to update the component data. Your error appears to relate only to how the update request is called and not to the change. The update also occurs on a timer (may take a few minutes). Can you confirm if the task is removed from the list after waiting for a few minutes even though there is the error? If not there may be additional error information in the homeassistant.log file that would be helpful.

Also do you have the same issue with creating a new task? I would suspect that you would.