diff --git a/source/_integrations/shopping_list.markdown b/source/_integrations/shopping_list.markdown index d1585f94319..2dfbe8a8b5a 100644 --- a/source/_integrations/shopping_list.markdown +++ b/source/_integrations/shopping_list.markdown @@ -59,18 +59,33 @@ Clear completed items from the shopping list. ## Using in Automations -The simplest way to use the shopping list with automations (e.g., when entering a zone with shops) is to create a notification that can be clicked to open the shopping list. +A `shopping_list_updated` event is triggered when items in the list are modified, with the following data payload attached to it. This can be used to trigger automations such as sending a push notification when someone adds an item to the shopping list, which when clicked, will open the list. + +| Data payload attribute | Description | +|------------------------|--------------------------------------------------------------------------------------------------------------------| +| `action` | What action was taken on the item. Either `add` for a new item being added, or `update` for an item being updated. | +| `item` | A dictionary containing details of the item that was updated. | +| `item.id` | A unique ID for this item | +| `item.name` | The text attached to the item, for example `Milk` | +| `item.complete` | A boolean indicated whether the item has been marked as complete. | {% raw %} ```yaml -- service: notify.notify - data: - title: "Time to shop?" - message: "Click to open the shopping list" +alias: "Notify on new shopping list item" +trigger: + - platform: event + event_type: shopping_list_updated + event_data: + action: "add" +action: + - service: notify.notify data: - clickAction: "/shopping-list" - url: "/shopping-list" + message: "{{ trigger.event.data.item.name }} has been added to the shopping list" + data: + clickAction: "/shopping-list" + url: "/shopping-list" ``` {% endraw %} +