Skip to content

Home Assistant Counter: Complete Guide and Examples

13/05/2026

The Counter helper stores an integer that automations and dashboards can increase, decrease, reset, or set to a specific value. Use it to count events such as door openings, dishwasher cycles, completed chores, or reminders sent.

What a Counter is for

A Counter keeps a current value; it does not inspect past state history. For runtime, percentage of time, or state matches over a period, use History Stats instead.

Create a Counter in the current interface

  1. Go to Settings > Devices & services > Helpers.
  2. Select Create helper, then Counter.
  3. Set the name, initial value, minimum, maximum, step, and icon.
  4. Save it and use its counter.name entity.

Settings and state restoration

Initial is the reset value; minimum and maximum bound the number; step controls each increment/decrement. With restore enabled (the default), Home Assistant restores the last known value after a restart. Initial is used when no prior state is available or on reset.

YAML example

counter:
  dishwasher_cycles:
    name: Dishwasher cycles
    initial: 0
    minimum: 0
    maximum: 999
    step: 1
    restore: true
    icon: mdi:dishwasher

Actions, triggers, and automations

In the automation editor, use the current actions: counter.increment, counter.decrement, counter.reset, and counter.set_value. Counter triggers include incremented, decremented, reset, minimum reached, and maximum reached. The counter.is_value condition checks a threshold.

alias: Count front door openings
triggers:
  - trigger: state
    entity_id: binary_sensor.front_door
    to: "on"
actions:
  - action: counter.increment
    target:
      entity_id: counter.front_door_openings

Counter or History Stats?

Choose Counter for a value changed by events and actions. Choose History Stats to analyse a source entity’s state history over today, a week, or another time window—for example, appliance runtime or how often a state matched.

Troubleshooting

If a counter does not persist, check that restore is enabled. If it never reaches a limit, verify its entity ID, step, and maximum. Do not use a Counter as a substitute for historical runtime reporting.

See the official Counter documentation for the current reference.

Two practical Counter patterns

Notify when a maximum is reached

Use the counter.maximum_reached trigger for a chores or reminders limit, then reset the counter for the next cycle.

alias: Notify when reminder limit is reached
triggers:
  - trigger: counter.maximum_reached
    target:
      entity_id: counter.reminders
actions:
  - action: notify.send_message
    target:
      entity_id: notify.my_phone
    data:
      message: "Reminder limit reached"
  - action: counter.reset
    target:
      entity_id: counter.reminders

Set a known value

counter.set_value is useful when an automation needs to establish a known starting point. It still follows the helper’s configured limits.

When not to use a Counter

A Counter cannot reconstruct past states or measure physical runtime. For hours on, a daily ratio, or historical state matches, use History Stats. For an editable decimal setting, use input_number instead.