Grocy - Custom component and card(s)

marcelvriend (who I couldn’t find in the forums) have been busy at work at updating the integration and fixing bugs. <3

Hey, y’all! I just started using this card and wished it had a few extra features, so… I added them. Feel free to add my fork as a custom repository in HACS and pull from there or wait for @teachingbirds to review and merge my changes into her branch.

Full release notes are on my repo, but the highlights are:

  1. Added an Overflow panel. When it’s enabled, any items that don’t fit on the main card (because of show_quantity) are added to a collapsible panel at the bottom instead.
  2. Added support for location based date/time formatting. Will use your location settings when formatting dates to match the standards where you are. Also allows 12 or 24 hour times.
  3. Added an option to use icons instead of text for the TRACK buttons.
  4. Added several appearance options, and better respects lovelace theme CSS variables.

5 Likes

This is so great! Thank you for your work on this. You took this plugin the final mile to something pretty useable out of the box. The icons were a weird barrier to entry for me :stuck_out_tongue:

My only additional suggestion to really complete the functionality of these cards would be Categrory filtering. The current Name filtering is okay, but obviously could be better with Categories.

On a related sidenote, the current “name” filtering implementation is only partially useful. For example if I make a “Gutters” list that filters that name, I have no way to prevent the Gutters tasks from appearing in other lists since there’s no filter out functionality. I’ll probably make an issue for this.

Just wanted to mention that I was also having this problem with a bunch of products a few months ago. I was able to fix some manually but ultimately, updating to the latest version of everything recently fixed the issue.

Hello there!
I am using the lovelace card to track chores tasks and it’s amazing!
I was wondering if anyone is thinking about developing a card for managing stocks. My idea is to integrate tables informations about stocks in my floorplan view with locations based filter apply to SVG areas.

Is there anyone working or fell the need of something like this?

The alternative is to use Restfull API senros in HA using Grocy API.

Thank you!

Hoping someone can hold my hand a little on getting this rolling. I started out trying to set up grocy for chores using a somewhat outdated video and then saw in the comments that this component had been created.

  • I have the grocy add-on running and have created my first chore.
  • I have both this component and the lovelace card installed.
  • I setup the component per the readme (api, port).

I think I’m a little confused on how to talk back and forth with the add-on. I can get my way around Home Assistant for the most part, but with how often HA changes, I feel like just as I start to pick something up, it’s updated and looks completely different.

My first chore is cleaning the washer. I want to clean it once every 30 days. I’ll be using NFC tags to reset the counter. Anyone care to give a couple quick steps on what to do once the chore is created?

I have the same issue. I’ve ended modifying the chores names in a “Kitchen: chore” format. And then I use these names to split chores list to multiple template entities - one for each room.

And were you able to force a change in the names showing up or all your chores now start with "Kitchen : " ?

Check out filter and remove_filter options in the card config.

Have you created a PR yet with your changes? (Or did it get merged?)

I am trying to get the card working and running into trouble. I have the integration setup and enabled the tasks and chores entities:
image

I add the grocy card to a lovelace view, but no tasks or chores show up:

What am I doing wrong?

How far out are the chores, you are only showing chores in the next 7 days?

Here is my test task. It is due today.

Figured it out. show_days needs to be set or it will only show items that don’t have a due date

1 Like

I use button card, this is the code for name:

    [[[
      return entity.attributes.chores[variables.chore_number].name.split(':')[1].trim();
    ]]]

This is how my cards look like:

1 Like

I run Grocy (V3.3.2) in a separate Docker instance/location and have the Home Assistant HACS integration (V4.5.2). It has worked well for me for months. But now I get the following warning in HA logs:

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for grocy using this method at custom_components/grocy/init.py, line 52: hass.config_entries.async_setup_platforms(config_entry, PLATFORMS)

It all still works and I am using HA 2023.3.5. No one else seems to be mentioning this so am curious if I have something I need to update(?)

I was looking for a way to create an overview of chores and tasks for the members of the family. It is still work in progress, but if anyone is interested. Also, the Jinja is ugly. (Yes, I know, no comments)

type: markdown
style:
  ha-markdown:
    $: |
      td, th {
        word-wrap: break-word;
          border-spacing: 0px;
          margin-left:auto; 
          margin-right:auto;
      }
      table {
        border-spacing: 0px;
          margin-left:auto; 
          margin-right:auto;
          width: 90%
      }
content: >-
  {% set ch_space=namespace( users = {} ) %}

  {% set ta_space=namespace( users = {} ) %}

  {% set chores = state_attr('sensor.grocy_chores', 'chores')
    | selectattr('next_estimated_execution_time', 'lt', today_at('23:59')|string)
    | list %}
  {% set tasks = state_attr('sensor.grocy_tasks', 'tasks')
    | selectattr('due_date', 'lt', today_at('23:59')|string)
    | list %}
  Chores: {{ chores|length }} - Tasks: {{ tasks|length }}

  ---

  {% for chore in chores %}
    {% set user = chore.next_execution_assigned_user %}
    {% set user_id = user.username %}
    {% if user_id not in ch_space.users %}
      {% set count = 1 %}
    {% else %}
      {% set count = ch_space.users[user.username] + 1 %}
    {% endif %}
    {% set ch_space.users = ch_space.users.items() | list %}
    {% set data = [(user.username,count)] %}
    {% set ch_space.users = ch_space.users | rejectattr('0', 'eq', data | map(attribute='0') | list) | list %}
    {% set ch_space.users = dict.from_keys(ch_space.users + data) %}
  {% endfor %}

  {% for task in tasks %}
    {% set user = task.assigned_to_user %}
    {% set user_id = user.username %}
    {% if user_id not in ta_space.users %}
      {% set count = 1 %}
    {% else %}
      {% set count = ta_space.users[user.username] + 1 %}
    {% endif %}
    {% set ta_space.users = ta_space.users.items() | list %}
    {% set data = [(user.username,count)] %}
    {% set ta_space.users = ta_space.users | rejectattr('0', 'eq', data | map(attribute='0') | list) | list %}
    {% set ta_space.users = dict.from_keys(ta_space.users + data) %}
  {% endfor %}

  {% set ch_items = ch_space.users.items() | list %}

  {% set ta_items = ta_space.users.items() | list %}

  {% set users_all = ch_items | rejectattr('0', 'eq', ta_items |
  map(attribute='0') | list) | list %}

  {% set users_all = dict.from_keys(ch_items + ta_items) %}

  |User|Chores|Tasks|

  |:--|--:|--:| {% for user in users_all.items() %}

  | {{ user[0] }} | {{ch_space.users[user[0]]|default(' ') }} |
  {{ta_space.users[user[0]]|default(' ') }} | {% endfor %}
title: Todo

There has been a few things happening on both integration and card lately, thanks to contributions from others (I don’t have the time right now unfortunately). Just a heads up, that there are a few updates and beta releases!
I try to check the changes out before letting it go live from pre-release but since I have limited time it’s not gonna be super tested.

Is there a way to only show the chores card if there are chores to be completed?

I have managed to set up an area of my dashboard where I can display tasks, but only if there are some using the following code.
The problem is that I want this box to disappear if tasks are more than 3 days away. currently it displays if there are any upcoming tasks.

Any idea how I could do that?
This is my code for the card:

type: custom:grocy-chores-card
entity:
  - sensor.grocy_tasks
title: You have tasks to complete!
show_days: 1
show_quantity: 5
show_assigned: false
show_overflow: true
show_chores_without_due: true
show_tasks_without_due: true
use_icons: true
use_long_date: true
due_in_days_threshold: 7
use_24_hours: true
hide_text_with_no_data: true
show_create_task: false
browser_mod: true
card_mod:
  style: |
    {% if states('sensor.grocy_tasks') == "0" %}
    ha-card {
      display: none;
    }
    {% endif %}
    ha-card {
      background: #edeff2 !important;
      margin: 0 10px 0 10px;
    }
    ha-card .name {
      font-size: 1.3rem;
    }
    ha-card .card-header {
      padding: 10px 15px 0px 15px;
      margin: 0px 0px -20px 0px;
    }

1 Like