get_statistics_range
Need historical statistics for a Home Assistant entity over a specific period? Retrieve aggregated data by providing entity ID, start/end times, and bucket period.
Instructions
Get long-term aggregated statistics for an entity over a date/time range.
Same data source as get_statistics, but with an explicit window —
useful for "what was my power usage from Jan 1 to Jan 31?" type
questions. Aggregated bucket data survives the short-term retention
window, so this works for data months/years old.
Args:
entity_id: The entity (must be statistics-tracked).
start_time: ISO-8601 start (2026-01-01 or
2026-01-01T00:00:00Z). UTC if no offset.
end_time: ISO-8601 end. Defaults to now.
period: 5minute, hour, day, week, or month.
Returns:
entity_id, period, start_time, end_time, statistics.
Examples: get_statistics_range("sensor.energy", "2026-01-01", "2026-02-01", period="day") get_statistics_range("sensor.temperature", "2026-05-01", period="hour")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | hour | |
| end_time | No | ||
| entity_id | Yes | ||
| start_time | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |