Skip to content

Repository files navigation

Entity Usage Tracker for Home Assistant

Validate GitHub release HACS Custom

A backend-only custom integration that counts entity usage and exposes dynamic, recency-weighted rankings for dashboards and automations.

Home Assistant's Counter and History Stats helpers are excellent for individual entities and fixed periods. Entity Usage Tracker complements them when one configuration should follow many entities and continuously rank the most useful controls without depending on recorder retention.

Features

  • Track explicit entities, complete domains, or both.
  • Exclude helper, group, or noisy entities explicitly.
  • Count entry into configured active states or every real state change.
  • Persist lifetime counts and last-used timestamps across restarts.
  • Rank entities with an exponentially decaying score so recent habits matter.
  • Expose individual count sensors and one aggregate ranking sensor.
  • Configure everything through Home Assistant's UI.
  • No frontend bundle, cloud service, or telemetry.
  • One-time import of persistent counts from Light Usage Tracker when its single config entry is present during setup.

Installation

  1. Add davidfarkas93/ha-entity-usage-tracker to HACS as a custom Integration repository.
  2. Install Entity Usage Tracker and restart Home Assistant.
  3. Open Settings → Devices & services → Add integration.

Configuration

  • Entities: specifically selected entities.
  • Domains: automatically include all currently available entities in these domains.
  • Excluded entities: remove unwanted helpers or groups.
  • Tracking mode: count entering an active state, or any state change.
  • Active states: values such as on, open, or playing.
  • Ranking half-life: how quickly old usage loses ranking weight.

Changing options reloads the tracker. Newly discovered domain entities are picked up on reload.

Migrating from Light Usage Tracker

Keep the old integration loaded while adding Entity Usage Tracker. If exactly one old config entry exists, its persisted counts, timestamps, and scores are imported automatically. Verify the new ranking before removing the old integration. Existing dashboard consumers can continue reading the compatibility attributes lights, tracked_lights, used_lights, and favorite_light.

Ranking sensor

The aggregate sensor's state is the highest-ranked entity ID. Its attributes include entities, top_5, total_usage, tracked_entities, and favorite_entity. Every ranked item contains entity_id, friendly name, lifetime count, last_used, and recency-weighted score.

Development

python -m pip install -e '.[test]'
ruff check .
pytest

License

MIT

About

A Home Assistant custom integration that tracks, ranks, and exposes frequently used entities using persistent and recency-weighted usage data

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages