concept

Message Brokers

What a message broker is, how the publish and subscribe pattern works, and why it is the glue that connects services in a self hosted home lab.

A message broker is a service that sits between applications and passes messages between them. Instead of two applications talking to each other directly, each one talks to the broker. One publishes a message. The other subscribes to receive it. The broker handles the delivery.

This pattern is called publish and subscribe, or pub/sub. It sounds abstract but the practical effect is significant: services do not need to know about each other. They only need to know about the broker. That makes a system much easier to extend, because adding a new service that reacts to an existing event requires no changes to the service that produces it.

Why this matters in a home lab

A home lab is often a collection of services that were never designed to work together. Connecting them directly, having Frigate call Home Assistant's API every time it detects something, creates tight dependencies that break when either side updates or changes.

A message broker decouples them. Frigate publishes a detection event to a topic on the broker the moment it identifies something. Home Assistant subscribes to that topic and reacts. Frigate does not know or care that Home Assistant exists. Home Assistant does not need to poll Frigate. The broker is the only shared dependency, and it is a simple one.

A real example

In my camera setup, Frigate detects a person entering the driveway and publishes an event to an MQTT topic. Home Assistant receives it within milliseconds and sends a push notification with a snapshot to my phone. The whole chain runs locally. Nothing leaves the network. Adding a new automation, turning on exterior lights when the same event fires for example, means adding a new subscriber to the same topic. Frigate does not change at all.

MQTT is the messaging protocol that makes this work in most self hosted home automation setups. It is lightweight, well supported, and the standard choice for connecting services like Frigate and Home Assistant.