Closed saya6k closed 1 year ago
Hey @saya6k , there is already a way to do that, I'm doing it on my HA instance, here is an example on how to achieve that:
- type: custom:collapsable-cards
title: Food closet
defaultOpen: true
cards:
- type: custom:auto-entities
sort:
method: attribute
attribute: location
card:
type: vertical-stack
card_param: cards
filter:
include:
- entity_id: sensor.shopping_list_with_grocy*
sort:
method: friendly_name
attributes:
location: 1 - Food closet
options:
type: custom:button-card
entity: this.entity_id
template: shopping_list_item
tap_action:
action: call-service
service: shopping_list_with_grocy.add_product
service_data:
product_id: this.entity_id
double_tap_action:
action: call-service
service: shopping_list_with_grocy.remove_product
service_data:
product_id: this.entity_id
hold_action:
action: call-service
service: shopping_list_with_grocy.remove_product
service_data:
product_id: this.entity_id
- type: custom:collapsable-cards
title: Fridge
cards:
- type: custom:auto-entities
sort:
method: attribute
attribute: location
card:
type: vertical-stack
card_param: cards
filter:
include:
- entity_id: sensor.shopping_list_with_grocy*
attributes:
location: 2 - Fridge
sort:
method: friendly_name
options:
type: custom:button-card
entity: this.entity_id
template: shopping_list_item
tap_action:
action: call-service
service: shopping_list_with_grocy.add_product
service_data:
product_id: this.entity_id
double_tap_action:
action: call-service
service: shopping_list_with_grocy.remove_product
service_data:
product_id: this.entity_id
hold_action:
action: call-service
service: shopping_list_with_grocy.remove_product
service_data:
product_id: this.entity_id
exclude:
- entity_id: sensor.shopping_list_with_grocy_demo.*
Hey @saya6k , there is already a way to do that, I'm doing it on my HA instance, here is an example on how to achieve that:
- type: custom:collapsable-cards title: Food closet defaultOpen: true cards: - type: custom:auto-entities sort: method: attribute attribute: location card: type: vertical-stack card_param: cards filter: include: - entity_id: sensor.shopping_list_with_grocy* sort: method: friendly_name attributes: location: 1 - Food closet options: type: custom:button-card entity: this.entity_id template: shopping_list_item tap_action: action: call-service service: shopping_list_with_grocy.add_product service_data: product_id: this.entity_id double_tap_action: action: call-service service: shopping_list_with_grocy.remove_product service_data: product_id: this.entity_id hold_action: action: call-service service: shopping_list_with_grocy.remove_product service_data: product_id: this.entity_id - type: custom:collapsable-cards title: Fridge cards: - type: custom:auto-entities sort: method: attribute attribute: location card: type: vertical-stack card_param: cards filter: include: - entity_id: sensor.shopping_list_with_grocy* attributes: location: 2 - Fridge sort: method: friendly_name options: type: custom:button-card entity: this.entity_id template: shopping_list_item tap_action: action: call-service service: shopping_list_with_grocy.add_product service_data: product_id: this.entity_id double_tap_action: action: call-service service: shopping_list_with_grocy.remove_product service_data: product_id: this.entity_id hold_action: action: call-service service: shopping_list_with_grocy.remove_product service_data: product_id: this.entity_id exclude: - entity_id: sensor.shopping_list_with_grocy_demo.*
Actually, I'm using it similarly. But I thought it would be much intuitive to have location as device in home assistant context. Anyway, thank you :)
I will close that jira issue, because locations in HomeAssistant are meant to be rooms, not closests or fridge. If there is more feature request like this one, I'll work on something
Shopping list with grocy have option to get product sensor, and it’s super useful. I can have automation in home assistant, to warn shortage and remind me to buy groceries. Currently, product sensor has location in their attribute ‘location’.
But products are actually ‘in’ location, it’s not intuitive for smart home approach. It’s more of a ERP way of view.
So if I can get multiple product sensors in each location device such as fridge, it would be much easier to understand and fits in home assistant.