Shopping list with NFC and Home Assistant

In this post we are going to see a practical example of the use of NFC tags or NFC tags in Home Assistant, in this case integrating it with our shopping list. NFCs will be stuck on the pantry door, When they are scanned, they will be added to the shopping list, and when you arrive at the supermarket the list will be sent to you in a message!

Total, What, in my case, on the back of the pantry I have placed several NFC stickers, each of them is associated with a food or product that we usually buy. Use at home is very simple, When something is needed, the NFC tag in question is scanned with the mobile phone and the food/product will be added to the Home Assistant shopping list (apart from the fact that you can ask the voice assistant, but today it's NFC). On top of each NFC tag with a DYMO we paste its text… and nothing, then we will do an automation, that when we are in the location that interests us (supermarket, shopping centre…) during, I do not know, 5 minutes, Well, let him send you the list in a message to your mobile phone.

The process is very simple, once we have acquired the NFC tags, we can write them one by one directly with our mobile devices (NFC-enabled phones or tablets, Of course). From the Home Assistant app > App Settings > NFC tags. Click on “Write NFC Tag” and we bring the NFC tag closer to the mobile phone… Click on “Change Identifier” to make this NFC ID more human and understand what we're scanning in a simple way.

I will rename this NFC tag something more ethical, what it refers to when we are going to scan it, in this case some dishwasher tablets and “Save”. From here we can do a test and read the NFC tag if we want to see that it has been written correctly.

To feed the shopping list, Well, we will work directly from the automations, In this case, we will make an automation for each NFC tag that is going to be read. Easily as a trigger we can 'When a tag is scanned’ and from the list we will select the NFC tag ID. In the actions we will at least make a call to the 'Shopping list' service’ under 'Add an item to the shopping list'.

We'll finally end up with another automation, which will send us the list of things we have on the shopping list once we arrive at our trusted supermarket. In the trigger, we choose the person or people we want to notify, in the Zone we choose the places and in the 'During’ we can set for example 5 minutes, and when we are in that place for that time let us know. In the condition we will only look for items on the shopping list to notify, otherwise, It wouldn't make sense.

{{ states('todo.lista_de_la_compra') | float > 0 }}

And in stocks, in my case a notification via Telegram:

service: notify.telegram data:
  Message: |-
    Go! it looks like you've been to the Mercadona, I'll give you the shopping list:
    {{states('sensor.listilla_de_la_compra')}}

By the way, That 'shopping smart' sensor, exits a command that is defined in the configuration.yaml, where the contents of the shopping_list.json file generated by Home Assistant are obtained, I understand that this will soon change, but for now it is fully functional:

command_line:
  - sensor:
        Name: listilla_de_la_compra command: "jq -r '.[] | Select(.complete==false) | .name' .shopping_list.json"

And we could put another action at the end which is to empty the shopping list once you have sent it, in case we do not want to manually perform this action.

And when we arrive at the shopping center that interests us, we will receive a message similar to the one in the image! What do you think? In my particular case it is practical, We've been using it at home for a while and everyone is happy!

Well, I hope it serves as inspiration for other types of things that can be done with NFC and Home Assistant tags, in this case automate the shopping list!

A hug! Being happy!!!

Recommended Posts

Author

nheobug@bujarra.com
Autor del blog Bujarra.com Cualquier necesidad que tengas, Do not hesitate to contact me, I will try to help you whenever I can, Sharing is living ;) . Enjoy documents!!!