get_history_range
Fetch raw state-change history for an entity within a defined date/time window. Use to inspect specific days or correlate with external events.
Instructions
Get raw state-change history for an entity over a date/time range.
Like get_history, but takes an explicit window instead of "N hours
from now". Useful for inspecting what happened on a specific day or
correlating with an external event.
Args:
entity_id: The entity to fetch history for.
start_time: ISO-8601 start (e.g. 2026-05-15 or
2026-05-15T08:00:00Z). Treated as UTC if no offset.
end_time: ISO-8601 end. Defaults to now (UTC).
Returns:
Same shape as get_history: entity_id, states, count,
first_changed, last_changed.
Examples: get_history_range("light.kitchen", "2026-05-15") get_history_range("sensor.power", "2026-05-15T00:00:00Z", "2026-05-16T00:00:00Z")
Best Practices:
- Bound the window — wider ranges return more data and more tokens.
- For aggregated long-term data, prefer get_statistics_range.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_time | No | ||
| entity_id | Yes | ||
| start_time | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |