
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:
- Navigate to Settings > Devices & Services.
- Select the Helpers tab.
- Click the + CREATE HELPER button in the bottom-right corner.
- From the list of helpers, choose the Counter option.
- 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.
- 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: 100Here’s a breakdown of all the available configuration variables:
| Variable | Description | Required | Default |
name | The friendly name displayed in the UI. | No | The counter’s object ID |
initial | The initial value when Home Assistant starts or the reset service is called. | No | 0 |
restore | If true, Home Assistant will attempt to restore the last known value after a restart. | No | true |
step | The value to add or subtract on each call to increment or decrement. | No | 1 |
minimum | The minimum value the counter can reach. | No | None |
maximum | The maximum value the counter can reach. | No | None |
icon | A custom icon for the entity. | No | mdi: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: singleHome 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_counterThese 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: trueoption is present or omitted (sincetrueis the default). If you created it from the UI, this option is enabled by default and shouldn’t be an issue. Theinitialvalue is only applied the very first time or after aresetservice call.
- The automation runs, but the counter doesn’t change.
- Cause: The
entity_idin your service call is incorrect. - Solution: Check the automation’s trace and inspect the “Call service” step. Make sure the
entity_idexactly matches your counter’s ID. A simple typo is the most common culprit.
- Cause: The
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?
