I am trying to figure out the way to create a dependent counter. Essentially I use one Counter connected to some automations to grant points to a kiddo for doing her chores. This counter resets every day sending me a notification just before to let me know the total points tally for the day.
Now I want to create a weekly counter which will daily increase to the value of the daily counter just before the daily resets. Right now I am doing it manually through the number helper, but wanted to find a way to automate this flow
Set another input helper to store the weekly value and just add to it? You can increase the value or set a new one. Something like value_weekly == value_weekly + value_daily
Post your automation for the daily points, so we can see how you handle this and built upon that.
I haven’t used counters for this, but it seems a nice little helper. I’d have done it with a simple input_number helper, but that’s a personal choice and honestly, not sure if counter isn’t the better way.
Anyway, just add a new counter (wherever you normally do that UI or YAML), name it like you want, for the example I’ll call it counter.princess_points_weekly. Just for my inner Monk, I’d change the other counter to counter.princess_points_daily.
I’m not at home, so couldn’t test it, but should work. You can write this in a one liner as well, it’s just for clarity, so you can see, what we’re doing here.
What you have to do in a seperate automation is deleting these weekly points (or set it 0) at the end of the week.
Let me know how many errors I hid in this code or if it works as planned
more generally I really got into counters recently not just for a kid, but for myself - to keep the discipline up (specifically cans of coke I consume a day) and monitor some supplies (Dishwasher tablets, Washing Machine pods etc.). they are easily managed from the smart watch, buttons, nfc tags so I am hooked
Seems, I need to read up on counters. Makes sense, especially for food and non-food things, that are already tracked in Grocy, but where a counter should come in handy. Thanks, I’ll def take a look at them.
hmmm… still getting the same error in Automations even though Developer Tools check seems to be fine with it. I have a feeling counter.set_value doesn’t support templates.