Notifications on Items Added/Removed

Hi all,

With the improvements to the shopping list ( now To-do list) I wanted demonstrate to other newbies how you can automate off items added or removed, in my case, I send seperate notifications on items added or removed and I notify the person who has entered a zone (aka shops).

choose:
  - conditions:
      - condition: trigger
        id:
          - zone_pc
          - zone_sc
          - zone_wsc
      - condition: numeric_state
        entity_id: todo.shopping_list
        above: 0
    sequence:
      - variables:
          target: >
            {% set x = trigger.to_state.attributes.source %} {{
            states[x].object_id }}
      - service: notify.mobile_app_{{ target }}
        data:
          title: Shopping items are needed!
          message: >-
            {{ trigger.to_state.attributes.friendly_name }}, please review items
            that are needing purchase. Check them off when done.
  - conditions:
      - condition: template
        value_template: "{{ trigger.to_state.state | int > trigger.from_state.state | int }}"
    sequence:
      - service: notify.notify
        data:
          title: Shopping List Updated - Item Added
          message: An item has been added to the shopping list.
  - conditions:
      - condition: template
        value_template: "{{ trigger.to_state.state | int < trigger.from_state.state | int }}"
    sequence:
      - service: notify.notify
        data:
          title: Shopping List Updated - Item Removed
          message: An item has been removed from the shopping list.

2 Likes

Thanks,
I am trying to work with this to get to this behavior:

  • When an item is added:
    notify message: “Bananas added to the shopping list by %username%”.

  • When an item is completed:
    notify message: “Bananas crossed off the shopping list by %username%”.

Any idea on how this can be done?

1 Like

I’ve been trying to do this too and I don’t think it can be done. Because the automation is not triggered by a user, it’s triggered by the shopping list.

So any notifications being “sent” is being “sent” by the shopping list.