Check if an item is on the shopping list

Suggestion, others may chime in too :slight_smile:
create a sensor that reads all the items into attribs

sensor:
  - platform: command_line
    name: shoppinglist
    command: >
          echo "{\"list\":" $( cat .shopping_list.json) "}" 
    value_template: > 
        {{ value_json.list | length }}
    json_attributes:
        - list     

Then you can use the logic as above

{{ x in state_attr('sensor.shoppinglist','list') | map(attribute='name') | list }}

instead of x you need to add the item-name, could be templated I guess but has to be a string

3 Likes