Anyone familiar with grocy? need help showing chores

hi
Ive set up 5 chores in the grocy integration and am showing them with the custom grocy card, all works fine.
the problem is the priority of these chores.

ID4 show everyday no matter what
ID1 show every 4 days unless ID2 is the same day, then show ID2, don’t show ID1 or ID3
ID2 show every 16 days unless ID3 is the same day, then show ID3, don’t show ID1 or ID2
ID3 show every 32 days, don’t show ID1 or ID2
ID5 show every 3 months no matter what

the use case is for following a feeding + supplement schedule for my gecko


each numbered block represents 4 days and there is key to show which supplement to feed.
same supplement 1,2,3,5,6,7
different supplement 4 (therefore 16 days)
different supplement 8 (therefore 32 days)

so what i’d like to do is on day 16 only show ID2 and on day 32 only show ID3
i hope ive explained this well enough
I’m not averse to abandoning grocy if this is easier to achieve with custom sensors or something
any help appreciated
thanks

1 Like

I think you’d have to use a template sensor to build up a JSON attribute of what you wanted to show, based on those rules. You could then display this with List Card from HACS.

EDIT: I got curious, so this is how I’d do it. I got lazy and just did string compares with the dates.

{% set today = (now() | string)[:10] %}
{% set chores = state_attr('sensor.grocy_chores', 'chores')  %}

{% set id1 = chores | selectattr('id', 'eq', 1) | first %}
{% set id2 = chores | selectattr('id', 'eq', 2) | first %}
{% set id3 = chores | selectattr('id', 'eq', 3) | first %}
{% set id4 = chores | selectattr('id', 'eq', 4) | first %}
{% set id5 = chores | selectattr('id', 'eq', 5) | first %}

{% if id3.next_estimated_execution_time[:10] == today %}
  {{ [id4, id3, id5] }}
{% elif id2.next_estimated_execution_time[:10] == today %}
  {{ [id4, id2, id5] }}
{% elif id1.next_estimated_execution_time[:10] == today %}
  {{ [id4, id1, id5] }}
{% else %}
  {{ [id4, id5] }}
{% endif %}

Not sure I understand the feeding cycle though.

1 Like

Thank you so much, I’ll have a proper look in the morning.

The feeding schedule looks more complicated than it is.
Each block corresponds to a number of days, I choose to use 4 days, so every 4 days (1 block) she gets fed and gets supplement A, Every 16 days (4 blocks) she gets fed and gets supplement B and every 32 days (8 blocks) she gets fed and gets supplement C
4 days is arbitrary, some keepers use 3 days or if the gecko is young they might use 2 days but the supplements remain the same… A Every feed, B every 4th feed and C every 8th