Home Assistant Automation

Already combining Todoist with Alexa for a shopping list. We needed a quick way to add items from the Lovelace interface.

To do this a text helper was added with a script to add the item to the shopping list when ever the value was entered.

alias: Add to Shopping List
description: ''
trigger:
  - platform: state
    entity_id: input_text.add_list_item
condition: []
action:
  - service: script.send_to_shopping_list
    data: {}
  - service: input_text.set_value
    data:
      value: ''
    entity_id: input_text.add_list_item
mode: single

The called script adds the item to the todoist list and forces an entity update

alias: Send to shopping list
sequence:
  - service: todoist.new_task
    data:
      content: '{{ states(''input_text.add_list_item'') }}'
      project: Alexa Shopping List
  - service: homeassistant.update_entity
    entity_id: calendar.alexa_shopping_list
mode: single
icon: 'mdi:basket'

Finally a lovelace template card shows the information. With an input box below text-input-row is a HACS download called “Lovelace Text Input Row”.

type: vertical-stack
cards:
  - type: markdown
    title: Shopping List
    content: >-
      {%- for item in states.calendar.alexa_shopping_list.attributes.all_tasks
      -%}
          {{item}}{{" \n    "}}
          {%- endfor -%}
  - type: entities
    entities:
      - entity: input_text.add_list_item
        type: 'custom:text-input-row'