Grocery shopping

The following is far from complete and instructions will follow.

How nice would it be if you could scan an products barcode and have it added to your shoppinglist?

I’ve purchased a GM861 barcode reader and connected it to a Wemos D1 flashed with Tasmota. An automation will trigger whenever a barcode has been scanned and will add that barcode to the shopping list. Next on the todo list is create a script that’ll query EAN-search.org and have the name of the item put on the shoppinglist. When this is complete I could try to integrate it with a real supermarket or something else.

Tasmota Instructions

  • flash the Wemos D1 device with Tasmota,
  • connect the RX of the GM861 to the TX of the Wemos D1 and connect the TX of the GM861 to the RX of the Wemos D1, connect power to the 3.3v and ground to GND on the Wemos,
  • Enter in the console: Backlog Baudrate 9600; SerialSend 2; SerialConfig 8N1; SerialLog 2

GM861 Instructions

  • Scan the QR the following QR codes with the GM861: chapter 1.6 Setup code on, chapter 1.6 Output, chapter 2.1 Serial Output, chapter 7.6 Close tail, leave all other settings as is,

MQTT Sensor

In the below sensor change ****TOPIC**** to the topic of your device

mqtt:
  sensor:
    - name: "Barcode"
      state_topic: "tele/****TOPIC****/RESULT"
      value_template: '{{ value_json.SerialReceived }}'

Automation

alias: Add barcode to shoppling list
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.barcode
condition: []
action:
  - service: shopping_list.add_item
    data:
      name: "{{ states(\"sensor.barcode\") }}"
mode: single
4 Likes

I don’t want to slow you down in your adventure, but have you seen Grocy? :smiley:

You can install it as an AddOn in HA-OS and there is a custom_component available for extended use in HA. I’d highly recommend an AddOn for Grocy called BarcodeBuddy. It has the lookup in a few different databases for the product code (not only EAN) and you can scan products to add them to your shopping list. This is also available as an AddOn for HA-OS. You can do a lot more and it works quite well (can’t remember the last error).

2 Likes

Yep, grocy seems nice but my findings are that this has a considerable effort in setup/maintenance, if you want a simple list then grocy ‘sucks’ noting that it is a nice tool though, not just for everyone

I’m totally with you, the first setup or better the configuration can be a nightmare with Grocy. But I’m quite sure, if one wants to use it to its full extend, one knows that every **** thing that you want to track must be read and configured once.

Grocy in combination with BarcodeBuddy can do scanning and adding to the shopping list. As far as I know without the whole configuration nigtmare. But I’m not 100% sure on this.

Coming back to the initial post, both Grocy and BarcodeBuddy could be helpful in getting the OPs own “app” running, maybe the part to lookup the codes can be used. :slight_smile:

Question…did you try to make it work with the phone? As I am not taking esp stuff on a shopping spree :slight_smile:
This is where bar-code budy may help…
I am interested to spend a bit of time on it too just not this week and possibly not next.

You mean BarcodeBuddy? There is an app for Android: Click here

This works ok, depending on what exactly you want to achieve, there should be some approaches that could work. For example, right now you need to change modes in BarcodeBuddy->Grocy via scanning a specific barcode (changing from purchase to use or vice versa). The same should be doable with some kind of script as well.

And if all this fails, you can always use Grocy and BarcodeBuddy via their mobile pages (assuming you open your Grocy installation).

I know and tested BCB with grocy but not sure if/how this would work directly with HA (without grocy). never tried. Search on web does not reveal much more other then scan, share with HA…which is not what I would want too
I see a solution with a barcode server but all in all, I only want to use my phone, scan a BC and then it would auto-do things. As mentioned, no time this/next week but will try to dig into this a bit more. Mayby BCB can bypass grocy?