The built-in shopping list is one of the most useful feature for me and yet I rarely use it because it only works via conversation component at the moment and my primary mode of interaction with HA is via Telegram, Alexa and Zanzito.
I wish I can access to my shopping list via other components which allows me to add, remove and retrieve items from my shopping list.
In order to do that, I hope the shopping list component will introduce new service calls and sensor. For example, to add new item, I can use this service…
Agree. As I didn’t use let’s encrypt. So I don’t have ssl. Myself, cannot use google assistant and some feature that HA provide like shopping list. Although I have microphone attached but no ssl, cannot use.
i’d love to see this too. and it would be great if it were a general component that’s not relegated to a panel so we can easily make multiple lists, etc.
I’m trying to add items to the shopping list via telegram (text) and zanzito (voice).
Using automation, the message feedback can be added as additional service call under the action part of the automation. Will share with you the example later when I have access to my PC.
Anyway, please vote for this feature request. Thanks.
Seems I’m late to the party, but I found this thread while looking if it would be possible to integrate the 2D barcode scanner I impulse bought on an Amazon Lightning Deal.
I’d like to have a component that would allow us to check household inventory if we make a random grocery stop, or to check when the last time we bought some random spice.
I want to support this request because I like the way the shopping list works and how it looks. However, I am struggling with working with the shopping list at the moment.
My intention is to send the filled shopping list via email and start a new one afterwards. At the moment, I am able to send it via email (using an external script reading the .shopping_list.json) but I have no idea how to clear the complete list to start a new one.
In the future, I also want to add voice control by snips. I guess the new services should help with that, so I already appreciate what has been done so far
Sure. It is just a little quick & dirty python code that I added as a shell command to homeassistant:
#!/usr/bin/python
# coding: utf8
import json, smtplib, datetime
sender='XXX'
reciever='YYY'
account='ZZZ'
password='BBB'
with open('PATHTOHOMEASSISTANT/.shopping_list.json') as data_file:
shoppingListData = json.load(data_file)
# build message
content = u"Shopping list:\n"
for entry in shoppingListData:
if not entry['complete']:
content += u"- %s\n" % entry['name']
content += u"\nThank you for shopping!"
mail=smtplib.SMTP('smtp.gmail.com',587)
mail.ehlo()
mail.starttls()
mail.login(account,password)
message = """From: %s\nTo: %s\nSubject: %s\n\n%s""" % (sender, reciever, "Shopping list", content)
mail.sendmail(sender,reciever,message.encode('utf-8'))
mail.close()
The code was tested using gmail. However it should work with other email providers by replacing the SMTP server accordingly. You need to enter the sender email address, the receiver email address and your mail account information that are hard coded (there certainly is room for improvements )
I’m wondering if someone is working on recognize 2D Barcode (specific hardware device or using image processing ?).
There is an API for matching barcode and a specific product. It could be cool to scan a barcode to automatically add the product to the shopping list.
This is great. Thanks for the simple python script. At first the sensor reported a status of unknown for me. I had to set the sensor up slightly differently in Hassio by prefacing the command with python3.
Hello All and Flovie in particular.
New to Homeassistant and Linux
Im trying to use your python script above but i dont know how to execute it.
I have created a folder under the homeassistant folder called “python_scripts” and created a send.py file there with your script , ofcourse edited with my e-mail address and path
home/homeassistant/.homeassistant/python_scripts/shopping_list.json
I dont know how to activate or run the script, can i create a button “send email” to run this script or can i controll it with a simple voice command?
Any help appreciated.
#!/usr/bin/python
# coding: utf8
import json, smtplib, datetime
sender='[email protected]'
reciever='[email protected]'
account='[email protected]'
password='xxx'
with open(' home/homeassistant/.homeassistant/python_scripts/shopping_list.json') as data_file:
shoppingListData = json.load(data_file)
# build message
content = u"Shopping list:\n"
for entry in shoppingListData:
if not entry['complete']:
content += u"- %s\n" % entry['name']
content += u"\nThank you for shopping!"
mail=smtplib.SMTP('smtp.gmail.com',587)
mail.ehlo()
mail.starttls()
mail.login(account,password)
message = """From: %s\nTo: %s\nSubject: %s\n\n%s""" % (sender, reciever, "Shopping list", content)
mail.sendmail(sender,reciever,message.encode('utf-8'))
mail.close()
I didn’t get the correct indentation working in this example, so be careful with copy&paste. This code will expose the python code as a service to your home assistant.
3. You are free to call this service how you like. May it be voice command or an automation.
If you are in a more restricted environment, then you should take a look at the code by Mark_Meijer and use a notification component of your choice.
I hope this helped you out and pointed in the right direction.