Researched from current Home Assistant documentation and Core 2026.10.1 source on October 11, 2026. The timeline below is a calculated example, not a measured Tara installation. No device or live Home Assistant installation was tested for this guide. Menu labels can differ on older releases.
Add up the on-time, without building a timer automation
Home Assistant History Stats is the simplest built-in starting point for “How long was this lamp on today?” Create a helper—a value calculated inside Home Assistant—that watches the lamp’s recorded on state. It can combine several separate sessions into one daily total.
You need an existing device that reports its state, plus retained history for that device. You do not need a new timer, a paid service, or a custom integration. Start with a lamp whose on/off status already looks right in Home Assistant, and display its total before using it in any automation. The History Stats documentation describes the available helper settings.
This measures reported state over time. It does not independently watch the bulb, measure electricity, or turn anything off. If your actual question is “stop something after ten minutes,” use the separate countdown and restart guide. A daily runtime display answers what happened, rather than scheduling a future action.
1. Choose a state that means the right thing
An entity is a named item in Home Assistant, such as light.reading_lamp. Open Settings → Tools → States, or Developer tools → States on older releases, and read its stored state. Use this screen to inspect; do not use Set state as a device test. The Tools documentation explains that changing a displayed state does not command the physical device.
Swipe the table sideways to read all columns.
| You want to know… | Suitable starting point | What the result means |
|---|---|---|
| How long a lamp was on | The lamp entity; state on | Time Home Assistant recorded the lamp as on, including dimmed operation. |
| How long a window was open | Its contact binary sensor; stored state on | Reported open time. The interface may label this “Open,” but the stored value is on. |
| How long an appliance worked | A verified running-status entity, if the integration provides one | A smart plug’s on state alone measures enabled supply, including appliance standby. |
| How long heating actually ran | A supported activity report, rather than thermostat mode | heat means heating mode is selected. It can include time when the system is idle. |
Home Assistant’s binary-sensor reference confirms the Open/on mapping. For thermostats, the climate reference separates mode from the optional hvac_action attribute, which describes current activity. History Stats selects entity states, not an arbitrary attribute. If activity exists only as an attribute, it needs a separate recorded sensor before you can count it this way. If the integration does not report activity, this lamp recipe cannot establish burner or compressor runtime.
2. Create the daily runtime helper
- Open History and select the source entity. Check that today’s on and off periods appear. A current on/off reading alone does not prove that earlier changes were saved. See the History instructions if your panel is empty.
- Go to Settings → Devices & services → Helpers → Create helper → History Stats.
- Name it Reading lamp on today, select your lamp, and choose Time. Select the state corresponding to
on. - In the period options, enter the settings below. Expand Additional settings to check Minimum state duration. Home Assistant may spread these fields across several dialogs.
- Save, then add the new sensor to an editable dashboard. An Entities card can show the lamp and its runtime together.
Swipe the table sideways to read all columns.
| Setting | Enter or choose | Reason |
|---|---|---|
| Type | Time | Produces accumulated duration in hours. |
| Start | {{ today_at('00:00') }} | Midnight in Home Assistant’s configured local time zone. |
| End | {{ now() }} | Count up to the current time. |
| Duration | Leave empty | Use exactly two of Start, End and Duration. |
| State class | Total increasing | For this daily total, lets statistics accumulate increases across daily resets. |
| Minimum state duration | 0 seconds | Include short sessions while checking your setup. |
State class tells Home Assistant how to store statistics about a sensor; it does not change which device state you count. Choose it when creating this new helper. The fields above are supported by the 2026.10.1 helper configuration.
For a rolling 24-hour view, create a separate helper: leave Start empty, use {{ now() }} for End, set Duration to 24 hours, and choose Measurement as its state class. That moving total can fall as yesterday’s sessions leave the window. The today_at reference explains local time; a local calendar day is not always exactly 24 elapsed hours when clocks change.
3. Check a whole day, including the midnight boundary
Imagine these recorded lamp sessions. The first began before midnight; only its portion inside today belongs in today’s total. This is arithmetic to explain the settings, not a claim about a real household.
Swipe the table sideways to read all columns.
| Recorded on-session | Counted today | Running total |
|---|---|---|
| Yesterday 23:50 → today 00:20 | 20 minutes | 20 minutes |
| Today 06:30 → 07:15 | 45 minutes | 65 minutes |
| Today 18:00 → 19:10 | 70 minutes | 135 minutes |
After the final switch-off, the expected Time result is 135 ÷ 60 = 2.25 hours. Likewise, 1.50 hours means 90 minutes, not one hour and fifty minutes. Period clipping and matching-state accumulation follow the History Stats calculation.
If you create another helper with Type Count, this example has three matching on-periods, even though only two switch-ons happened after midnight. The already-on session at the start also counts. Choose Time for duration; do not read Count as hours or assume it is a strict count of today's button presses.
4. Rehearse without controlling an appliance
Use a separate Toggle helper as a pretend lamp. It changes only its own value unless you connect it to an automation. Leave it unconnected to device actions.
- Create a Toggle helper named Runtime practice. Set it off and confirm its changes appear in History.
- Create another History Stats helper using the daily settings above, but select this Toggle as the source. Note its starting total; a new, previously unused source should be near zero.
- Turn the Toggle on for three minutes, off for one minute, then on for another three minutes. Turn it off again. Avoid crossing midnight during this rehearsal.
- Allow the next update. The total should have increased by about 0.10 h: six on-minutes divided by sixty. The intervening off-minute should not count.
- Leave it off for another minute. The daily total should stay steady. Then compare your real lamp’s total with its History timeline before relying on it.
History Stats updates when the source changes and otherwise about once a minute. Allow for that cadence and your timing; this is not a stopwatch calibration. If your source history is absent, fix recording first rather than repeatedly recreating the helper.
5. Keep older daily summaries without pretending history is unlimited
Recorder is the part of Home Assistant that saves state history. Its default detailed-history retention is ten days. Asking History Stats for the last thirty days does not create the missing twenty days. Review the source’s inclusion in Recorder and the retained period before interpreting a long total. The Recorder documentation describes the filters and retention setting.
For future daily comparisons, the daily Total increasing helper above can produce long-term statistics if that new sensor is also recorded. Home Assistant stores these hourly summaries separately from the original on/off events. A new sensor’s initial reading becomes a baseline: do not assume its first partial day backfills all earlier runtime. See long-term statistics.
Once statistics exist, an optional Statistics graph card can show daily changes as bars. In an editable dashboard, add a Manual card and paste the following, replacing the example sensor ID with your actual helper’s ID:
type: statistics-graph
title: Reading lamp runtime by day
entities:
- sensor.reading_lamp_on_today
stat_types:
- change
period: day
chart_type: bar
days_to_show: 7
The bars summarize accumulated recorded on-time, not electrical consumption. They do not restore purged switch events or prove what happened while Home Assistant was offline. Keep the raw source history available while checking the first complete days. Before increasing retention substantially, review the Recorder storage guide; this setup does not require deleting history or disabling automatic cleanup.
If the number looks wrong
Swipe the table sideways to read all columns.
| Symptom | Check first | Useful next step |
|---|---|---|
| Zero while the window was open | Stored state versus displayed label | Check for on, not the word “Open,” and verify the source has recorded history. |
| More runtime than expected | What the selected entity represents | A powered plug or thermostat mode may stay on while the appliance is idle. Inspect a genuine activity report if available. |
| The total drops during the afternoon | A rolling period or missing older history | Check Start/End/Duration. A trailing window drops old sessions; a window beyond retained history is incomplete. |
| Very short sessions disappear | Minimum state duration | Use zero during verification, then choose a deliberate filter only if those sessions should be excluded. |
| The chart has no daily change bars | The helper’s state class, recording and age | Confirm Total increasing for the new daily helper, confirm Recorder includes it, and allow statistics to be generated. Do not erase existing statistics as a first fix. |
A missing report is not proof of inactivity. An unavailable interval is not a match for on; conversely, an integration that leaves a stale on value can make apparent runtime too long. Compare the underlying timeline. For recurring connection problems, the unavailable-device guide explains why unchanged and unavailable are different.
Common questions
Do I need an automation to reset the total at midnight?
No. With Start set to today’s midnight and End to now, the measurement window moves to the new day automatically. You do not need a midnight reset automation or a Utility Meter solely to reset this display.
Will it know what happened during a Home Assistant outage?
Do not assume so. It calculates from available recorded states, not an independent physical runtime meter. Missing changes during an outage limit the result. A restart is not a reason to discard the history that was successfully recorded.
Does this keep everything local?
The calculation happens in Home Assistant. The source device may still depend on a vendor cloud to report its state. Saving runtime also creates a record of household activity; consider that before tracking occupancy or individual people.
Our recommendation is to start with one clearly named device and a visible source timeline. If you are planning the wider system, Tara’s configured Home Assistant setup explains the setup path. Agree on what each reading actually represents before using it to make household decisions.
