Skill: Grafana HA History
SkillMonitoring & opsQuery historical Home Assistant entity state via Grafana's Home Assistant InfluxDB datasource (InfluxQL). Use when the user asks about past states, "was X on/off", "when did…", history for an entity, overnight activity, or numeric sensor series over a time window, not for current/live state.
Available today. Use it from your connected AI after setup.
No other account needed.
Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
Then ask your AI: use the Skill: Grafana HA History skill
What this skill tells your AI
The instructions your AI receives, as published by apocrathia/home-assistant-config in .agents/skills/grafana-ha-history/SKILL.md and read by ahel’s review.
Purpose
Look up past Home Assistant entity state from Grafana → InfluxDB
(uid: homeassistant). Live/current state stays on the HA MCP.
When to Use
- "Was the garage open at 2am?"
- "When did the front door unlock last night?"
- "What was outdoor temp over the last 24h?"
- Any historical entity state / change timeline / numeric series
Not for current state — use HA MCP GetLiveContext (or equivalent) first.
Workflow
-
Resolve the entity — domain + object_id from the HA entity_id (
lock.back_door→ domainlock, object_idback_door). -
Route the question
- On/off, modes, locked/unlocked, open/closed, person home/away →
measurement
"state" - Continuous numbers (temp, power, humidity, …) → unit-named measurement
(
"°F","W","%", …)
- On/off, modes, locked/unlocked, open/closed, person home/away →
measurement
-
Pick a recipe in reference.md:
- Point-in-time (last value before T)
- Window changes (ordered events between T1 and T2)
- Numeric series (raw or downsampled)
-
Query via Grafana MCP
grafana_api_request:GET /api/datasources/proxy/uid/homeassistant/query?db=homeassistant&q=<URL-encoded InfluxQL> -
Answer with timestamps + values. Cite the InfluxQL used. Cap results with
LIMIT/ a tight time window. -
Empty result → verify
domain/entity_idtags (and measurement for numerics) before claiming there is no history. See traps in reference.md.
Hard rules
- Read-only. Do not write to Influx or mutate Grafana.
- Always URL-encode the
qparameter. - Influx tag
entity_idis the object_id only (no domain prefix). - Prefer
"state"+"value"fields on the"state"measurement for non-numeric entities. - Never invent measurement names — discover with
SHOW MEASUREMENTS/SHOW MEASUREMENTS WHERE "entity_id" = '…'when unsure.
Additional resources
- Schema, recipes, discovery queries, traps: reference.md
Signals
- GitHub stars
- 179
- Forks
- 32
- Last commit
- Sep 2026
Advanced
- Item type
- skill
- Key
grafana-ha-history- Source
- github.com/apocrathia/home-assistant-config