Can you clarify how you would use input_booleans in this situation? I don’t want to create multiple input booleans for common items I want to put on my shopping list. I just want an easy way to clear all items of my shopping list. I don’t think your idea covers that.
Okay, creating entities so that you can interact with them is how you work with HA.
Eg. What temperature do you want to turn your boiler off at because it has reached temperature - take it from an input_number
When should this shopping list be cleared, when you have told it to clear by setting an input_boolean
When do you want your music to come on in the morning, set it by using an input_datetime
These are the bread and butter of HA
In this case as scripts can’t do loops, I’m suggesting it be set to trigger your automation (normally door is detected open, it’s dark outside so turn the light on) this automation just calls a script to reduce the list (as you would) by one. How long is the list? 12, okay so leave the boolean on and call the script again, repeat 12 times, how long is the list? 0 okay turn the boolean off and don’t call the script. Et Voila!
If you only interact with HA through integrations then you are only using 2& of what you could be doing. AND waiting years for someone else to build an integration that turns your music off when you turn your TV on and turns the lights down low because it’s after 18:00
Read some of the other posts about what other people are doing
Roll your sleeves up and dig in, it’s very satisfying when you are at home and someone says “hey ALL the lights in your house turned down at 22:00 together - how did you do that?”
I don’t think you understand what the OP is asking for. Doesn’t matter what automation you write if the service shopping_list.clear
or whatever doesn’t exist. OP is asking for that feature to be added. That’s what the Feature Requests forum is for.
I have been thinking of trying out ourgroceries. It has a custom component https://github.com/ljmerza/ha-our-groceries/tree/master/custom_components/ourgroceries, and work is under way to introduce so services into HA. https://github.com/ljmerza/py-our-groceries/
No, I get that entirely.
However what I’m pointing out is that it is so trivial to do yourself that no-one (in the current devs group) is going to spend any time on it as they have bigger fish to fry.
There are so many things wrong, part of being a user is knowing what features to avoid. Don’t get me wrong HA is a phenomenal body of work and it’s moving in the right direction, but the automation editor (for example) is neither use nor ornament. The documentation is (though recently reduced) still huge and keeping it up to date with developments must be a nightmare.
I’ve seen your posts I know you know where HA is on the development plan. So any bits we could do ourselves, we should.
I was simply pointing out why I wouldn’t vote for it as I have different priorities.
So if someone wants to do the work and pass it in through the devs the power to them. But I think time would be better spent elsewhere.
Nil point
Another good one is Grocy. There is a HassIO add-on for it or it can be run as a normal Docker container. I just can’t get my girlfriend to use it…
I thought Grocy was a bit overkill.
The cool thing with it is the ability to use automations to add specific items to your shopping list. I read an article somewhere on the web about an automation to subtract a dishwasher tablet each time the dishwasher ran and then add a box of them once the stocks were low enough. Seemed pretty awesome. I haven’t looked into the normal HA shopping list too much but it can likely do the same thing I guess
That would be cool, and your post is poignant, given we ran out of tablets last night! They are written on the blackboard at home, but that doesn’t really do any automations. In fact it is bloody useless when I am at the supermarket. I could take a photo with my phone, but I forget to do that too.
I might look at grocy again.
Found it:
Thanks.
One quick question about grocy. To use it out of your home, does it need access to the grocy server running at home? ie a hole in your firewall?
Personally I use ToDoist for shared lists and then a handful of text variable IFTTTs ‘Hey Google, add $ to X list’ - where X is different in each IFTTT recipe. IE grocery, lowes, costco, target, etc…
I FULLY realize it’s not HA, but easiest way I’ve found to allow multiple people to use multiple lists concurrently - then it’s just clicking on the item in the list in the todoist app on our phone while shopping to remove.
Caveat - we do have to pay a bit a year to get the ‘shared’ list feature - but the ease is worth it- and allows our nanny and others to easily add via the google home in the kitchen.
Downside is all the stuff the kids have figured out how to add… someout ended up with ‘billy joe bob spongepants head’ on the list at one point…
If someone has a pure-play HA way that’s easier than this, happy to implement, but until then, $30 a year (or whatever it is) is worth it to me for the ease / ‘it just works’ of this setup.
I’m using the HassIO add-on which has Ingress enabled, so for me it’s a sidebar tab. I guess if you were using the stand-alone version you should be able to integrate as an iFrame to end up with the same outcome. Either way you can view it when out of the house
Thanks for the tips about Grocy. But it’s still not a solution for a quick way to clear all the items of the Shopping List.
@Mutt: You act like I don’t have any knowledge about Home Assistant, that’s not true. I’m just asking for a feature request, and not someone who thinks he got more knowledge of HA than someone else. Please think twice before you post such a long contemptuous story. This forum is to help each other instead of bringing someone down if you think they have less knowledge than you.
Ang again I would like to point out; I just asked for a feature request of a new shopping list service to clear all items on the shopping list.
Your answer was not realy an answer to my question (if there’s an easy way to clear all the items on my shopping list / how to use an input_boolean to clear the shopping list), because it’s not possible to use an input_boolean to clear the shopping list without this shopping list service I’m requesting.
Yes.
Read my earlier replies.
It was not meant to be definitive is was meant to suggest a possible alternate means of action, one (possibly) where you write some code.
So, I came up with a ‘solution’ that works for me. I can complete my whole shopping list by pushing an actionable push notification. Just what I wanted. Here’s my workaround:
Create a sensor of the shopping list (found somewhere on this forum):
#!/usr/local/bin/python
# coding: utf8
import json
with open('/config/.shopping_list.json') as data_file:
shoppingListData = json.load(data_file)
content = u"Boodschappen:\n"
for entry in shoppingListData:
if not entry['complete']:
content += u"- %s\n" % entry['name']
content += u"\n"
print(content)
Name this shopping_list.py
and place it in your /config
folder.
This creates a list with all items on your shopping list. I let Home Assistant send me this list when I enter the zone of my local supermarket.
Add this to your config file:
ios:
push:
categories:
- name: Empty Shopping List
identifier: 'empty_shopping_list'
actions:
- identifier: 'EMPTY'
title: 'Empty'
destructive: true
- identifier: 'KEEP'
title: 'Keep'
sensor:
- platform: command_line
name: shopping_list
command: python3 /config/shopping_list.py
automation:
# Action when triggering 'Empty Shopping List' button from actionable push notification
- alias: ios actionable empty
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: EMPTY
action:
service: script.toggle
entity_id: script.empty_shopping_list
script:
# Splits the information of sensor.shopping_list and completes this item on shopping list
'empty_shopping_list':
alias: empty shopping list
sequence:
- service: shopping_list.complete_item
data_template:
name: >-
{{ states.sensor.shopping_list.state.split('-')[1] }}
- service: shopping_list.complete_item
data_template:
name: >-
{{ states.sensor.shopping_list.state.split('-')[2] }}
- service: shopping_list.complete_item
data_template:
name: >-
{{ states.sensor.shopping_list.state.split('-')[3] }}
- service: shopping_list.complete_item
data_template:
name: >-
{{ states.sensor.shopping_list.state.split('-')[4] }}
- service: shopping_list.complete_item
data_template:
name: >-
{{ states.sensor.shopping_list.state.split('-')[5] }}
- service: shopping_list.complete_item
data_template:
name: >-
{{ states.sensor.shopping_list.state.split('-')[6] }}
- service: shopping_list.complete_item
data_template:
name: >-
{{ states.sensor.shopping_list.state.split('-')[7] }}
- service: shopping_list.complete_item
data_template:
name: >-
{{ states.sensor.shopping_list.state.split('-')[8] }}
- service: shopping_list.complete_item
data_template:
name: >-
{{ states.sensor.shopping_list.state.split('-')[9] }}
- service: shopping_list.complete_item
data_template:
name: >-
{{ states.sensor.shopping_list.state.split('-')[10] }}
This works for me, and maybe someone else. The only thing that I’m left with is a completed list. Can’t find a way to delete completed items without clicking on the icon.
@moostmartijn I found this discussion while trying to work out how to send notifications based on location, I was wanting to send the shopping list out as a notification when someone was as the shops I see you had already worked out how to do that, are you using goefencing? Any chance you can give an overview of what your doing? Thx.
@Eoin, Yes I use geofencing. I set up a zone for my local supermarkets:
zone:
- name: Jumbo
latitude: !secret latitude_jumbo
longitude: !secret longitude_jumbo
radius: 100
- name: Albert Heijn
latitude: !secret latitude_albert_heijn
longitude: !secret longitude_albert_heijn
radius: 150
I use Life360 as a device tracker and added this automation when I enter the zone which includes my Shopping List and actionable push notification:
# Send the shopping list items as an iOS notification when I enter the shop zones zone.jumbo and zone.albert_heijn
- alias: ios shopping list zones
trigger:
- entity_id: person.martijn
event: enter
platform: zone
zone: zone.jumbo
- entity_id: person.martijn
event: enter
platform: zone
zone: zone.albert_heijn
action:
- service: notify.ios_iphone_van_martijn
data_template:
message: '{{states.sensor.shopping_list.state}}'
data:
push:
category: "empty_shopping_list"
Got this working last night moostmartijn, thank you! I did run into a problem with the .py, I’m using Android notifications rather than IOS, looks like Android doesnt like cartridge returns. Removed that to just have coma separated items and it works like a charm.