Get entity state history
history_get_state_historyFetch an entity's recorded state history over the last N hours to track changes like temperature trends. Provides raw short-term recorder data, not logbook or statistics.
Instructions
Get an entity's recorded state history over the last N hours.
Calls GET /api/history/period/<start> filtered to entity_id, where
start is now - hours; returns whatever the recorder database has
kept for that window.
Use when: seeing how one entity's state changed over time, e.g. a
temperature trend.
Not for: human-readable event descriptions — use
history_get_logbook; this is raw, short-term state history, not the
recorder's long-term pre-aggregated sum/mean/min/max values — use
statistics_get_statistics for those, or statistics_list_statistic_ids
to discover which entities have them.
Returns: HA's raw history-period payload — a list of state-change
records for the entity.
Errors: raises httpx.HTTPStatusError if the HA API request fails.
Limits: only as far back as the recorder integration has retained data
for this entity.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hours | No | How many hours back from now to fetch, e.g. 24 for one day. Default 24. | |
| entity_id | Yes | Full entity ID to fetch history for, e.g. 'light.kitchen'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |