Skip to main content
Glama

Hass-MCP

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

NameRequiredDescriptionDefault
entity_idYes
hoursNo

Input Schema (JSON Schema)

{ "properties": { "entity_id": { "title": "Entity Id", "type": "string" }, "hours": { "default": 24, "title": "Hours", "type": "integer" } }, "required": [ "entity_id" ], "title": "get_historyArguments", "type": "object" }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/voska/hass-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server