Custom Component: Google Tasks (revived)

This should be possible, I may try and accomplish it if I find some spare time. It would add another level of complexity to the config, but should be doable with a <div> with height = 1px, set the background to a color, set the margins and done.

Possibly add one config entry "hr_color: " to the card config. If not set - no rule. If set, rule of noted color. Give it a class, and let y’all customize it in cardmod.

I went ahead and added a crude separator:

On phone:

@myntath : here is a link to my .js if you want to compare and push the changes: gtasks-card.js.

I have added three possible config entries:
show_hr: true/false ( default false )
hr_color: hex, name ( default ‘white’, can be 4 byte hex with alpha )
hr_end: true/false ( default true ) set false to remove last hr after final event.

cardmod: css class: ‘hr-separator’ ( you can over-ride everything there, height, width, etc., etc… )

1 Like

hi, do i need to do anything other than replace paper-input with ha-textfield please? because i have tried that and it does not appear to have worked!
much appreciation and thanks to everyone working on this integration, which i much prefer and would rather keep using if i can fix this one issue!
thanks again

Where are you changing it? If you change it in the js file you will need to rename the .gz file to something like “.gz.old”, and clear your browser cache. Make sure to change the </paper-input> closing tag also. No other changes were necessary for me.

If you make a bunch of changes in the js file you might have to add “?v=1” after the .js resource in settings-dashboards “…” Resources. Increment once for each change and clear cache. It’s a pain but it works.

Hopefully @myntath will get around to pushing the changes. Otherwise I would consider forking it.

I get the erro how can I fix it? and what does it mean?

This error originated from a custom integration.

Logger: custom_components.gtasks
Source: custom_components/gtasks/init.py:223
Integration: GTasks (documentation)
First occurred: November 19, 2023 at 11:51:05 PM (3 occurrences)
Last logged: 12:30:05 AM

<HttpError 503 when requesting https://tasks.googleapis.com/tasks/v1/lists/MTYyNDc4NjU4NDcyODYxNzAxOTE6NDIxNzc0Nzc5MjU2OTA4NDow/tasks?showCompleted=false&maxResults=100&alt=json returned “The service is currently unavailable.”. Details: “[{‘message’: ‘The service is currently unavailable.’, ‘domain’: ‘global’, ‘reason’: ‘backendError’}]”>
<HttpError 503 when requesting https://tasks.googleapis.com/tasks/v1/lists/MTYyNDc4NjU4NDcyODYxNzAxOTE6MDow/tasks?showCompleted=false&maxResults=100&alt=json returned “The service is currently unavailable.”. Details: “[{‘message’: ‘The service is currently unavailable.’, ‘domain’: ‘global’, ‘reason’: ‘backendError’}]”>
Traceback (most recent call last):
File “/config/custom_components/gtasks/init.py”, line 223, in update_data
tasks_list_sensor = await self.hass.async_add_executor_job(request_sensor.execute)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/googleapiclient/_helpers.py”, line 130, in positional_wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/googleapiclient/http.py”, line 938, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 503 when requesting https://tasks.googleapis.com/tasks/v1/lists/MTYyNDc4NjU4NDcyODYxNzAxOTE6NDIxNzc0Nzc5MjU2OTA4NDow/tasks?showCompleted=false&maxResults=100&alt=json returned “The service is currently unavailable.”. Details: “[{‘message’: ‘The service is currently unavailable.’, ‘domain’: ‘global’, ‘reason’: ‘backendError’}]”>

Got it, thanks
It was renaming the gz file and the clearing the cache that I needed to know.
Thanks again

1 Like

Love the potential of this! I’m trying to set this up but am constantly getting the cant find credentials file error. Any thoughts?
cred missing

Hi All,

Looks like there is still a use case for this component for now so I will continue to update it. That being said I’m pretty busy at the moment and probably won’t have much time for a while.

@russ-sentient if you are able to make a pull-request for you fix and/or change it would be appreciated.

I would try use the full rather than relative path for the credentials file as a first step.

Is this still happening? Looks like a temporary Google issue. If it is still happening have you tried these tips:

  • If the Google refresh token is revoked or otherwise not working you may need to delete the component and setup again. This can happen if you change your password or through various other means. In addition make sure you delete the ‘token.pickle’ file which was created in your writable path.
  • If the refresh token is being revoked every 7 days make sure that in Google OAuth you have set the publishing status of your Google OAuth consent screen to ‘In production’. If the status is still in testing then the token expires after 7 days.
  • Your OAuth Client ID must be type ‘Desktop’.
1 Like

Not super familiar with how to use git hub as a creator but I will look into it. I am also busy / going out of town today for the holiday so I will see if I can find the time. About to drive 15 hours tonight :sweat_smile:

I am having trouble with the integration today, my list isn’t fully importing. The status of the sensor entities looks like it has the correct count but the attributes are missing half the events. I will look into it, but I am wondering it this is also on Google’s end. Going to try setting the integration up from scratch again. ( need my tasks list on my calendar panel today more than any day lol )

EDIT: It is updating for me, but for some reason one of my long lists with many tasks and subtasks is only pulling 5/20 parent tasks and their sub tasks. Not the card setting for show_quantity because the tasks are missing from attributes. Wondering if one of the characters I have used in the task names is escaping from the code. I see no errors in the log. Strange.

Did you download the credentials file from the Google API setup step and place it in the root config folder on your home assistant? I used the built in vscode addon and made a new file called credentials.json and just copied the one from the Google API setup steps into it. Hope this helps.

cred file
Hey Guys thank you for your responses, my apologies I was at work.

  • When I try can copy the full file path is just reverts to the path above
  • I did the same and downloaded the json file from google before copying and pasting it into a file called credentials.
  • To confirm this should be licensed as a desktop app right?

Out of interest if there was an issue with the credentials would this still present as file not found?

It has been a while since I have set it up, but I believe Desktop is correct. I use the vscode addon and just created a root folder called gtasks and added it there.

I believe by default it looks for the credentials.json file in the same root folder that configuration.yaml is in, try that and let me know if it works without changing anything in the integration setup configuration.

The text field for adding a new task isn’t appearing. Clicking the add button just gives me the following error: Failed to call service gtasks/new_task. required key not provided @ data['task_title’] In the developer options I can create a new task using a service call with no issues. Let me know if there is something I’m missing or need to do. Thanks.
image

There was an issue with ‘paper-input’ being deprecated. If you are on the latest commit Update gtasks-card.js · myntath/lovelace-gtasks-card@f693d40 · GitHub (I haven’t created a new version for this yet) then this should fix it.

When I have some time I will tidy up the look and make a new version.

Looks like the new(ish) Google Tasks integration finally outmodes the HACS addon for me. It supports due dates. It was easy as pie to add and once I figured out the automation I needed from it, I now have my tasks fully integrated into Home Assistant.

Thanks @myntath for keeping this going for so long.

The google task integration might be now mature enough such as the custom integration gtask-ha, but the todo-list card compatible with google task does not provide any option to filter or possibilities to influence the items appearing.
As gtask-card is only working with gtask-ha I will stick to the custom solution till out-of-the-box integration & card offers similar functionality.
Thanks @myntath for all your work!

Somehow I had and attribute in my sensors called dueInDays, but suddenly, gone.

How did this happen? Can someone help me?
This attribute would make things easier on the frontend and for templates… Thanks in advance.