ha-api-expert

ha-api-expert is an agent for coding agents from nodnarbnitram/claude-code-extensions. It costs 69 tokens per session (2,958 once invoked), scanned A, original, MIT.

A guide to Home Assistant's REST and WebSocket APIs, which let other programs read device states, call services, and receive live events. It also covers API authentication.

In plain words
What is it for?
Use it to build external integrations, call Home Assistant services, subscribe to real-time events, query history, and manage entity states.
Why use it?
It removes the guesswork from choosing an API, setting up access tokens, and handling state or event communication.

Agent

Part of the cce-homeassistant plugin — 7 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/nodnarbnitram/claude-code-extensions/ha-api-expert
Clone the repo
git clone --depth 1 https://github.com/nodnarbnitram/claude-code-extensions

Or install cce-homeassistant, the plugin that ships this one along with the rest of its 7 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ha-api-expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/nodnarbnitram/claude-code-extensions/ha-api-expert.svg)](https://agentmods.dev/agents/nodnarbnitram/claude-code-extensions/ha-api-expert)
Your own site
<a href="https://agentmods.dev/agents/nodnarbnitram/claude-code-extensions/ha-api-expert"><img src="https://agentmods.dev/badge/agents/nodnarbnitram/claude-code-extensions/ha-api-expert.svg" alt="Measured on agentmods" height="20"></a>
Per session 69 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,958 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00069 $0.02958
Opus 5 $0.00034 $0.01479
Sonnet 5 $0.00014 $0.00592
Haiku 4.5 $0.00007 $0.00296

Measured yesterday against content hash 45be5c48597d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

ha-api-expert scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

response = requests.get(f"{BASE_URL}/api/states/light.living_room", headers=HEADERS)
plugins/cce-homeassistant/agents/ha-api-expert.md · 334 lines

How it starts

The opening of the file, as written. The whole thing — 334 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Purpose

You are a Home Assistant API integration expert specializing in REST API and WebSocket API communication, authentication, state management, service calls, and real-time event handling.

Instructions

When invoked, you must follow these steps:

  1. Identify Integration Scope

    • Determine if the user needs REST API (HTTP-based) or WebSocket API (real-time)
    • Clarify authentication requirements (Long-Lived Access Token vs OAuth)
    • Understand the use case: state management, service calls, event subscriptions, or history queries
  2. Provide Authentication Guidance

    • Explain Long-Lived Access Token creation (Profile → Security → Create Token)
    • Show Bearer token authentication pattern: Authorization: Bearer TOKEN
    • For WebSocket: explain connection flow (auth_required → auth → auth_ok/auth_invalid)
    • Cover security best practices: token rotation, scope limitation, secure storage
  3. REST API Endpoint Mapping

    • GET /api/ - API status check (returns {"message": "API running."})
    • GET /api/config - Current configuration (location, units, version)
    • GET /api/states - All entity states
    • GET /api/states/<entity_id> - Specific entity state
    • POST /api/states/<entity_id> - Create/update entity state
    • POST /api/services/<domain>/<service> - Call service (with optional ?return_response=true)
    • GET /api/services - List all available services
    • POST /api/events/<event_type> - Fire custom event
    • GET /api/events - List event types with listener counts
    • GET /api/history/period/<timestamp> - Query state history (params: filter_entity_id, end_time, minimal_response)
    • POST /api/template - Render Jinja2 templates
    • GET /api/error_log - Retrieve error logs
  4. WebSocket API Communication

    • Connection Flow:
      1. Connect to ws://HOST:8123/api/websocket
      2. Server sends: {"type": "auth_required", "ha_version": "..."}
      3. Client sends: {"type": "auth", "access_token": "TOKEN"}
      4. Server responds: {"type": "auth_ok"} or {"type": "auth_invalid"}

Read the full file on GitHub · 334 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 334 lines · 69 tokens per session scan A 45be5c48597d

Subscribe to this mod's changes

ha-api-expert is an agent published in the GitHub repository nodnarbnitram/claude-code-extensions (16 stars, last pushed 4mo ago), licensed MIT. It adds 69 tokens to every session and 2,958 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other agents, from other repositories

apple-neural-performance-expert

Use this agent when you need expert guidance on optimizing neural network operations on Apple platforms, including Metal Performance Shaders (MPS), MLX framework optimization, low-level array operations, GPU kernel optimization, memory management for ML workloads, or performance profiling of neural network code. This…

FluidInference/FluidAudio · 0 tokens

antenna-engineer

Reasons from gain–directivity–efficiency, Chu–Harrington bandwidth limits, and array factor through HFSS/CST/FEKO synthesis, IEEE 149-2021 NF/FF/CATR metrology, CTIA TRP/TIS/ECC OTA, and Friis link budgets while treating ground-plane truncation, active impedance in arrays, range ripple, and S₁₁≠pattern conflation as…

K-Dense-AI/scientific-agents · 97 tokens

fabricator

3D printing and additive manufacturing specialist covering FDM, SLA, and SLS processes from model preparation through troubleshooting.

pjt222/agent-almanac · 25 tokens

cocotb-reviewer

RAT audit protocol (condensed; dev source: plugindocs/agent-lib/audit-output-protocol.md — plugin-internal, do NOT Read it at runtime).

babyworm/rtl-agent-team · 51 tokens

labview-class-generator

Creates LabVIEW classes end to end — settles the data model, writes each .lvclass with its private data control through NI's own project provider VIs, links inheritance, creates INTERFACES and links a class to the ones it implements, binds .ctl typedef fields so they point at the file rather than carrying a de-linked…

Zuehlke/labview-mcp · 404 tokens

persona-high

Simulated senior IC designer with full datasheet / PDK / corner fluency. Specifies CRC polynomials, bit-period cycles, opcode hex, GF180MCU 5V corners. Pushes back hard when the AI hand-waves and demands datasheet-section traceability. Drives the IC Expert Agent (plain-language register) during Phase-1 training to…

vibeic/vibe-ic · 111 tokens