Skip to main content
Glama

get_statistics

Retrieve aggregated statistics (mean/min/max) for Home Assistant entities over specified time ranges, handling historical data efficiently without token limits.

Instructions

Get aggregated statistics (mean/min/max) for an entity. Best tool for historical data — no token limits.

By default returns last N hours. Provide start_time to query a specific date range instead. Handles any range efficiently (days, months, years). If get_history hits token limits, use this tool with the same time range instead.

Args: entity_id: Entity ID to get statistics for hours: Hours of data (default: 24). Ignored if start_time is provided. start_time: ISO 8601, date only, or 'yesterday'/'today'. If set, uses range mode instead of hours. end_time: End of range (default: 'now'). Only used with start_time. period: Aggregation period (default: 'hour'): '5minute' (~12 points/hr), 'hour' (24/day), 'day' (monthly views), 'week' (quarterly), 'month' (yearly). Match period to time range.

Examples: get_statistics("sensor.temperature", hours=24, period="hour") get_statistics("sensor.power_usage", hours=168, period="day") get_statistics("sensor.temperature", start_time="2024-10-01", end_time="2024-10-31", period="day") get_statistics("sensor.humidity", start_time="yesterday", period="5minute")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idYes
hoursNo
start_timeNo
end_timeNo
periodNohour

Latest Blog Posts

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/rmaher001/hass-mcp-plus'

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