get_history
Retrieve the state change history of a specific entity within a defined timeframe. Ideal for analyzing discrete state transitions over hours or days, such as light or sensor activity.
Instructions
Get the history of an entity's state changes
Args: entity_id: The entity ID to get history for hours: Number of hours of history to retrieve (default: 24)
Returns: A dictionary containing: - entity_id: The entity ID requested - states: List of state objects with timestamps - count: Number of state changes found - first_changed: Timestamp of earliest state change - last_changed: Timestamp of most recent state change
Examples: entity_id="light.living_room" - get 24h history entity_id="sensor.temperature", hours=168 - get 7 day history Best Practices: - Keep hours reasonable (24-72) for token efficiency - Use for entities with discrete state changes rather than continuously changing sensors - Consider the state distribution rather than every individual state
Input Schema
Name | Required | Description | Default |
---|---|---|---|
entity_id | Yes | ||
hours | No |