ha-api-expert

ha-api-expert is an agent for Claude Code 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 for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

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

Good fit Use it to build external integrations, call Home Assistant services, subscribe to real-time events, query history, and manage entity states.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/nodnarbnitram/claude-code-extensions/ha-api-expert
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.

Clone the repo
git clone --depth 1 https://github.com/nodnarbnitram/claude-code-extensions

Made for: Claude Code.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ha-api-expert

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00069 $0.02958
Opus 5.5 $0.00028 $0.01183
Sonnet 5.5 $0.00014 $0.00592
Haiku 4.5 $0.00007 $0.00296

Measured 1mo ago against content hash 45be5c48597d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo ago.

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. 1mo ago 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 6mo ago), licensed MIT. It adds 69 tokens to every session and 2,958 once invoked, about $0.0003 per session on Opus 5.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

iot-protocol-engineer

Use this agent when choosing or designing connectivity for a device: MQTT, CoAP, LwM2M, BLE GATT, LoRaWAN, Thread, or Zigbee selection, topic and QoS design, power budgets, TLS or DTLS, or debugging disconnects and latency. It walks the constraint matrix before recommending a protocol, then designs the protocol layer…

HermeticOrmus/LibreEmbed-Claude-Code · 99 tokens

edge-python-specialist

Implement Python code for the edge service including picamera2, WebSocket, GPIO, and systemd.

atretyak1985/swarmery · 26 tokens

bubbaloop-node-author

Use when the user wants to create, scaffold, validate, or refactor a bubbaloop node (sensor/actuator/processor/gateway). Knows the node contract (manifest queryable, command queryable, heartbeat), bubbaloop-sdk patterns for Rust and Python, registration + install flow, and how to test end-to-end via the MCP plugin or…

kornia/bubbaloop · 86 tokens

realtime-dev

Real-time - Socket.io, WebSocket, Pusher, MQTT/ESP32, WebRTC: room, stato server-authoritative, riconnessioni. Usalo per feature real-time e IoT.

thomascasali/claude-kb-workflow · 0 tokens

ethernet-network-engineer

Automotive Ethernet specialist focused on TSN (Time-Sensitive Networking) configuration, switch setup, VLAN design, bandwidth allocation, QoS tuning, and network performance optimization for zonal vehicle architectures.

birol91/quorum-agents · 45 tokens

iot-engineer

Designs IoT systems with MQTT messaging, edge computing, device management, and telemetry pipelines.

Lua2147/claude-toolkit-catalog · 22 tokens