Get person alert from camera with Boss Detector

Detect people with Frigate and a YOLOv8n model on the Sixfab AI HAT+, and run a Python action on each person event; the sample action publishes a JSON alert over MQTT.

Works with

AI HAT+Product overviewonRaspberry Pi 5

How it works

A camera streams video to Frigate, Frigate finds people with a ready-compiled model on the DEEPX NPU, and a Python listener acts on Frigate’s MQTT messages. The NPU runs only the YOLOv8n object detection model and its post-processing; Frigate’s decoding, motion detection and tracking, and the listener run on the Raspberry Pi 5 CPU. Frigate and the listener are separate programs that talk only through MQTT; no Home Assistant is involved.

  1. The camera streams video over RTSP.
  2. Frigate’s DEEPX detector runs yolov8n-ppu-coco80.dxnn on the NPU. Person is class 0 in COCO-80.
  3. Frigate publishes tracked-object messages on the frigate/events MQTT topic.
  4. notify.py, a Python listener that runs as a user-level systemd service, calls trigger_alert() for each person message that passes its score and cooldown rules: see Listener, notify.py.
  5. trigger_alert() publishes a JSON alert to boss_detector/alert and writes a BOSS DETECTED log line.

Read the alerts on the boss_detector/alert topic: each one carries the camera name, the score and a Unix timestamp. The listener’s log holds the matching BOSS DETECTED line, and Frigate’s web interface at https://[PI_IP]:8971 draws the person box.

Requirements

Set things up in this order: the AI HAT+ quickstart, then Frigate NVR on Raspberry Pi 5 with the DEEPX NPU, then Camera feeds and MQTT for the camera and the broker. The Frigate setup page holds the full docker run command for Frigate; this page changes only the camera and model config and restarts Frigate.

Required

Hardware

  • Raspberry Pi 5
  • Sixfab AI HAT+ (DEEPX DX-M1M)Set up as in the AI HAT+ quickstart.Shop
  • RTSP cameraAny RTSP camera or stream.

Software

The project brings the model file yolov8n-ppu-coco80.dxnn (downloaded from the project’s GitHub release into its model folder), the listener notify.py, the service file boss-detector-automation.service and the Python package paho-mqtt v1.x.

DEEPX support is not in a stable Frigate release

DEEPX support was merged into Frigate’s dev branch on September 21, 2026 (PR #24336) and is not in a stable release yet; the latest stable release is v0.18.0 (September 12, 2026). Sixfab develops and maintains it (Frigate’s DEEPX NPU detector docs). The image ghcr.io/blakeblackshear/frigate:af0ba19-standard-arm64, published on GitHub Container Registry, is built from commit af0ba19 of the dev branch; the Frigate setup page pulls it.

Install

Both methods put the model in Frigate’s model cache, merge the model and one camera into your Frigate config.yaml, install the listener as a user service in ~/sixfab-apps/boss-detector and restart Frigate.

Verify

  1. Watch alerts listener publishes

    Run this on any computer that can reach the broker, then walk into the camera view:

    mosquitto_sub -h [BROKER_HOST] -t boss_detector/alert -v

    One line arrives each time a person is detected, at most one per camera every 5 seconds (example values):

    boss_detector/alert {"camera": "cam1", "score": 0.9, "timestamp": 1791267504.950264}
  2. Check Frigate and detector

    Run the API check inside the container:

    docker exec frigate curl -s http://localhost:5000/api/stats

    The output is JSON with detector and camera statistics.

  3. Confirm person box in Frigate UI

    Open https://[PI_IP]:8971, walk into the camera view and check that Frigate draws a person box on your camera.

  4. Optional: watch topic listener reads

    mosquitto_sub -h [BROKER_HOST] -t 'frigate/events' -v

Frigate documents port 5000 as internal, unauthenticated access and treats every request there as admin-level. Run API checks through docker exec, and browse to port 8971 only.

Details

Model

The model is YOLOv8n with a 640 × 640 input and the Frigate model type yolo-generic. Its post-processing, which decodes the boxes and removes duplicates with non-maximum suppression (NMS), runs on the NPU’s Post-Processing Unit (PPU). The model is already compiled into a .dxnn file, DEEPX’s model format, and Frigate’s built-in label map /labelmap/coco-80.txt names class 0 person, so you train nothing. See the YOLOv8 documentation for the model family.

Listener, notify.py

The listener subscribes to frigate/events, parses each JSON message and keeps only person objects whose message type is new or update. It reads the score from top_score when the message has one, and from score otherwise, and skips scores below 0.6. It then calls trigger_alert() at most once every 5 seconds for each camera; the first sighting always fires at once.

A new message comes only once, when Frigate confirms a track, so the listener also acts on update messages, which Frigate sends as the person moves; the cooldown limits the repeats. Frigate’s tracker confirms a new object after min_initialized frames, which defaults to half the detect fps: 2 frames at 5 fps.

The frigate topic prefix is written into the code, so keep Frigate’s topic_prefix at its default. Set BROKER to your MQTT broker address; the listener connects without a user name or password.

"""Boss Detector - frigate/events listener.

Listens for Frigate person events on MQTT and calls trigger_alert().
Replace the action in trigger_alert() with your own; for now it logs the alert and publishes it to MQTT.
"""

import json
import logging
import time

import paho.mqtt.client as mqtt

BROKER = "[BROKER_HOST]"  # replace with your MQTT broker address
PORT = 1883
EVENTS_TOPIC = "frigate/events"
ALERT_TOPIC = "boss_detector/alert"  # this script publishes here on every alert
TARGET_LABEL = "person"
MIN_SCORE = 0.6
COOLDOWN_SECONDS = 5  # prevents spam - always fires on first sighting

logging.basicConfig(level=logging.INFO, format="%(asctime)s %(message)s")
log = logging.getLogger("boss-detector")

_last_triggered: dict[str, float] = {}


def trigger_alert(client: mqtt.Client, camera: str, score: float) -> None:
    """Log the alert and publish it to ALERT_TOPIC as JSON.

    Put your real action here.
    Examples: requests.post(webhook_url, json=...), play a sound
    (playsound), trigger a smart plug/light, print "BOSS INCOMING" on a
    receipt printer, publish to Home Assistant via MQTT."""
    log.warning("BOSS DETECTED camera=%s score=%.2f (simulated for now)", camera, score)
    client.publish(
        ALERT_TOPIC,
        json.dumps({"camera": camera, "score": round(score, 2), "timestamp": time.time()}),
        qos=1,
    )


def on_connect(client: mqtt.Client, userdata, flags, rc):
    if rc != 0:
        log.error("MQTT connection error, rc=%s", rc)
        return
    log.info("Connected to broker (%s:%s), listening on %s", BROKER, PORT, EVENTS_TOPIC)
    client.subscribe(EVENTS_TOPIC)


def on_message(client: mqtt.Client, userdata, msg: mqtt.MQTTMessage):
    try:
        payload = json.loads(msg.payload.decode())
    except (json.JSONDecodeError, UnicodeDecodeError):
        log.warning("Malformed payload, skipping")
        return

    after = payload.get("after") or {}
    event_type = payload.get("type")
    label = after.get("label")

    if label != TARGET_LABEL:
        return

    # Both "new" AND "update" trigger - notified as soon as the person is
    # seen (first "new" event, published ~0.4s in) and again as they move
    # (each "update"). Only cooldown prevents spam, not the event type.
    if event_type not in ("new", "update"):
        return

    camera = after.get("camera")
    score = after.get("top_score") or after.get("score") or 0.0
    if score < MIN_SCORE:
        log.debug("Score below threshold (%.2f < %.2f), skipping", score, MIN_SCORE)
        return

    now = time.monotonic()
    last = _last_triggered.get(camera, 0.0)
    if now - last < COOLDOWN_SECONDS:
        log.info(
            "Person detected again but still in cooldown (%.0fs left), skipping",
            COOLDOWN_SECONDS - (now - last),
        )
        return

    _last_triggered[camera] = now
    trigger_alert(client, camera, score)


def main() -> None:
    client = mqtt.Client()
    client.on_connect = on_connect
    client.on_message = on_message
    client.connect(BROKER, PORT, keepalive=60)
    client.loop_forever()


if __name__ == "__main__":
    main()

The log line says “(simulated for now)” because no physical output is connected. Replace the placeholder in trigger_alert() with a sound, a light, a receipt printer or a Home Assistant webhook (see Frigate’s Home Assistant integration).

Never switch mains power from GPIO

Drive the action with low-voltage devices or a certified smart plug.

Frigate MQTT topics

frigate/events carries one message per changed tracked object, which suits a per-person action. The table compares it with two other topics from Frigate’s MQTT topic reference; Camera feeds and MQTT lists the message fields each project listener reads.

TopicWhat Frigate sendsFit for a per-person action
frigate/eventsOne message per changed tracked object, typed new, update or endPer tracked person
frigate/reviewsOne message per changed review item, with alert or detection severityPer review item, which can hold several objects
frigate/<camera-name>/personThe count of people on that cameraA count, not an event; suits sensors

Limitations

Tested on a Raspberry Pi 5 (8 GB) with the Sixfab AI HAT+ (DEEPX DX-M1M), Raspberry Pi OS Trixie 64-bit, RT driver v2.6.0, PCIe driver v2.5.0, DX-RT v3.4.2 on the Raspberry Pi 5 and v3.4.0 in Frigate’s DEEPX detector, firmware v2.7.4, ghcr.io/blakeblackshear/frigate:af0ba19-standard-arm64 and a live IP camera over RTSP; last tested October 5, 2026.

  • Speed is not measured: there are no figures for inference time, detection frame rate, NPU or CPU load, person-to-log latency, missed people or false alerts. To measure your setup, read the detector figures from the /api/stats output in Verify, and check NPU load with dxtop.
  • The listener cannot tell who a person is, so it cannot tell your boss from anyone else. It was tested with a porch camera stream, not a desk camera.
  • The listener acts on events from every camera on the broker; it does not filter by camera name.
  • The listener de-duplicates only by time, one trigger per camera every 5 seconds. It does not track event IDs, so a person who stays in view longer than 5 seconds triggers again, and a person who leaves and returns triggers after the cooldown.
  • The listener connects to the broker on port 1883 without credentials or TLS, so it works only with a broker that allows that.
  • Tested with Frigate in Docker. Home Assistant OS and the Frigate add-on were not tested.
  • Port 5000 has no authentication. Frigate runs with host networking, so the port is on the Raspberry Pi 5’s network with no Docker -p flag to leave it unpublished; firewall it.
  • Frigate chooses the DX-RT version its DEEPX detector uses. The tested build pins DX-RT v3.4.0, and this project cannot change it.
  • If the DX-RT daemon (the DEEPX runtime) restarts, restart the Frigate container too.

Privacy

A camera that watches people records personal data. Point it at your own space and tell people it is there.

  • Recording at work can be regulated. Check your local rules; this project makes no compliance claim.
  • Keep the “boss” idea light. Do not use it to watch coworkers in secret.
  • The camera block sets record: enabled: false, so this camera does not record video. Check your own record and snapshot settings, globally and per camera: recordings and snapshots can store images of people.
  • Frigate downloads the DX-RT Python bindings at first start, and again when a release pins a new version, so the first start needs internet access.
  • The listener talks only to your MQTT broker, normally on your local network. It publishes the camera name, a score and a timestamp to boss_detector/alert, so anyone who can read that broker can see when a person appeared.

Troubleshooting

Check the listener service first, then the alert topic, then the cooldown. For Frigate and detector problems, see Troubleshooting on the Frigate setup page.

Read the last 30 log lines:

systemctl --user status boss-detector-automation.service --no-pager -n 30

A healthy service is active (running) and its log shows Connected to broker (...), listening on frigate/events at startup. If the log shows MQTT connection error, check BROKER and PORT in notify.py, and that the broker is reachable from the Raspberry Pi 5.

Check in this order: the person box in the Frigate UI, the detector section of /api/stats, and the raw messages on frigate/events with mosquitto_sub. The listener also skips person messages by its score and cooldown rules: see Listener, notify.py.

The listener received the person and the 5-second cooldown suppressed the alert. This is expected while a person stays in view.

Raise COOLDOWN_SECONDS in notify.py (default 5). The listener allows one trigger per camera in each cooldown window and does not track Frigate’s event IDs, so a person who stays in view past the window triggers again.

Next steps

License and credits

The code is licensed under the MIT License. Each model file has its own license, listed with the model details in the release notes at https://github.com/sixfab/sixfab-dx-frigate/releases/tag/boss-detector-v1.0.0; YOLOv8n is AGPL-3.0.

Credits: YOLOv8n by Ultralytics, and Frigate NVR.