Skip to content

Instantly share code, notes, and snippets.

@davosian
Forked from andrew-codechimp/add_unique_todo.yaml
Created March 21, 2024 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davosian/de4ec1a1299fa3348b08af4cd1e75d28 to your computer and use it in GitHub Desktop.
Save davosian/de4ec1a1299fa3348b08af4cd1e75d28 to your computer and use it in GitHub Desktop.
Home Assistant - Add unique to-do item
alias: Add unique to-do
mode: single
icon: mdi:clipboard-list
sequence:
- service: todo.get_items
target:
entity_id: "{{ list }}"
data:
status: needs_action
response_variable: mylist
- if:
- condition: template
value_template: >-
{{
mylist[list]['items']|selectattr('summary','search',item)|list|count
== 0 }}
then:
- service: todo.add_item
metadata: {}
data:
item: "{{ item }}"
target:
entity_id: "{{ list }}"
fields:
item:
selector:
text: null
name: Item
description: The to-do item to add
required: true
list:
selector:
entity:
filter:
- domain: todo
name: List
required: true
description: The to-do list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment