Home Assistant MQTT Monitoring: Detect Broker Outages and Auto-Open Repairs

Monitor your MQTT broker from Home Assistant, auto-open a Repairs issue on outages, and trigger Joanna troubleshooting so you catch failures fast.

Home Assistant MQTT monitoring hero image

MQTT is the glue in a lot of smart homes. When the broker goes down, everything looks broken: sensors stop updating, automations don’t fire, and you burn time debugging the wrong thing.

This post tracks the small reliability win I added to my config: a simple TCP health probe (port 1883), a Spook Repairs issue when it’s down, and an automatic “go troubleshoot” dispatch to Joanna. GitHub: Issue #1081 and PR #1590.

The problem

Home Assistant can be perfectly healthy while MQTT is not. When that happens, the symptoms are noisy and misleading.

I like local MQTT because it removes cloud dependencies, but it also means the broker becomes a single point of failure. If I’m going to lean on it, I want a first-class “broker is down” signal.

The fix

  • Probe the broker port from Home Assistant using a lightweight command-line TCP check.
  • Normalize it into a problem sensor so I can trigger automations cleanly.
  • Open a Spook Repairs issue after a short debounce window (avoid flapping).
  • Clear the repair automatically once the broker is stable again.
  • Dispatch Joanna through BearClaw so troubleshooting starts immediately.

Result

If MQTT blips, I get a durable UI-visible Repair issue (not just a push notification I might miss), plus an automated troubleshooting handoff. When the broker recovers, the Repair clears itself.

Home Assistant fill

The full package YAML lives here: config/packages/mqtt_status.yaml.

command_line:
  - binary_sensor:
      name: MQTT Status Raw
      command: >-
        /bin/bash -c "(echo > /dev/tcp/<MQTT_BROKER_IP>/1883) > /dev/null 2>&1 && echo open || echo closed"
      payload_on: "open"
      payload_off: "closed"

Draft generated with help from Codex

TAGS