How can Home Assistant consume jobs from an external system? #47

Closed
opened 2026-11-23 16:05:22 -05:00 by bobby · 1 comment
Owner

Part of #44

Question

What mechanisms does Home Assistant offer for receiving or pulling commands from an external system? Cover MQTT integration (and RabbitMQ's MQTT plugin), AMQP (any integration?), REST/RESTful command polling, webhooks, WebSocket API, and custom integrations (HACS/custom_components). For each: direction of connection (HA-initiated vs inbound), auth, reliability/acknowledgement semantics, and maintenance burden.

Part of #44 ## Question What mechanisms does Home Assistant offer for receiving or pulling commands from an external system? Cover MQTT integration (and RabbitMQ's MQTT plugin), AMQP (any integration?), REST/RESTful command polling, webhooks, WebSocket API, and custom integrations (HACS/custom_components). For each: direction of connection (HA-initiated vs inbound), auth, reliability/acknowledgement semantics, and maintenance burden.
bobby added the wayfinder:research label 2026-11-23 16:05:22 -05:00
bobby added a new dependency 2026-11-23 16:05:35 -05:00
Author
Owner

Answer

  • No AMQP/RabbitMQ integration exists in Home Assistant. HA core has no such component and the docs have no page for it. Its only built-in message-bus client is MQTT.
  • HA's MQTT docs explicitly say RabbitMQ's MQTT plugin is not supported: "Neither ActiveMQ MQTT broker nor the RabbitMQ MQTT Plugin are supported, use a known working broker like Mosquitto instead." HA requires a broker that supports MQTT 5.
  • HA's MQTT client always uses a clean session (clean_start=True, from the core source). A broker therefore can't queue jobs for HA while it is offline, whichever broker is used. QoS 1 only covers delivery on a live connection.
  • No built-in mechanism acknowledges at the job level. Durability belongs in hAPI (a Postgres job table with retries and idempotency keys), plus a result path back from HA.
  • Mechanisms where HA opens the connection:
    • MQTT to a cluster-run Mosquitto, with results via mqtt.publish and liveness via homeassistant/status.
    • REST polling of hAPI plus rest_command callbacks (30 s polling, clunky YAML).
    • A custom integration (most flexible, highest upkeep).
  • Mechanisms where hAPI calls HA (needs the private link from #46):
    • REST API: synchronous, return_response, long-lived Bearer token.
    • WebSocket API: a result per command id, plus event subscriptions.
    • Webhook trigger: ID-only auth and an always-200 response, so a poor fit.
  • Custom integration distribution changed: since 2026.11 the built-in Marketplace replaces HACS and only accepts public GitHub repos. A private custom integration hosted on Gitea would have to be installed by hand.

Implication for #55: if the private link exists, hAPI calling HA's REST or WebSocket API is the simplest bridge (no broker, no HA-side code). If HA must initiate, MQTT to Mosquitto is the supported path. RabbitMQ is only worth it if hAPI wants AMQP for its own reasons.

Context pointer

Branch research/ha-job-consumption. Findings (with sources and a comparison table): https://git.bobbypalko.com/bobby/hapi/src/branch/research/ha-job-consumption/docs/research/ha-job-consumption.md

## Answer - **No AMQP/RabbitMQ integration exists in Home Assistant.** HA core has no such component and the docs have no page for it. Its only built-in message-bus client is MQTT. - **HA's MQTT docs explicitly say RabbitMQ's MQTT plugin is not supported:** "Neither ActiveMQ MQTT broker nor the RabbitMQ MQTT Plugin are supported, use a known working broker like Mosquitto instead." HA requires a broker that supports MQTT 5. - **HA's MQTT client always uses a clean session** (`clean_start=True`, from the core source). A broker therefore can't queue jobs for HA while it is offline, whichever broker is used. QoS 1 only covers delivery on a live connection. - **No built-in mechanism acknowledges at the job level.** Durability belongs in hAPI (a Postgres job table with retries and idempotency keys), plus a result path back from HA. - **Mechanisms where HA opens the connection:** - MQTT to a cluster-run Mosquitto, with results via `mqtt.publish` and liveness via `homeassistant/status`. - REST polling of hAPI plus `rest_command` callbacks (30 s polling, clunky YAML). - A custom integration (most flexible, highest upkeep). - **Mechanisms where hAPI calls HA (needs the private link from #46):** - REST API: synchronous, `return_response`, long-lived Bearer token. - WebSocket API: a `result` per command `id`, plus event subscriptions. - Webhook trigger: ID-only auth and an always-200 response, so a poor fit. - **Custom integration distribution changed:** since 2026.11 the built-in Marketplace replaces HACS and only accepts public GitHub repos. A private custom integration hosted on Gitea would have to be installed by hand. **Implication for #55:** if the private link exists, hAPI calling HA's REST or WebSocket API is the simplest bridge (no broker, no HA-side code). If HA must initiate, MQTT to Mosquitto is the supported path. RabbitMQ is only worth it if hAPI wants AMQP for its own reasons. ## Context pointer Branch `research/ha-job-consumption`. Findings (with sources and a comparison table): https://git.bobbypalko.com/bobby/hapi/src/branch/research/ha-job-consumption/docs/research/ha-job-consumption.md
bobby closed this issue 2026-11-23 16:09:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: bobby/hapi#47