Get long-term statistics
get_statisticsRetrieve hourly, daily or monthly long-term statistics for Home Assistant sensors to track energy and temperature trends. List available statistic ids or return mean, min, max and sums per period.
Instructions
Long-term statistics (hourly, daily, monthly aggregates that outlive the normal history), used for energy, temperature trends and any sensor with a state class. Without statistic_ids it lists the available statistic ids, optionally filtered by query. With ids it returns mean, min, max, sum, state or change per period, plus a small summary.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_statistics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | ISO end time. | |
| hours | No | How far back to look when start is not given. | |
| query | No | When listing, text matched against id and name. | |
| start | No | ISO start time. Overrides hours. | |
| types | No | ||
| period | No | hour | |
| max_points | No | Maximum periods per statistic, newest kept. | |
| statistic_ids | No | Statistic ids, usually entity ids such as sensor.energy_total. Omit to list what exists. |