get_history
Retrieve state-change history for Home Assistant entities from the recorder to diagnose flapping sensors or see when an automation last ran.
Instructions
Fetch state-change history for one or more entities from HA's recorder.
Default window: last 24 hours. Use this to diagnose flapping sensors (count of changes) or to inspect when an automation last ran.
Args:
entity_id: A single entity id, or comma-separated list for multiple
(e.g. 'sensor.x,sensor.y').
hours: Window length in hours, ending at end (default now).
days: Window length in days. Ignored if hours is set.
start: ISO-format start datetime (e.g. '2026-05-22T00:00:00+00:00').
Overrides hours/days.
end: ISO-format end datetime (default: now).
significant: If true, use get_significant_states (HA's filtered
view). Default false = every recorded state change.
minimal: Smaller response shape (state + last_changed only).
Default true.
no_attributes: Strip attributes from the response. Default true.
Returns: {start, end, counts: {entity_id: n}, items: {entity_id: [...]}}.
counts is the quickest way to see how often a sensor flipped.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | ||
| days | No | ||
| hours | No | ||
| start | No | ||
| minimal | No | ||
| entity_id | Yes | ||
| significant | No | ||
| no_attributes | No |