Skip to content

Mastering Home Assistant Counters: Your Complete 2026 Guide

13/05/2026

Last updated on May 13, 2026

The Home Assistant Counter is one of the most versatile and powerful Helpers you can configure. Its function is simple but fundamental: to count. Whether you’re tracking how many times a device changes state, how often an automation runs, or keeping a tally of any event in your smart home, the counter is the perfect tool for the job.

In this definitive 2026 guide, I’ll show you not only how to set up a counter but also how to unlock its full potential with practical examples and automations that will transform the way you interact with Home Assistant.

What is a Home Assistant Counter and What’s It For?

Ever wonder how many times the fridge door is opened each day? Or how many coffees you’ve made this week? What about the number of cycles your dishwasher has completed? The counter is a numeric entity designed specifically for these scenarios. It stores a value that you can increment, decrement, and reset through services, making it the backbone of countless tracking-based automations.

Unlike other numeric entities, its purpose isn’t to store an arbitrary value (like a target temperature) but to keep a tally of discrete events.

How to Create a Home Assistant Counter (2026)

For several versions now, the recommended and easiest way to configure a Home Assistant Counter is through the user interface. The old YAML method still works, but for most use cases, the UI is more than enough.

Method 1: Via the User Interface (Recommended)

Creating helpers is a very intuitive process in the 2026 version of Home Assistant. Just follow these steps:

  1. Navigate to Settings > Devices & Services.
  2. Select the Helpers tab.
  3. Click the + CREATE HELPER button in the bottom-right corner.
  4. From the list of helpers, choose the Counter option.
  5. A dialog box will pop up where you can configure your new counter:
    • Name: A descriptive name, for example, “Front Door Opens.”
    • Icon: Choose an icon that visually represents it (e.g., mdi:door-open).
    • Initial value: The value the counter will have when created or reset. This is typically 0.
    • Step: The value that will be added or subtracted with each increment/decrement. The default is 1.
    • Minimum value: An optional lower limit for the counter.
    • Maximum value: An optional upper limit for the counter.
  6. Hit CREATE, and you’re done! Your new entity, counter.your_counter_name, will be available immediately.

Quick Tip: For the “Helpers” tab to be available, your configuration.yaml file must contain the default_config: line, which is included by default in all standard installations.

Method 2: Configuring the Counter via YAML

If you prefer to keep your configuration as code or have more complex needs, you can define counters directly in your configuration.yaml file. This requires adding the counter: key to your configuration.

# Example in configuration.yaml
counter:
  front_door_opens:
    name: Front Door Opens
    initial: 0
    step: 1
    icon: mdi:door-open
  garden_sprinkler_cycles:
    name: Garden Sprinkler Cycles
    initial: 0
    maximum: 100

Here’s a breakdown of all the available configuration variables:

VariableDescriptionRequiredDefault
nameThe friendly name displayed in the UI.NoThe counter’s object ID
initialThe initial value when Home Assistant starts or the reset service is called.No0
restoreIf true, Home Assistant will attempt to restore the last known value after a restart.Notrue
stepThe value to add or subtract on each call to increment or decrement.No1
minimumThe minimum value the counter can reach.NoNone
maximumThe maximum value the counter can reach.NoNone
iconA custom icon for the entity.Nomdi:counter

Counter vs. Input Number: When to Use Each One

A common point of confusion is when to use a counter versus an input_number. Although both handle numbers, they have different jobs:

  • Use a Counter when you need to count discrete events. Its design is centered on being incremented or decremented. It’s perfect for answering “How many times did X happen?”
  • Use an Input Number when you need to store a value that can be set directly, often via a slider in the UI. It’s ideal for configuration values like a target temperature, a light’s brightness level, or a delay time in seconds.

Home Assistant Counter Automations: Real-World Use Cases

This is where the counter really shines. Let’s look at two practical examples of Home Assistant Counter automations you can implement today.

Example 1: Coffee Cup Counter

A classic for caffeine lovers. We’ll count how many coffees we make per day using a smart plug that monitors energy consumption.

  • Required Helpers:
    • A smart plug with power monitoring (e.g., a Zigbee model).
    • A counter: counter.coffees_today.

The automation triggers when the coffee maker’s power draw exceeds a threshold (e.g., 1000W), indicating it’s in use. To avoid counting the same coffee multiple times, we use an input_boolean as a lock.

# Automation to increment the coffee counter
alias: Count Coffee Cups
trigger:
  - platform: numeric_state
    entity_id: sensor.coffee_maker_power
    above: 1000
condition:
  - condition: state
    entity_id: input_boolean.making_coffee
    state: 'off'
action:
  - service: counter.increment
    target:
      entity_id: counter.coffees_today
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.making_coffee
# Automation to re-arm the trigger
alias: Re-arm Coffee Counter
trigger:
  - platform: numeric_state
    entity_id: sensor.coffee_maker_power
    below: 5
condition:
  - condition: state
    entity_id: input_boolean.making_coffee
    state: 'on'
action:
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.making_coffee
# Automation to reset the counter at midnight
alias: Reset Daily Coffee Counter
trigger:
  - platform: time
    at: "00:00:01"
action:
  - service: counter.reset
    target:
      entity_id: counter.coffees_today

Example 2: Dishwasher Cycle Monitor

Perfect for knowing when it’s time to add more salt or rinse aid, or simply for tracking usage over time.

  • Required Helpers:
    • A vibration sensor (like the Aqara Vibration Sensor) or a smart plug.
    • A counter: counter.dishwasher_cycles.

This automation increments the counter when the dishwasher finishes its cycle, detected when the vibration stops or the power consumption drops.

# Automation to count wash cycles
alias: Count Dishwasher Cycles
trigger:
  - platform: state
    entity_id: binary_sensor.dishwasher_vibration
    from: 'on'
    to: 'off'
    for:
      minutes: 5 # Ensures the cycle has truly finished
condition: []
action:
  - service: counter.increment
    target:
      entity_id: counter.dishwasher_cycles
mode: single

Home Assistant Counter Services

To manipulate a counter’s value from automations or scripts, we use services. You can access and test them under Developer Tools > Services.

The basic format for the service call always includes the entity_id of the counter you want to modify:

service: counter.increment
target:
  entity_id: counter.my_example_counter

These are the main services:

  • counter.increment: Increases the counter by the value defined in its “step” setting (defaults to 1).
  • counter.decrement: Decreases the counter by the “step” value.
  • counter.reset: Resets the counter to its “initial value” (defaults to 0).
  • counter.configure: This is an incredibly powerful service that lets you change the counter’s parameters (initial, minimum, maximum, step) on the fly, without needing to restart Home Assistant.
    # Example of changing a counter's maximum and step value
    service: counter.configure
    target:
      entity_id: counter.my_example_counter
    data:
      maximum: 200
      step: 5

Troubleshooting Common Issues

While the counter helper is robust, here are solutions to the most common problems you might encounter.

  • My counter resets to 0 every time I restart Home Assistant.
    • Cause: State restoration is disabled.
    • Solution: If you created it via YAML, ensure the restore: true option is present or omitted (since true is the default). If you created it from the UI, this option is enabled by default and shouldn’t be an issue. The initial value is only applied the very first time or after a reset service call.
  • The automation runs, but the counter doesn’t change.
    • Cause: The entity_id in your service call is incorrect.
    • Solution: Check the automation’s trace and inspect the “Call service” step. Make sure the entity_id exactly matches your counter’s ID. A simple typo is the most common culprit.

Conclusion

The Home Assistant Counter is a deceptively simple tool that unlocks a new level of intelligence and data tracking in your smart home. From monitoring habits to managing appliance maintenance, the possibilities are as broad as your imagination.

Now that you’ve mastered its configuration and services, I encourage you to get creative. What are you going to start counting in your smart home today?