An AppDaemon solution for multiple shopping list

I did create an Appdaemon application designed to manage multiple shopping lists as show in the animated screenshot bellow:

MultipleShoppingList_demo2

The features

  • A dropdown list entry is listing the shops.
  • When the selected shop is changed the relevant shopping list is loaded
  • Each time an item is added or updated, a backup of the shopping list for the active shop is saved.
  • If you configure zones for the shops and configure a notification service, the automation will send a notification with a shortcut to the relevant shop.
    Note: A shopping list can be associated with multiple zone, this is done by checking if the beginning of the zone name match with a shop.

Note: persons and notification are optional. It is thenpossible to use this application as a to do list

Installation

Requirement

This application is using Appdaemon you should then install this add-on to be able to use it.

Shopping list entry

Create a new entry to gather your favorite shops.

From entry, create a new dropdown list and enter the list of shops

Dashboard installation

Create a new dashboard and add the dropdown list and the shopping list widgets. The yaml of your page should look like this:

title: Liste de courses
views:
  - cards:
      - type: vertical-stack
        cards:
          - type: entities
            entities:
              - entity: input_select.shops
          - type: shopping-list

Shops zone definition

Zone are used to define shops area. These shop area are used to automatically select active list and trigger notification. The beginning of zone’s friendly_name has to match the shop name as defined into options of dropdown list described upper.

Example: Zone “zone.Biocoop_Grenoble” and “zone.Biocoop_Voiron” will both use the shopping list named “Biocoop

AppDaemon application installation

The script is available into my github.

First, copy shopping_list.py and notifier.py into your apps folder.

Notifier script has been written by jlpouffier (JLo) · GitHub and original version is available here. I let you read how to configure it into the comments inside the code.

Here is an example showing how I update my apps.yaml to use it:

notifier:
  module: notifier
  class: Notifier
  log: notifier_log
  home_occupancy_sensor_id: binary_sensor.home_occupied
  proximity_threshold: 500
  persons:
    - name: Xavier
      id: person.xavier_berger
      notification_service: notify/mobile_app_sm_a405fn
      proximity_id: proximity.distance_xav_home

For ShoppingList configuration you should add the following lines into your apps.yaml file:

  • shopping_list:
    • module: shopping_list
    • class : ShoppingList
    • shops: input_select gathering the shops to manage
    • tempo: delay ins seconds between list population and item complete update (recommended: 0.1). If complete item are not set correctly, increase this value
    • notification_url: url of shopping list’s lovelace card used in notification
    • notification_title: title display in notification. This text will be prefixed by the zone name
    • notification_message: message to display in notification
    • persons: List of person to notify when they enter into shop zone (OPTIONAL)
      • name: username as defined in notifier application (used for notification)
        id: a user as defined in notifier application (used for zone tracking)
 shopping_list:
   module: shopping_list
   class: ShoppingList
   log: shopping_list_log
   shops: input_select.shoppinglist
   tempo: 0.1
   notification_url: "/shopping-list-extended/"
   notification_title: "Shopping list"
   notification_message: "Show shopping list"
   persons:
     - name: Xavier
       id: person.xavier_berger

Final word

I hope you found this topic useful or at least interesting. Fill free to share your comment and feedback. If necessary, I’ll update the main message to make it easier to understand.

2 Likes

Real cool, bruder!

Love it, now make it sort the items by category (veggie, fruit, cooler, freezer etc.)
I managed to write an appdeamon that sorts by category but i still have to find out how i can install it onto my home assistant :smiley:
Chatgpt is a great tool xD