Hello All,
I am trying to make a script that will check that an item isn’t already in a to do list before adding it. I am having trouble referencing the Fields in three template checking if the item is already in the list. this is what I have so far:
sequence:
- action: todo.get_items
metadata: {}
data:
status: needs_action
response_variable: todo
target:
entity_id: "{{ to_do_list }}"
enabled: true
- if:
- condition: template
value_template: >-
{{ todo['{{ to_do_list }}']['items']|selectattr('summary','search','{{
list_item }}')|list|count > 0 }}
then: []
enabled: true
else:
- data:
item: "{{ list_item }}"
target:
entity_id: "{{ to_do_list }}"
action: todo.add_item
fields:
to_do_list:
selector:
entity:
multiple: false
filter:
- domain: todo
required: true
description: To Do List
list_item:
selector:
text: null
description: To Do List Item
required: true
alias: "To Do: Check then Add"
description: ""
I am getting the error:
Error: In 'not': In 'template' condition: UndefinedError: 'dict object' has no attribute '{{to_do_list}}'
Any help would be appreciated.
Thank you in advance!