Improved Shopping List! + Bring! + Google Assistant

HUGE UPDATE:

Hi everybody,

As you know, the official shopping list integration has been recently updated. On the other hand, the integration with Bring! It is outdated and does not work correctly anymore.

For this reason I have implemented this new interface that allows you to control the official integration of the shopping list. It is inspired by the Bring! app and enhanced by HA automations. You can read full guide at this link

Changes from the previous version include:

  • Fully works with the official Home Assistant integration, making installation easier and improving performance.
  • Redesign of the lovelace cards, improving functionality and giving a similar appearance to the Bring! application.
  • No more dependencies on other integrations, improving performance and simplifying installation.
  • Added new features such as notifications, product suggestions, ingredient recipes or membership cards.
  • Easier to install through blueprint.

However, I need your help to fix the following issues:

  • When a product is added through Assist, it cannot be managed by the list. I think it is because it adds the product to the list followed by a blank space, but then this blank space is not taken into account anymore (and therefore it does not find the product when it is called from one of the services).

  • I have not been able to modify the blueprint so that notifications can be sent to different devices

Hope you like it, and some of you can help to keep improving it!

1 Like

Nice work @TiToTB

I have created the command line sensors but there’s something up with the auto entities card (which I am not familiar with)

I noticed your variable name changed :

            {%- set product = LISTA.split(',')[INDEX] -%}
            {%- if producto == 'Zanahorias' -%}

so I set them all to ‘product’ but I still get the same problem. Gracias.

[Edit] : I think I fixed it, the card blows up when icon variable is not set, so I’ve set a default value for it :

type: conditional
conditions:
  - entity: sensor.items_in_shopping_list_number
    state_not: '0'
card:
  type: vertical-stack
  cards:
    - type: custom:mushroom-title-card
      title: Shopping List  ({{ states('sensor.items_in_shopping_list_number')}})
      title_tap_action:
        action: none
      card_mod:
        style: |
          ha-card {
            --title-font-size: 20px !important;
            margin-left: -10px;
            margin-top: -15px;
            margin-bottom: -20px;
          }
    - type: custom:auto-entities
      show_empty: false
      card:
        square: true
        type: grid
        columns: 3
      card_param: cards
      filter:
        template: |-
          {% set LIST = states('sensor.items_in_shopping_list_list') %}
          {% set icon = 'mdi:basket' -%}
          {% set ITEMS = states('sensor.items_in_shopping_list_number') | int %}
          {% for INDEX in range(ITEMS) -%}
            {%- set product = LIST.split(',')[INDEX] -%}
            {%- if product == 'carrots' -%}
              {%- set icon = 'mdi:carrot' -%}
            {%- elif product == 'tuna' or  product == 'salmon' -%}
              {%- set icon = 'mdi:fish' -%}
            {%- elif 'Beer' in product -%}
              {%- set icon = 'mdi:beer' -%}
            {%- endif -%}
          {{
            {
              'type': 'custom:mushroom-template-card',
              'entity': 'sensor.items_in_shopping_list_number',
              'icon': icon,
              'multiline_secondary': 'true', 
              'secondary': product,
              
              'layout': 'vertical',
              'fill_container': 'true',
              'tap_action': {
                'action': 'call-service',
                'service': 'shopping_list.complete_item',
                'data': { 'name': product }
               },
              'style': 'ha-card { background: linear-gradient( rgba(238, 82, 79, 1), rgba(181, 42, 39, 1) ); --icon-size: 50px; --card-secondary-font-size: 11px; --secondary-text-color: #ffffff; };',
              
              
            }
          }},
          {%- endfor %}

1 Like

Thanks! You are right!

I changed the code for the examples and i broke it in the way… I think is already fix!!

Please, let me know any other issue!

Your ‘add new item’ card is missing the action to add the item.

It does not :sweat_smile: It works with an input text helper. It adds the product when the value changes. I didn’t find the way to make it more elegant… Anyway, does it work properyly for you?

As i said, suggestions to improve it are welcome :slight_smile:

I noticed this too, brings up a blank page. I use the bring integration which is very helpful with Alexa. What shopping list can be used in HA with Voice Assistants

I think the problem with blank space can be fixed.

I’m trying to create an automation that:

  1. Triggers when the last character of the product is a blank space (so far ok)
  2. Remove the product. Here’s the problem, because I can’t get it to take white space into account from the code. However, I can delete it from developer tools.
  3. Add the product again without the blank (easy)

Maybe someone can help with step 2. I’ve tried with strings, intend…

UPDATE:

I have modified the blueprint so when the shopping list exceeds ‘x’ products, the notification can be sent to multiple devices, in addition to being able to customize the title of the notification.

To apply the new version, delete the previous version and import the blueprint again.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

have you seen this Project?

I have! I will probably get this idea in a future version!

1 Like

I am using the picture elements bit at the moment, well it worked to add one item then last night it started throwing errors when I tried to choose other products, I’ll take a look today and start gathering pics as that has not been shared :confused:
on a side note, I was wondering if we could change the “Shopping List” to another ToDo List, I am a bit OCD and anal LOL and I have called it Groceries rather than shopping list and I have a ToDo List called Groceries so would like to use that…

While i congratulate you for the effort, i dont; think this is really the best way to go about it. Too much manual setup and configuration.

Next time I get a wet weekend, I’ll take the time to intergrate bring! with the new HA To-Do list (ie – what replaced the shopping list)

3 Likes

I agree, unfortunately my skills are limited :sweat_smile:

I can’t wait to see your Bring! integration, that would be great.

Also, if you are interested, feel free to use my design to create a Lovelace Card!

I wasn’t aware of android shortcuts - Android Shortcuts | Home Assistant Companion Docs - I’ve just created a shortcut to my shopping list page :slight_smile:

1 Like

Nice!! i wasn’t aware neither! Thanks a lot!

I just added it to the guide :slight_smile:

Im nearly there re Bring! and Todo list integration. It seems to be working.

3 Likes

I’ve installed it :smiley:
having a couple of teething problems at this stage. Hope you are all good with some feedback, wish I could do more to help but I am dumb as when it comes to any dev work sorry.

The words get translated into German in HA from the Bring app :slight_smile: This might be an opportunity to learn German, I was hopeless when I was over there LOL
Adding items from Bring works but only if you type it in and press the plus sign from HA will it add a product.
If the product has a tick next to it in HA it will not get unticked and added to the list in HA even if you add it in Bring
When I untick an item to add it it errors out with …

[140599125697088] BringTodoItem(summary='Nice and Natural', uid='bring_item_Nice_and_Natural', status=<TodoItemStatus.NEEDS_ACTION: 'needs_action'>) is not in list
[140599125697088] BringTodoItem(summary='Baby wipes', uid='bring_item_Baby_wipes', status=<TodoItemStatus.NEEDS_ACTION: 'needs_action'>) is not in list
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 230, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
    response_data = await _handle_entity_call(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/todo/__init__.py", line 249, in _async_update_todo_item
    await entity.async_update_todo_item(item=update_item)
  File "/config/custom_components/bring/todo.py", line 122, in async_update_todo_item
    item_key = self._items.index(search_bring_item)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: BringTodoItem(summary='Nice and Natural', uid='bring_item_Nice_and_Natural', status=<TodoItemStatus.NEEDS_ACTION: 'needs_action'>) is not in list

The German thing is … weird.
It happened to me too, but just on a single list and as one off.

Ive been unable to replicate it so its potentially fixed. The original code i “borrowed” had some weird translation stuff in it, which i have ripped out as it seemed to be doing some odd things.

Which version have you installed? Updates in bring should be resolved as of 1.1.0. Based on the log output it looks like you have an older version, so try updating it.

aaah, I was on 0.0.2, that was the latest when I downloaded it a few hours ago :), installing 1.1.0, will let you know how I get on.
Awesome stuff by the way :slight_smile:

all good – the 2 things i worked on overnight where the things you mentioned.
There was an issue checking and unchecking items on the list.

And changes you made in bring werent synced to HA.

In my testing, both of those are sorted now.