How can i update .shopping_list.json?

Hi again everybody, as some of you may notice i am working on shopping list integration.

I got nice results, but i am unable to update .shopping_list.json. It seems like it only updates when an item is complete MANUALLY from shopping list card.

Also i think service “shopping_list.complete_item” does not work, or i can not make it work.

I am pretty sure i am not the first to get to this point, but i did’t find the answer.

What is the best way to trigger .shopping_list.json updating?

Thanks in advance

Plenty of services that you can use in automations etc…
The instruction has to be ‘exact’ and does work, try it out from here and then you can copy the yaml elsewhere

You can also trigger a notification when the state of that sensor changes. e.g. when someone adds something then send message to …

alias: "Message: Shopping list when update"
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.shopping_list
condition: []
action:
  - service: notify.mobile_app_iphonea
    data:
      message: "{{states.sensor.shopping_list.state}}"
      title: UPDATE
      data:
        actions:
          - action: URI
            title: Open Url
            uri: /shopping-list
mode: single

EDIT
or send a message when you enter the zone of a supermarket, below is for the one I defined as the zone superu

alias: "Message: shopping zone entry"
description: ""
trigger:
  - platform: zone
    entity_id: device_tracker.iphonea
    zone: zone.superu
    event: enter
condition: []
action:
  - service: notify.mobile_app_iphonea
    data:
      message: "{{states.sensor.shopping_list.state}}"
      title: Boodschappen herinnering
      data:
        actions:
          - action: URI
            title: Open Url
            uri: /shopping-list
mode: single

I tried here and it didn’t work.

Does it work for you?

Thanks again, but this is not what i am looking for. I created couple sensors based on .shopping_list.json, and that is why i need to to refresh it.

Can you provide a bit more details…very hard to guess, I guess you need to refresh these new sensors?

For now, i got this conclussions (i may be wrong):

  1. Shopping list integration works over a file called “.shopping_list.json”. This file is located in /config folder.

  2. This file contains a list of items (products), which has an attribute “complete” with two possible values (false/true). This is a dinamic file. It gets updated when you make changes from shopping list card.

  3. I assume this is not a problem if you work only within Home Assitant, but i am working with Bring! shopping list app. I can get shopping list card syncronized, but it doesn’t update “.shopping_list.json”, so the card is syncronized, but not the base file.

  4. The only way i found to trriger file refresh is to add a product to the shopping list from Home Assistant. I am looking for a solution to refresh the file when the shopping list card is syncronized with Bring! app.

As i am writting i think i might found a provisional solution…

I am not using bring so then do not have this issue :slight_smile:
But why would you need both bring and shopping list ?
And have you seen this?
How to replace Home Assistant’s shopping list with Bring! (home-assistant-guide.com)

And this one
dotKrad/hass_bring_shopping_list_component: Component for bring shopping list integration (github.com)

I use Bring! because i like the interface and usability of the app, and i like it on HA to create automations.

Yes, i have seen them and in fact i am using it to achive it, but i am triying to get beyond.

What sensors do that integration provide? You could try calling the HA update service on one of the sensors, which might force the update you’re looking for. You can go even further by watching the file with a file watcher and then trigger an automation to call the abovementioned service.

I found a solution to geit it refreshed. I just add a fake item to the list from HA. It is not the cleanest way, but it works :sweat_smile:

You can find full details here, and i would love to get ideas to improve it!