Automate Shopping Lists with Home Assistant

Automate notifications for your shopping list, so you never forget to pick up an essential item ever again!

Automate Shopping Lists with Home Assistant

Intro

We're all guilty of forgetting things that we need at the shop. It's even worse if your significant other requests something specific and then you forget about it when you eventually get there!

To help me with this, I set up a shopping list page in our dashboard that both of us can go in and easily add as many items as we want/need too. Then when we have everything we need, we can easily clear them away or archive them, ready to reuse for next time!

Even better, I have set it up so that when we do go to the shop, Home Assistant will send us a notification asking us if we'd like to open our shopping list and tapping on it brings us straight to the dashboard view - no more forgetting!

Here is the process:

Scroll right the the bottom for the YAML code 👇🏼

How It's Done

Requirements:

  • At least one person setup in Home Assistant
  • At least one smartphone connected to Home Assistant with the companion app with location tracking enabled.
  • The phone assigned to the person.

Creating a zone

First we need to create a zone in Home Assistant which will be the location of our shop - then when a person enters this zone, we can trigger a notification.

To create a zone, head over to the sidebar of Home Assistant and click on Map. Then click on the pencil in the top right corner, and create a zone - wherever your shop is or wherever you want the zone to be. The size can be of the zone can be adjusted to suit your needs by dragging the white pin.

Add the Shopping List integration

Then go back to Settings, then Devices & Services, Integrations and add integration, then search for Shopping list and add.

Creating a Shopping List Dashboard

Next we're going to create a dashboard with our shopping list on it - this allows us to go in and add or remove items from our shopping list for easy viewing.

Head over to your dashboard, hit the three dots in the top right and select edit dashboard.

I would recommend creating a new dedicated view for your shopping list but you don't have to if you don't want to.

Create a new view by hitting the plus button near the top:

Then give the view a name and hit save - the URL will auto-populate:

Finally, hit the add card button and search for shopping list, then add the shopping list card:

Save your dashboard by hitting "Done" in the top right hand corner.

You can now use this to go in and add or remove items to your shopping list, as well as archive frequently used items.

Before you leave, make sure to copy the URL of this dashboard, you will need it later. Only copy the section after your port number:

The Automation

Last step is to create an automation, this will handle the notification to our phone.

Head back to Settings, Automations & Scenes and create a new automation.

Give your automation a name, then in the trigger section, select Zone from the Trigger drop down menu. Then select the person you want to "track" and then in Zone, select the Shop (this is the zone we created in the very first step).

Skip pass Conditions and go straight to Actions.

Choose "Call Service" from the action type drop down menu, then as the Service, choose the service that alerts your phone - this usually starts with "notify" followed by the name of your phone.

Write a message, then ensure the data section is ticked - then paste in the following string:

clickAction: /lovelace-mushroom/shopping-list
url: /lovelace-mushroom/shopping-list

Notice how the action is the URL we copied from our dashboard earlier - make sure to replace this with your own URL.

Hit the save button, and you are done!

Here is the code for anyone who does their automations in YAML:

alias: Notify - Shopping list
description: ''
mode: single
trigger:
  - platform: zone
    entity_id: person.lewis
    zone: zone.the_shop
    event: enter
condition: []
action:
  - service: notify.mobile_app_pixel_6
    data:
      message: Open your shopping list?
      data:
        clickAction: /lovelace-mushroom/shopping-list
        url: /lovelace-mushroom/shopping-list

The Result

Now whenever the person you are tracking enters the shop zone, they will receive a notification asking them to open the shopping list: