Count
The count helper gives you one number: how many lights are on, how many windows are open, how many things are unavailable. It counts the entities you select that match a rule, and keeps up as they change.
What to count, you pick the way you pick the target of an action: entities by hand, or everything on a device, in an area, on a floor or with a label. Narrow that down by domain or device class, or count a domain in the whole home. Move a lamp to another room, or give a sensor a label, and the count follows right away.
Creating a count helper
Add one directly to your own instance by selecting the My Home Assistant button below:
Or add one by hand:
- Go to Settings > Devices & services, and select the Helpers tab.
- Select + Create helper.
- Search for count, and select Count 👻.

- Give it a Name, like "Lights on".
- Under What to count, pick entities, devices, areas, floors or labels. Or leave it empty, and pick a domain in the next step to count it in the whole home.
- Optionally, narrow it down under Only these domains, like
light, and Only these device classes, likewindow. - Under Counts when it, pick the rule:
- Is one of these states: fill in the states under States, like
onoropen. - Is above a number or Is below a number: fill in the Number. A state that is not a number, like
unavailable, is never above or below anything. - Is unavailable: counts the entities that are
unavailable.
- Is one of these states: fill in the states under States, like

- Select Submit. Done! 🎉
Changed your mind later? Open the helper from the Helpers tab, and change what it counts and when in its options.
A few to start with
| You want | What to count | Only these domains | Only these device classes | Counts when it |
|---|---|---|---|---|
| Lights on in the kitchen | Kitchen (area) | light | Is one of these states: on | |
| Windows open | binary_sensor | window | Is one of these states: on | |
| Batteries low | sensor | battery | Is below a number: 20 | |
| Flaky things unavailable | A label | Is unavailable | ||
| People home | person | Is one of these states: home |
How it works
You get two entities, both with the name you gave the helper:
- A sensor with the count. It keeps long-term statistics, so you can see how many lights were on last week.
- A binary sensor that is on when at least one entity counts: any window open.
Both keep up as things change. An entity changing state, getting a label, moving to another area or another floor, or being added or removed: the count follows right away. Only the entity that changed is looked at, so a count over a big home stays cheap.
- Restarts: while Home Assistant starts, entities come in one by one. The helper waits until Home Assistant has started, and is unknown until then. That way, a restart does not count up from zero, and does not turn "any" from off to on as if a window was opened just now. It does go from unknown to on when a window is open: an automation that triggers on
to: "on"alone runs then. Addfrom: "off"to the trigger to only act on a window that opens. - Unavailable: an entity that is unavailable does not count as on, open, above or below. It drops out of the count, and comes back in when it is back. To count those, make a helper with Is unavailable.
- Renames: an entity you picked by hand that gets a new entity ID stays picked.
What counts, and what does not
The selection means the same as the target of an action. On top of that:
- Excluded never counts. Use Exclude target under What to count to leave out an entity, a device, an area or a label, like the one lamp in the living room you never want to see in the count. Exclude a group, and its members stay out too.
- Picked by hand always counts, hidden or not. You picked it on purpose.
- Found through a device, area, floor, label or domain, hidden entities are left out, and so are config and diagnostic entities. The same rule Home Assistant uses when an action targets an area.
- Disabled entities never count. They have no state.
- Groups never count twice. A group never counts as itself, only its members do. A group is an old style group, a group from the group helper, a Hue group, or a group an integration like ZHA or MQTT makes. A sensor that only lists its inputs, like min/max, is no group: it counts as itself.
- A group stands for its members, whether you picked it by hand or it was found through an area, label or domain. Its members count in its place, even when the group helper hides them, and the count follows them as members join or leave.
- Counts never count: not the helper itself, and not another count. A count of sensors above 0 skips every count sensor, so two counts never chase each other.
Attributes
| Attribute | Description |
|---|---|
entities | The entities that count right now, on both the sensor and the binary sensor. Not kept in history, only the count. |

Attribute as sensor
The attribute as sensor helper turns one attribute of an entity into a sensor of its own, with a unit, a device class and long-term statistics, without writing a template.
Recurring task
The recurring task helper keeps track of one thing that comes back, like changing the air filter every 90 days. A sensor says when it is due, a button marks it done.



