Use when diagnosing why a Home Assistant automation, script, device, or integration failed or misbehaved — root-cause analysis from traces, bounded history, and integration diagnostics through HA NOVA Relay; logs stay in Home Assistant. For current home status use ha-nova:health; for plain timelines use ha-nova:history.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Diagnose?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/markusleben-diagnose)
---
name: diagnose
description: Use when diagnosing why a Home Assistant automation, script, device, or integration failed or misbehaved — root-cause analysis from traces, bounded history, and integration diagnostics through HA NOVA Relay; logs stay in Home Assistant. For current home status use ha-nova:health; for plain timelines use ha-nova:history.
license: MIT
compatibility: Requires the ha-nova CLI (run 'ha-nova setup' first) and the HA NOVA Relay in Home Assistant (App, or standalone container on Container/Core).
---
# HA NOVA Diagnose
## Scope
Root-cause a concrete failure: "why did X not run", "why did X misbehave", "what broke last night".
- Evidence sources: automation/script traces, bounded logbook/history windows, template probes, integration diagnostics. Log lines stay in Home Assistant; log facts (counts and times per integration) are read (Logs, below).
- Boundary: `ha-nova:health` reports CURRENT home status (repairs, unavailable entities); `ha-nova:history` answers plain timeline questions; `ha-nova:review` audits config quality without a concrete incident. This skill starts from a concrete symptom.
- The ONLY mutation in this skill is a temporary `logger.set_level` debug escalation (see Flow step 5) — every other fix hands off to the owning skill (`ha-nova:write`, `ha-nova:helper`, `ha-nova:service-call`, `ha-nova:integration-setup` for credential recovery).
## Bootstrap (once per session)
Read and follow `../ha-nova/session-bootstrap.md`.
## Relay Contract
`ha-nova call` returns the preview: confirm it once, then `ha-nova apply --plan <id>`.
File-based relay requests only:
- `ha-nova relay core --method GET --path <PATH>` for REST reads (`--out <result-file>` for large output)
- `ha-nova call <domain.service> --skill ha-nova:diagnose [--set k=v]…` for services (`logger.set_level`)
- `ha-nova relay ws --data-file <payload-file>` for WS commands
- `ha-nova trace latest <entity_id> --json` / `ha-nova trace list <entity_id> --json` / `ha-nova trace get <entity_id> <run_id> --json` for run traces (positional entity, `automation.<id>` or `script.<id>`)
- `--jq-file <filter-file>` for non-trivial filters
## Evidence Sources
| Source | Call | Notes |
|--------|------|-------|
| Run traces | `ha-nova trace latest <entity_id> --json` (also `trace list <entity_id>`, `trace get <entity_id> <run_id>`) | First stop for automation/script failures: shows the exact step, condition results, and variables |
| Voice | `assist_pipeline/pipeline_debug/list` (`pipeline_id`), then `assist_pipeline/pipeline_debug/get` (plus `pipeline_run_id`) | Read-only; resolve via `assist_pipeline/pipeline/list` |
| State history + logbook | `ha-nova history <entity_id> --since <incident minus 30 min, RFC3339> --until <incident plus 30 min, RFC3339> [--logbook]` | Summarized states and events (≤ 7 days) |
| Template probe | `ha-nova relay core --method POST --path /api/template --body-file <payload-file>` with `{"template":"{{ ... }}"}` | Evaluate the exact condition/template against live state; the rendered result is the string in `.data.body` |
| Integration diagnostics | WS `{"type":"diagnostics/list"}`, then `GET /api/diagnostics/config_entry/<entry_id>` with `--out <result-file>` | Deep integration state when an integration itself is the suspect |
| Device diagnostics | `GET /api/diagnostics/config_entry/<entry_id>/device/<device_id>` with `--out <result-file>` | One device's slice when a single device misbehaves; resolve the `(entry_id, device_id)` pair via WS `diagnostics/list` (only entries with a device-diagnostics handler) — a device can carry several entry ids |
Diagnostics redaction is integration-controlled, so downloads are potentially sensitive and NEVER hit bare stdout — save with `--out`, extract only relevant fields via `relay jq` before quoting.
### Logs
HA NOVA never reads log lines (`/api/error_log`, Core, Supervisor, host, and App logs are refused, exit 4): they can hold passwords, keys, and addresses. It reads **log facts** instead: WS `{"type":"system_log/list"}` with no other key answers `log_facts` (per integration `domain` and `level`: `count`, `first_retained`, `last`, in UTC) and `unattributed_count`, never a message. Read them to see which integration has been failing and since when. `first_retained` is the oldest entry the log still holds (it keeps a bounded number, and a restart empties it), not the first ever: say "since at least". A fact is a lead, not a finding: an integration's own code names its logger. If the App refuses the read, go on without it. When the message itself would decide the diagnosis, ask the user to open **Settings > System > Logs** (an App's own log: **Settings > Apps > the App > Log**), search for the integration or entity, and tell you the few lines around the incident time, without passwords, keys, or addresses. Never ask for the whole log. Lines about other integrations are not evidence for this incident, and no line about it is a finding in itself, not a reason to search wider. The Core log reaches back only to the last restart: for older incidents use logbook/history windows, and say so.
## Flow
1. Pin the symptom: which entity/automation/script, what expected vs observed behavior, and WHEN. A day word ("today", "this morning", "last night", "yesterday") already sets the window: that span in HA's time zone (`GET /api/config` → `time_zone`), ending now at the latest — read the evidence first, and ask only if it is still ambiguous. Ask one question for the time only when nothing bounds it. Resolve names with `ha-nova find "<phrase>" --domain automation` (no `--name` flag).
2. For automation/script symptoms, read the trace first (`ha-nova trace latest <entity_id> --json`; older runs via `trace list <entity_id>` + `trace get <entity_id> <run_id>`). No run in the window (no trace, `last_triggered` null or older): check its own state first (`off`, `unavailable`). Automation: take its triggers from `ha-nova get <entity_id> --config` (blueprint instance: expand once with `blueprint/substitute`, `../ha-nova/consumer-discovery-preflight.md`) and compare each trigger's full predicate (`from`/`not_from`, `to`/`not_to`, `attribute`, `for:`) against the trigger entity's history for the window — only a matching change means it fired, so check the conditions. No change while the entity sits in the `to:` state → a `state` trigger fires only on a transition, so that is the root cause: name the state and when it changed. Script: it runs only when called — check its callers (`ha-nova get <entity_id> --related`) and the logbook (`ha-nova history <entity_id> --logbook`).
3. Logs, only when traces and history leave the cause open: read the log facts first (the WS request in Logs, above, sent like any WS read); ask the user for the few lines only when the message itself decides it (Logs, above). Align timestamps before claiming causation: the log line must sit within minutes of the trace's failing step — an error far outside that window is context, not the cause; say which it is.
4. Reconstruct context: bounded logbook + history windows (±30 minutes around the incident, or the day-word window) for the involved entities (`ha-nova history --since --until`, above; omit `--until` for a window ending now — a future one is rejected); probe suspect conditions/templates against live state (`relay core --method POST --path /api/template --body-file <payload-file>`, body `{"template":"{{ ... }}"}`; the rendered value comes back in `.data.body`).
5. Debug escalation (optional, the only mutation): if evidence is insufficient and the user agrees, raise one integration's log level.
- FIRST read the current levels: WS `{"type":"logger/log_info"}` → `[{"domain":..., "level": <numeric>}]`. `logger/log_info` reports NUMBERS but `logger.set_level` only accepts NAMES — map the recorded number back before building any payload: `10` → `debug`, `20` → `info`, `30` → `warning`, `40` → `error`, `50` → `critical`. A numeric level in a `set_level` payload is rejected by Home Assistant, which would leave debug logging raised until the next restart. Record the target logger's mapped level — that is the state you must restore. If it has no entry, the effective level is the configured default (HA's own default is `warning`, but `configuration.yaml` may set another).
- Escalate: `ha-nova call logger.set_level --skill ha-nova:diagnose --set homeassistant.components.<domain>=debug`.
- The user reads the debug lines on the log page (Logs, above).
- ALWAYS pair it with the reset: after reproducing, rerun it with the recorded level NAME (mapped above), not `debug` — never the raw number, and never a hard-coded `warning`, which would silently overwrite a level the user set on purpose. Home Assistant has no "remove override" service: an override persists until the next restart, so restoring means setting the recorded level back explicitly (or restarting HA for a truly clean state). Say this plainly before escalating.
6. Conclude with Claim-Evidence Binding: name the root cause only when the evidence shows it (trace step, log line, state sequence). Otherwise present the ranked hypotheses, each with its evidence and the one probe that would decide it.
7. Hand off the fix: config changes -> `ha-nova:write` / `ha-nova:helper`; a one-off corrective action -> `ha-nova:service-call`; invalid credentials or a pending reauthentication -> `ha-nova:integration-setup`; systemic issues (repairs, unavailable entities) -> `ha-nova:health`; an ESPHome device's own YAML (pins, removed keys, Wi-Fi/API/OTA) -> `ha-nova:esphome`.
## Error Handling
Full relay/upstream error taxonomy: `../ha-nova/relay-api.md` -> Error Handling. Diagnose specifics:
- A refused log read is expected: read the log facts, or ask the user (Logs, above).
- Missing traces (empty `trace list`): traces are kept per entity with a small cap and reset on reload/restart — say so instead of guessing.
## Output Format
Apply `../ha-nova/output-rules.md`: plain words, HA names verbatim; unless asked or names clash, no ids, "entity", modes, Relay/HA URLs, snapshots, raw JSON. Previews, deletes, and results use the Cards defined there (`../ha-nova/output-cards.md`).
Render the Report shape, Diagnosis specialization (output-cards.md → Report Shape): root cause first, then the evidence chain and the recommended fix (the handoff stays internal). Quote logs sparingly.
## Safety
- Safety Core: before any write, apply `../ha-nova/safety-core.md`; not yet in this conversation → read it first; unreadable or incomplete → stop and write nothing.
- Drafts follow `../ha-nova/smallest-solution.md`: the complete requested outcome in the simplest safe design, nothing speculative.
- The debug escalation (`logger.set_level`) is this skill's single declared mutation: read the current level via `logger/log_info` first, preview + natural confirmation, and always schedule the restore of THAT recorded level (never a hard-coded default) in the same interaction.
- Never "fix" anything from here — fixes hand off to the owning skill after the diagnosis.
## Guardrails
- Bounded reads only: logbook/history windows default to ±30 minutes (or the day the user named); widen stepwise on request, never unbounded.
- Never ask for a whole log, and never try to reach one another way.
- Do not run diagnostics proactively — this skill starts from a user-reported symptom.
- Never leave a raised log level behind: no recorded pre-level and no restore plan means no escalation.