Using the google tasks integration - I’m trying to sort out how I can make an automation/or script to parse my tasks, and ship them off.
I can call the service, works as expected:
service: todo.get_items
target:
entity_id: todo.my_tasks
data:
status: needs_action
response_variable: tasks
I can template the results:
{% set tasks = {
"todo.my_tasks": {
"items": [
{
"summary": "Empty the Dorkbot bin",
"uid": "N3E2X2ZGWk1IdmhHSzFlUQ",
"status": "needs_action"
},
{
"summary": "Medicine reminder",
"uid": "dDJCNjN1LXVpX3JZNHFHSw",
"status": "needs_action",
"due": "2024-01-08"
}
]
}
} %}
{%- for item in tasks['todo.my_tasks']['items'] %}
{{ item.summary }}
{%- endfor %}
and it spits out the data I expect, the summary of both tasks in the list that are status = needs_action (in dev tools > templates)
I’m struggling on putting this together into an automation… The trigger is arbitrary (unless this needs to be a script that will assign the variable or something, but I couldn’t get that working either).
alias: Task Notify
description: ""
trigger: []
condition: []
action:
- service: todo.get_items
target:
entity_id: todo.my_tasks
data:
status: needs_action
response_variable: tasks
- wait_template: |-
{%- for item in tasks['todo.my_tasks']['items'] %}
{{ item.summary }}
{%- endfor %}
continue_on_timeout: true
- service: notify.mobile_app_pixel_8_pro
metadata: {}
data:
message: {{ tasks }}
mode: single
Any pointers would be greatly appreciated.