← ClaudeAtlas

ha-recorder-querylisted

Query a Home Assistant sensor's history and trends from the recorder — pull a time series for an entity and compute its min / max / average / trend. Use when asked how a value changed over time, its high/low/average over a period, or whether it's trending up or down.
LayerTM/ClaudeInHA · ★ 0 · AI & Automation · score 70
Install: claude install-skill LayerTM/ClaudeInHA
Read a numeric entity's past values out of the HA **recorder** (the history database) and reduce the series to min/max/avg/trend with `jq`. The reliable, always-available path is the Supervisor-proxied Core API with `$SUPERVISOR_TOKEN` — no HA Token needed. Set shorthands and a time window (GNU `date` is available; timestamps must be timezone-aware ISO 8601): ```bash API=http://supervisor/core/api AUTH="Authorization: Bearer $SUPERVISOR_TOKEN" START=$(date -u -d '1 day ago' --iso-8601=seconds) # e.g. 2026-07-02T12:00:00+00:00 END=$(date -u --iso-8601=seconds) ``` For other windows: `date -u -d '6 hours ago' --iso-8601=seconds`, `'7 days ago'`, `'2026-07-01T00:00:00+00:00'` (pass a literal). Omitting the start entirely (`GET /history/period`) defaults to **1 day ago**. ## 1. Pull the history series `GET /history/period/<start>?filter_entity_id=<entity_id>`. The start timestamp is a **path** segment; everything else is query params. The response is an **array of arrays** — one inner array per entity (in the order listed), each a list of state points `{entity_id, state, last_changed, last_updated, attributes}`. ```bash # Raw time,value series for one entity over the window curl -sf -G "$API/history/period/$START" -H "$AUTH" \ --data-urlencode "filter_entity_id=sensor.living_room_temperature" \ --data-urlencode "end_time=$END" \ --data-urlencode "minimal_response" \ | jq -r '.[0][] | "\(.last_changed)\t\(.state)"' ``` Multiple entities: comma-separate them — `fil