Reset of counters at a specific moment

Hi,
As I’ve no coding experience, I’d appreciate some help here.

I have some counters (helpers) that keep track on some events.
But I’d like to reset them every Monday at 0.00 hours so I can compare the data week by week.

How do I create a trigger that can reset the counters? In the UI I do not see options for this. And I didn’t find any integrations either.

Thanks in advance for your help.

Create an automation with:

  1. Time Trigger set to midnight
  2. Time Condition restricting the day to Monday
  3. counter.reset service call for the counters you wish to reset.

Using the Automation Editor, create a new, blank automation, switch to YAML mode (available in the overflow menu, three vertical dots, in the upper right hand corner), and copy-paste the following YAML over whatever may already be there. Save the automation. If you wish you can switch back to Visual mode to see how it looks that way.

alias: example
trigger:
  - platform: time
    at: '00:00:00'
condition:
  - condition: time
    after: '00:00:00'
    weekday:
      - mon
action:
  - service: counter.reset
    target:
      entity_id:
        - counter.first
        - counter.second
1 Like

Thanks. That is actually very obvious. To obvious to think of myself

1 Like

This is actually in the wrong category.

you have it in the “Blueprints Exchange” but it has nothing at all to do with blueprints.

You’re welcome!

I suggest you change the category from Blueprints Exchange to Configuration (Blueprints Exchange is for sharing functional blueprints).

After you have done that, please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic is resolved. This helps other users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.

1 Like