Choose a counter when each use changes the balance

A Home Assistant counter helper stores a whole number that you can increase, decrease or set directly. A helper is a value you create inside Home Assistant, without buying a sensor. For dishwasher tablets, a useful starting point is one visible balance and a button labelled “Used one tablet.” Create the helper, enter your current stock, then add the button and reminder below.

The number is only as accurate as its inputs. A recorded wash cycle does not prove that someone used exactly one tablet. Start with manual entries until the household agrees when to press the button. If your main task is typing a fresh stock count each week, choose a Number helper with its display mode set to Box instead. Add it to an Entities card to enter the quantity as a number.

This example needs a working Home Assistant installation and administrator access for setup and direct corrections. It adds no device, app or paid service. It changes a stored quantity and a Home Assistant reminder; it never starts the dishwasher.

Researched from Home Assistant documentation checked November 5, 2026. The quantities and walkthrough are illustrative, not results from a tested Tara installation. The cover is a generated illustration of household supplies.

1. Create a counter with an unambiguous meaning

  1. Open Settings → Devices & services → Helpers → Create helper → Counter. Name it Dishwasher tablets.
  2. Set Initial value: 0, Step: 1, and Minimum: 0. Leave Maximum unset unless you want a deliberate ceiling that accommodates every refill.
  3. Keep Restore the last known value when Home Assistant starts enabled. Some settings appear under More options when editing the helper.
  4. Find its entity ID, the internal name used in actions. The examples use counter.dishwasher_tablets. Substitute your actual ID everywhere if Home Assistant gave it a different one.

Here, the number means tablets remaining, not tablets used, wash cycles completed or days since a refill. Put that meaning in the dashboard where everyone can see it. Home Assistant’s helper guide explains the setup controls.

With restoration enabled, the saved value takes priority at startup. The initial value applies when no saved state is available and when you call Reset. Therefore, a restart should not replenish your stock. See the Counter reference for the distinction.

2. Enter the real total, including leftovers

Open Settings → Tools → Actions. Older versions call this Developer tools → Actions. Search for Set counter value, select just your new counter, enter the total and choose Perform action. The Tools page is available to administrators.

For a practice balance of twelve, switch that Actions form to YAML mode and use:

Action: set the practice quantity to 12
action: counter.set_value
target:
  entity_id: counter.dishwasher_tablets
data:
  value: 12

Set counter value replaces the balance. If four tablets remain and you add a 48-pack, the new total is 52. Set the value to 52, not 48. If you are correcting a mistake, count what is actually there and enter that total. These are example quantities, not a recommended package size.

Use the counter action for this correction. The Tools States tab can temporarily change what Home Assistant displays for testing; it is not the proper way to update the helper’s stored balance. Changing the initial-value setting is also not a refill action.

3. Add one clear consumption button

On an editable dashboard, add a Manual card and paste the card configuration below. It displays the quantity and subtracts one per tap. Use it only for this practice counter until you finish the checks.

Dashboard card: Used one tablet
type: button
entity: counter.dishwasher_tablets
name: Used one tablet
icon: mdi:minus-circle-outline
show_state: true
tap_action:
  action: perform-action
  perform_action: counter.decrement
  target:
    entity_id: counter.dishwasher_tablets
hold_action:
  action: more-info

The built-in Button card displays the counter. Its tap action calls Decrement counter, which subtracts the configured step. With Step set to 1, twelve becomes eleven. Minimum 0 prevents a negative balance.

A second tap represents another use, so it can subtract again. If you tap by mistake, run Increment counter once in Tools → Actions or correct the total with Set counter value. Keep Reset out of the everyday workflow: in this example it would mean zero remaining.

For a dashboard that must fit both a kitchen tablet and a phone, the Sections dashboard guide explains the layout. No custom card is needed for this button.

4. Keep one reminder below five

Create an empty automation under Settings → Automations & scenes, open its menu and choose Edit in YAML. Replace the editor contents with this complete automation, check the counter ID and save. An automation is simply a rule that runs when something changes.

This rule checks after each quantity change and when Home Assistant starts. At 0–4, it creates or updates one message in Home Assistant’s Notifications panel. At 5 or more, it removes that message. Five is a convenience threshold for this example, not a prediction of how many days the stock will last.

Complete automation: one low-stock reminder
alias: Dishwasher tablets - stock reminder
description: Keep one local reminder while the recorded quantity is below five.
triggers:
  - trigger: state
    entity_id: counter.dishwasher_tablets
    to: null
  - trigger: homeassistant
    event: start
conditions: []
actions:
  - condition: numeric_state
    entity_id: counter.dishwasher_tablets
    above: -1
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: counter.dishwasher_tablets
            below: 5
        sequence:
          - action: persistent_notification.create
            data:
              notification_id: dishwasher_tablets_low
              title: Check dishwasher tablets
              message: >-
                Recorded quantity:
                {{ states('counter.dishwasher_tablets') }}.
                Check the pack and add tablets to the shopping list if needed.
    default:
      - action: persistent_notification.dismiss
        data:
          notification_id: dishwasher_tablets_low
mode: restart

This is an in-app Home Assistant reminder, not a phone push alert. The stable notification_id makes subsequent updates replace the same message. You can dismiss it yourself; if stock is still low, it returns on the next quantity change or Home Assistant startup. A refill to at least five clears it automatically. The persistent-notification action documents this message behavior.

The first action is a numeric check: it stops the sequence for missing or nonnumeric states instead of treating them as zero. It also runs when you test the actions manually. The lower check is strictly below: 5, so five itself does not qualify. A state-change trigger with to: null ignores changes to descriptive attributes. This checks a corrected balance as well as a normal decrement; it does not depend on catching one particular threshold crossing.

After saving, use the automation’s Run actions control once to bring the message up to date. Saving alone is not a stock-change event. This manual run is suitable for this exact example because its actions only update the reminder; do not use it as a general test of automations that control appliances.

5. Rehearse use, correction and refill

Use the new practice counter before attaching any other automation. No detergent needs to be consumed. Follow this sequence, checking both the dashboard quantity and Home Assistant’s Notifications panel:

On a narrow screen, swipe the table sideways.

Your actionExpected balanceExpected reminder
Set the value to 12, then tap Used one tablet.11No low-stock message.
Set the value to 5.5No message: five is not below five.
Tap Used one tablet.4One message showing four.
Tap again, then correct the accidental extra tap with Increment counter.3, then 4The same message updates; no second copy.
Model a refill: four left plus a 48-pack. Set the new total to 52.52The low-stock message disappears.
Set the value to 0, then tap Used one tablet.0The balance stays at its minimum.

When these checks pass, set the helper to your real quantity. On your next planned Home Assistant restart, check that the balance returns. You do not need to interrupt household controls just to test this guide.

For automatic deductions later, add exactly one decrement at a reliably identified use. Avoid combining the manual button with an automatic deduction for the same item. For a washer, first follow the guide to recognizing a completed wash without counting pauses. Even then, treat “one cycle uses one dose” as an assumption to check, not something the counter measures.

If the balance or reminder looks wrong

What you seeCheck firstNext step
A refill loses the leftovers.Was the pack size entered as the whole balance?Count the actual stock and use Set counter value.
Each tap changes the count by more than one.The configured Step and any second deduction automation.Use Step 1 here; keep one deduction path per use.
The total returns to zero after a restart.Restore setting, reset actions and whether this is the same helper.Enable restoration and correct the quantity. Investigate a repeated loss before relying on it.
The stock is low but no message appeared after saving.No quantity change has happened yet, or the automation is disabled.Enable it, run this example’s reminder actions once, then test 5 → 4.
The counter is unavailable or the card shows no value.The entity ID in the card, automation and action.Fix the reference. Do not substitute zero for missing stock information; an earlier reminder may remain unchanged.
Set counter value fails.The selected entity, whole-number value and configured limits.Use a valid total within the intended range; inspect the action error before changing limits.

Common questions

Should I use Counter or Number?

Choose Counter when most changes are fixed steps, such as one item used or one event counted. Choose Number in Box mode when people mainly type a new total. This guide’s card and automation target a Counter; changing to Number requires changing the entity IDs and actions as well.

Does the counter know what happened while Home Assistant was off?

No. Restoring its previous value does not replay unrecorded uses. Reconcile the quantity after missed inputs. A counter is a household record, not an independent inventory sensor.

Can this replace my shopping list or chore schedule?

It serves a different purpose. A count answers “how many remain?” The shared shopping list records what to buy, and the recurring-chore guide tracks when work is next due. Keep each control labelled for its actual job.