Hi,
i try to get todoist running. Which it does actually.
But i created a couple of projects in todoist to manage my family.
Now, the todoist (powertodoist) documentation is about creating a template sensor using rest, another sensor using/parsing a curl response to retrieve tha labels, and a rest_command for updating.
That’s a okay, i guess.
Yet, i would have to duplicate the rest-sensor for every project i created in todoist.
While getting deeper into it, i learned, you could as well create a restful sensor type querying all projects at once (and labels included).
- resource: 'https://api.todoist.com/sync/v9/sync'
method: GET
headers:
Authorization: !secret todoist_api_token
params:
sync_token: '*'
resource_types: '["projects","items","sections","labels"]'
scan_interval: 10
sensor:
- name: label_colors
unique_id: label_colors
value_template: >
{{ value_json['labels'] | length }}
json_attributes:
- labels
- name: todoist_projects
unique_id: todoist_projects
json_attributes:
- projects
- name: todoist_items
unique_id: todoist_items
json_attributes:
- items
- name: todoist_sections
unique_id: todoist_sections
json_attributes:
- sections
(I’ll sort details later)
however, while the REST request works fine when testing with postman,
it fails to execute in HomeAssistant.
Error returned is:
Data fetched from resource: {"error":"Invalid argument value","error_code":20,"error_extra":{"argument":"resource_types","event_id":"549d4ac7589a4774b39c6dc60803b2ca","expected":"Value error, Expecting value: line 1 column 1 (char 0)","retry_after":1280},"error_tag":"INVALID_ARGUMENT_VALUE","http_code":400}
I can’t figured out what’s wrong, since Home Assistant would not write the request into the logs, only rest responses (I wasn’t able to find out how to log posted requests)
I can only recreate the error with postman, when i’m editing the line “resource_types” like removing quotes etc.
I don’t know what Home Assinstant is doing with this parameter. Do i need to escape some characters or else?
Postman screenshot:
best regards
Maik