The goal here is to filter the items section of the attributes to contain items for which the value of responsible_uid matches the UID I want. This will allow me to create a UI card on the dashboard that shows only the tasks that are assigned to a specific user in Todoist.
I tried adding a json_attributes_path to the sensor, but it returned blank results.
Here is the configuration I have that get me close to the result I need:
The only way I know (which does for sure not mean that is all ) is via jq…this would mean to rewrite this as a command_line curl and add pipe through jq to filler and possibly recreate (format) the json message. I donot know the todoist json so cannot make more exact statements.
That’s out of my wheelhouse. What of the Todoist JSON would help you with the original problem? Do you need to see the resulting JSON from the GET command?
I can give it a stab but then indeed I need to have a full json output, you can remove most items just leave 2… one you want and one you donot want.
EDIT: to not pollute this post you can open a DM here or in discord (same username)
To my knowledge, you cannot do this (different JSON paths for individual attributes) directly all within one sensor. You could create a template sensor that pulls out those entries from the full list in the REST sensor, or use the REST integration and create two sensors from a single API request where the second one has the json_attributes_path.
Boo lame. ;). The only workaround I can think of is making a completely separate project in Todoist for each user.
Or, I suppose I could do something like this directly in a Markdown card, but then I lose all of the functionality of the Todoist card in HACS. This below just creates a simple list of all tasks that were completed in Todois for a given day, regardless of the project they’re in. I would have to adjust it to pull from the correct sensor.
{% for group in states.sensor.tasks_completed.attributes['items']| groupby('project_id') %}
{% for item in group[1] | list %}
{% set borf = as_datetime(as_timestamp(strptime(item.completed_at[:19],"%Y-%m-%dT%H:%M:%S"))|int - 25200)|as_local()%}
{% if borf.strftime("%Y-%m-%d") == states.sensor.date.state %}
{{item.content}}
{% endif %}
{% endfor %}
{% endfor %}
I suppose I could group the “for item” by “responsible_uid” and that would split up the tasks.