---
title: "Get person alert from camera with Boss Detector"
description: "Raspberry Pi person detection with Frigate NVR: a Sixfab AI HAT+ (DEEPX DX-M1M) on a Raspberry Pi 5 runs YOLOv8n, and a Python listener acts on person events."
url: "https://docs.sixfab.com/projects/ai-hat-plus/get-person-alert-camera-boss-detector/"
last_updated: "2026-10-12"
---

# 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+](https://docs.sixfab.com/edge-ai/ai-hat-plus/) on Raspberry Pi 5

![Two terminals on the Raspberry Pi 5: the listener log with two BOSS DETECTED lines for camera cam1 at score 0.90, about 5 seconds apart, and mosquitto_sub showing the matching boss_detector/alert JSON messages](https://docs.sixfab.com/wp-content/uploads/2026/10/06-boss-detector-listener-log-and-mqtt-alerts.png)

## 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`](https://docs.sixfab.com/projects/ai-hat-plus/get-person-alert-camera-boss-detector/#the-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](https://docs.sixfab.com/edge-ai/ai-hat-plus/quickstart/), then [Frigate NVR on Raspberry Pi 5 with the DEEPX NPU](https://docs.sixfab.com/projects/ai-hat-plus/set-up-frigate-nvr-ai-hat-plus/), then [Camera feeds and MQTT](https://docs.sixfab.com/projects/ai-hat-plus/connect-camera-feeds-mqtt-frigate/) 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](https://docs.sixfab.com/edge-ai/ai-hat-plus/quickstart/). [Shop](https://shop.sixfab.com/products/ai-hat-plus-raspberry-pi-5?utm_source=docs.sixfab.com&utm_medium=referral&utm_campaign=ai-projects&utm_content=boss-detector-frigate-person-detection-mqtt)
- **RTSP camera**: Any RTSP camera or stream.

**Software**

- **Frigate NVR with the DEEPX detector**: Set up first: [Frigate NVR on Raspberry Pi 5 with the DEEPX NPU](https://docs.sixfab.com/projects/ai-hat-plus/set-up-frigate-nvr-ai-hat-plus/).
- **MQTT broker**: On your network, accepting connections on port 1883 without a user name, password or TLS, for example [Mosquitto](https://mosquitto.org/).
- **Tools**: `git`, `curl`, `sha256sum` and `python3`.

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.

> [!NOTE]
> **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](https://github.com/blakeblackshear/frigate/blob/dev/docs/docs/configuration/object_detectors.md)). 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.

**Install script**

Run on the Raspberry Pi 5 as your normal user:

```bash
git clone https://github.com/sixfab/sixfab-dx-frigate.git
cd sixfab-dx-frigate/apps/boss-detector
./install.sh --rtsp-url [RTSP_URL] --broker [BROKER_HOST]
```

- `--rtsp-url`: the RTSP address of your camera.
- `--broker`: the host of your MQTT broker.
- `--yes`: restart the Frigate container without asking.

The installer asks for any value you leave out. It downloads the model from the project’s GitHub release and checks its SHA-256, copies it, merges the model and one camera into your Frigate `config.yaml` (after saving a backup), installs the listener as a user service in `~/sixfab-apps/boss-detector` and offers to restart Frigate. It does not run `enable-linger`; it prints the command, which is step 6 of the manual install.

**Manual install**

1. **Clone repository and open project folder**

   ```bash
   git clone https://github.com/sixfab/sixfab-dx-frigate.git [REPO_DIR]
   cd [REPO_DIR]/apps/boss-detector
   ```

2. **Download model and check it**

   ```bash
   curl -fL -o model/yolov8n-ppu-coco80.dxnn https://github.com/sixfab/sixfab-dx-frigate/releases/download/boss-detector-v1.0.0/yolov8n-ppu-coco80.dxnn
   ```

   ```bash
   awk '$1 !~ /^#/ && NF {print $3 "  " $2}' models.txt | sha256sum -c -
   ```

   ```text
   model/yolov8n-ppu-coco80.dxnn: OK
   ```

   `OK` means the file matches its SHA-256 in `models.txt`.

3. **Copy model into Frigate’s model cache**

   ```bash
   mkdir -p [FRIGATE_CONFIG_DIR]/model_cache
   cp model/yolov8n-ppu-coco80.dxnn [FRIGATE_CONFIG_DIR]/model_cache/
   ```

4. **Add model and camera to `[FRIGATE_CONFIG_DIR]/config.yaml`**

   Keep a backup of the file first. Merge the entries into your existing `models` list and `cameras` section; do not replace your own cameras. Use your own camera name and `[RTSP_URL]`.

   ```yaml
   models:
     - scene: indoor_thermal
       model_type: yolo-generic
       width: 640
       height: 640
       path: /config/model_cache/yolov8n-ppu-coco80.dxnn
       labelmap_path: /labelmap/coco-80.txt
       devices:
         - deepx:PCIe:0

   cameras:
     cam1:
       ffmpeg:
         inputs:
           - path: [RTSP_URL]
             roles:
               - detect
       detect:
         enabled: true
         width: 1280
         height: 720
         scene: indoor_thermal
       objects:
         track:
           - person
         filters:
           person:
             min_score: 0.6
             threshold: 0.7
       record:
         enabled: false
   ```

   `scene: indoor_thermal` is only an unused slot in Frigate’s fixed scene list that ties the camera to this model; no thermal camera is involved. If another model on your instance already uses `indoor_thermal`, choose another unused scene value.

5. **Install listener in its own Python virtual environment**

   ```bash
   mkdir -p ~/sixfab-apps/boss-detector
   cp automation/notify.py ~/sixfab-apps/boss-detector/notify.py
   cd ~/sixfab-apps/boss-detector
   python3 -m venv venv
   ./venv/bin/pip install "paho-mqtt<2"
   ```

   Set `BROKER` in `~/sixfab-apps/boss-detector/notify.py` to `[BROKER_HOST]`.

6. **Create user service and start it**

   Create `~/.config/systemd/user/boss-detector-automation.service`:

   ```text filename="boss-detector-automation.service"
   [Unit]
   Description=Boss Detector - Frigate MQTT person-detection trigger listener
   After=network-online.target
   Wants=network-online.target

   [Service]
   Type=simple
   WorkingDirectory=%h/sixfab-apps/boss-detector
   ExecStart=%h/sixfab-apps/boss-detector/venv/bin/python %h/sixfab-apps/boss-detector/notify.py
   Restart=on-failure
   RestartSec=5

   [Install]
   WantedBy=default.target
   ```

   ```bash
   systemctl --user daemon-reload
   systemctl --user enable --now boss-detector-automation.service
   ```

   To start the service after a reboot without logging in, run this once; it asks for your password:

   ```bash
   sudo loginctl enable-linger $USER
   ```

7. **Restart Frigate so it loads new model and camera**

   ```bash
   docker restart frigate
   ```

## Verify

1. **Watch alerts listener publishes**

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

   ```bash
   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):

   ```text
   boss_detector/alert {"camera": "cam1", "score": 0.9, "timestamp": 1791267504.950264}
   ```

2. **Check Frigate and detector**

   Run the API check inside the container:

   ```bash
   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**

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

[Frigate documents port 5000](https://docs.frigate.video/configuration/authentication/) 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](https://docs.ultralytics.com/models/yolov8/) 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.

```python filename="notify.py"
"""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](https://docs.frigate.video/integrations/home-assistant/)).

> [!WARNING]
> **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](https://docs.frigate.video/integrations/mqtt/); [Camera feeds and MQTT](https://docs.sixfab.com/projects/ai-hat-plus/connect-camera-feeds-mqtt-frigate/) lists the message fields each project listener reads.

| Topic | What Frigate sends | Fit for a per-person action |
| --- | --- | --- |
| `frigate/events` | One message per changed tracked object, typed `new`, `update` or `end` | Per tracked person |
| `frigate/reviews` | One message per changed review item, with `alert` or `detection` severity | Per review item, which can hold several objects |
| `frigate/<camera-name>/person` | The count of people on that camera | A 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`](https://docs.sixfab.com/edge-ai/ai-model-deployment/system-monitoring/).
- 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](https://docs.sixfab.com/projects/ai-hat-plus/set-up-frigate-nvr-ai-hat-plus/#troubleshooting).

### The listener service is not active

Read the last 30 log lines:

```bash
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.

### No alerts on `boss_detector/alert` when someone walks into view

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`](https://docs.sixfab.com/projects/ai-hat-plus/get-person-alert-camera-boss-detector/#the-listener-notify-py).

### The log shows only `Person detected again but still in cooldown`

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

### Repeated alerts for the same person

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

- [Porch Pirate](https://docs.sixfab.com/projects/ai-hat-plus/catch-package-theft-porch-pirate/): Zone and sequence logic: Frigate package detection.
- [Face recognition](https://docs.sixfab.com/projects/ai-hat-plus/add-face-recognition-frigate-camera/): Recognize who is there with Frigate.
- [Squirrel detector](https://docs.sixfab.com/projects/ai-hat-plus/build-squirrel-detector-sprinkler-trigger/): Another MQTT listener, for squirrels.
- [Sixfab Model Zoo](https://docs.sixfab.com/edge-ai/ai-model-deployment/sixfab-model-zoo/): Pre-compiled .dxnn models for the NPU.
- [Choose project](https://docs.sixfab.com/projects/ai-hat-plus/choose-ai-hat-plus-project/): All projects with the DEEPX NPU.

## 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.
