Shopping list, is it possible to trigger an action when something is added?

I have seen it is possible to added items to the shopping list via automations.

But if i add something to the list manually, is it possible to send to a notification to say something has been added to the list?

normally i would use state change on an entity but the shopping list has no entity…

I created a sensor for it based on python script…

  - platform: command_line
    name: shopping_list
    command: python3 /config/custom_components/custom_sensor/shopping_list_open_items.py
#--------------------------------------------------------------------------------------------------
# Creates sensor with shopping list items
#--------------------------------------------------------------------------------------------------

#!/usr/local/bin/python
# coding: utf8
import json

with open('/config/.shopping_list.json') as data_file:
    shoppingListData = json.load(data_file)

content = u"Shopping List:\n"
for entry in shoppingListData:
    if not entry['complete']:
        content += u"- %s\n" % entry['name']
content += u"\n"
print(content)
2 Likes