mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-04-14 01:17:50 +02:00
328 lines
12 KiB
Markdown
328 lines
12 KiB
Markdown
---
|
|
id: mqtt
|
|
title: MQTT
|
|
---
|
|
|
|
These are the MQTT messages generated by Frigate. The default topic_prefix is `frigate`, but can be changed in the config file.
|
|
|
|
## General Frigate Topics
|
|
|
|
### `frigate/available`
|
|
|
|
Designed to be used as an availability topic with Home Assistant. Possible message are:
|
|
"online": published when Frigate is running (on startup)
|
|
"offline": published after Frigate has stopped
|
|
|
|
### `frigate/restart`
|
|
|
|
Causes Frigate to exit. Docker should be configured to automatically restart the container on exit.
|
|
|
|
### `frigate/events`
|
|
|
|
Message published for each changed tracked object. The first message is published when the tracked object is no longer marked as a false_positive. When Frigate finds a better snapshot of the tracked object or when a zone change occurs, it will publish a message with the same id. When the tracked object ends, a final message is published with `end_time` set.
|
|
|
|
```json
|
|
{
|
|
"type": "update", // new, update, end
|
|
"before": {
|
|
"id": "1607123955.475377-mxklsc",
|
|
"camera": "front_door",
|
|
"frame_time": 1607123961.837752,
|
|
"snapshot_time": 1607123961.837752,
|
|
"label": "person",
|
|
"sub_label": null,
|
|
"top_score": 0.958984375,
|
|
"false_positive": false,
|
|
"start_time": 1607123955.475377,
|
|
"end_time": null,
|
|
"score": 0.7890625,
|
|
"box": [424, 500, 536, 712],
|
|
"area": 23744,
|
|
"ratio": 2.113207,
|
|
"region": [264, 450, 667, 853],
|
|
"current_zones": ["driveway"],
|
|
"entered_zones": ["yard", "driveway"],
|
|
"thumbnail": null,
|
|
"has_snapshot": false,
|
|
"has_clip": false,
|
|
"active": true, // convenience attribute, this is strictly opposite of "stationary"
|
|
"stationary": false, // whether or not the object is considered stationary
|
|
"motionless_count": 0, // number of frames the object has been motionless
|
|
"position_changes": 2, // number of times the object has moved from a stationary position
|
|
"attributes": {
|
|
"face": 0.64
|
|
}, // attributes with top score that have been identified on the object at any point
|
|
"current_attributes": [] // detailed data about the current attributes in this frame
|
|
},
|
|
"after": {
|
|
"id": "1607123955.475377-mxklsc",
|
|
"camera": "front_door",
|
|
"frame_time": 1607123962.082975,
|
|
"snapshot_time": 1607123961.837752,
|
|
"label": "person",
|
|
"sub_label": ["John Smith", 0.79],
|
|
"top_score": 0.958984375,
|
|
"false_positive": false,
|
|
"start_time": 1607123955.475377,
|
|
"end_time": null,
|
|
"score": 0.87890625,
|
|
"box": [432, 496, 544, 854],
|
|
"area": 40096,
|
|
"ratio": 1.251397,
|
|
"region": [218, 440, 693, 915],
|
|
"current_zones": ["yard", "driveway"],
|
|
"entered_zones": ["yard", "driveway"],
|
|
"thumbnail": null,
|
|
"has_snapshot": false,
|
|
"has_clip": false,
|
|
"active": true, // convenience attribute, this is strictly opposite of "stationary"
|
|
"stationary": false, // whether or not the object is considered stationary
|
|
"motionless_count": 0, // number of frames the object has been motionless
|
|
"position_changes": 2, // number of times the object has changed position
|
|
"attributes": {
|
|
"face": 0.86
|
|
}, // attributes with top score that have been identified on the object at any point
|
|
"current_attributes": [
|
|
// detailed data about the current attributes in this frame
|
|
{
|
|
"label": "face",
|
|
"box": [442, 506, 534, 524],
|
|
"score": 0.86
|
|
}
|
|
]
|
|
}
|
|
}
|
|
```
|
|
|
|
### `frigate/reviews`
|
|
|
|
Message published for each changed review item. The first message is published when the `detection` or `alert` is initiated. When additional objects are detected or when a zone change occurs, it will publish a, `update` message with the same id. When the review activity has ended a final `end` message is published.
|
|
|
|
```json
|
|
{
|
|
"type": "update", // new, update, end
|
|
"before": {
|
|
"id": "1718987129.308396-fqk5ka", // review_id
|
|
"camera": "front_cam",
|
|
"start_time": 1718987129.308396,
|
|
"end_time": null,
|
|
"severity": "detection",
|
|
"thumb_path": "/media/frigate/clips/review/thumb-front_cam-1718987129.308396-fqk5ka.webp",
|
|
"data": {
|
|
"detections": [
|
|
// list of event IDs
|
|
"1718987128.947436-g92ztx",
|
|
"1718987148.879516-d7oq7r",
|
|
"1718987126.934663-q5ywpt"
|
|
],
|
|
"objects": ["person", "car"],
|
|
"sub_labels": [],
|
|
"zones": [],
|
|
"audio": []
|
|
}
|
|
},
|
|
"after": {
|
|
"id": "1718987129.308396-fqk5ka",
|
|
"camera": "front_cam",
|
|
"start_time": 1718987129.308396,
|
|
"end_time": null,
|
|
"severity": "alert",
|
|
"thumb_path": "/media/frigate/clips/review/thumb-front_cam-1718987129.308396-fqk5ka.webp",
|
|
"data": {
|
|
"detections": [
|
|
"1718987128.947436-g92ztx",
|
|
"1718987148.879516-d7oq7r",
|
|
"1718987126.934663-q5ywpt"
|
|
],
|
|
"objects": ["person", "car"],
|
|
"sub_labels": ["Bob"],
|
|
"zones": ["front_yard"],
|
|
"audio": []
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### `frigate/stats`
|
|
|
|
Same data available at `/api/stats` published at a configurable interval.
|
|
|
|
### `frigate/camera_activity`
|
|
|
|
Returns data about each camera, its current features, and if it is detecting motion, objects, etc. Can be triggered by publising to `frigate/onConnect`
|
|
|
|
### `frigate/notifications/set`
|
|
|
|
Topic to turn notifications on and off. Expected values are `ON` and `OFF`.
|
|
|
|
### `frigate/notifications/state`
|
|
|
|
Topic with current state of notifications. Published values are `ON` and `OFF`.
|
|
|
|
## Frigate Camera Topics
|
|
|
|
### `frigate/<camera_name>/<object_name>`
|
|
|
|
Publishes the count of objects for the camera for use as a sensor in Home Assistant.
|
|
`all` can be used as the object_name for the count of all objects for the camera.
|
|
|
|
### `frigate/<camera_name>/<object_name>/active`
|
|
|
|
Publishes the count of active objects for the camera for use as a sensor in Home
|
|
Assistant. `all` can be used as the object_name for the count of all active objects
|
|
for the camera.
|
|
|
|
### `frigate/<zone_name>/<object_name>`
|
|
|
|
Publishes the count of objects for the zone for use as a sensor in Home Assistant.
|
|
`all` can be used as the object_name for the count of all objects for the zone.
|
|
|
|
### `frigate/<zone_name>/<object_name>/active`
|
|
|
|
Publishes the count of active objects for the zone for use as a sensor in Home
|
|
Assistant. `all` can be used as the object_name for the count of all objects for the
|
|
zone.
|
|
|
|
### `frigate/<camera_name>/<object_name>/snapshot`
|
|
|
|
Publishes a jpeg encoded frame of the detected object type. When the object is no longer detected, the highest confidence image is published or the original image
|
|
is published again.
|
|
|
|
The height and crop of snapshots can be configured in the config.
|
|
|
|
### `frigate/<camera_name>/audio/<audio_type>`
|
|
|
|
Publishes "ON" when a type of audio is detected and "OFF" when it is not for the camera for use as a sensor in Home Assistant.
|
|
|
|
### `frigate/<camera_name>/audio/dBFS`
|
|
|
|
Publishes the dBFS value for audio detected on this camera.
|
|
|
|
**NOTE:** Requires audio detection to be enabled
|
|
|
|
### `frigate/<camera_name>/audio/rms`
|
|
|
|
Publishes the rms value for audio detected on this camera.
|
|
|
|
**NOTE:** Requires audio detection to be enabled
|
|
|
|
### `frigate/<camera_name>/detect/set`
|
|
|
|
Topic to turn object detection for a camera on and off. Expected values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/detect/state`
|
|
|
|
Topic with current state of object detection for a camera. Published values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/audio/set`
|
|
|
|
Topic to turn audio detection for a camera on and off. Expected values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/audio/state`
|
|
|
|
Topic with current state of audio detection for a camera. Published values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/recordings/set`
|
|
|
|
Topic to turn recordings for a camera on and off. Expected values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/recordings/state`
|
|
|
|
Topic with current state of recordings for a camera. Published values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/snapshots/set`
|
|
|
|
Topic to turn snapshots for a camera on and off. Expected values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/snapshots/state`
|
|
|
|
Topic with current state of snapshots for a camera. Published values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/motion/set`
|
|
|
|
Topic to turn motion detection for a camera on and off. Expected values are `ON` and `OFF`.
|
|
NOTE: Turning off motion detection will fail if detection is not disabled.
|
|
|
|
### `frigate/<camera_name>/motion`
|
|
|
|
Whether camera_name is currently detecting motion. Expected values are `ON` and `OFF`.
|
|
NOTE: After motion is initially detected, `ON` will be set until no motion has
|
|
been detected for `mqtt_off_delay` seconds (30 by default).
|
|
|
|
### `frigate/<camera_name>/motion/state`
|
|
|
|
Topic with current state of motion detection for a camera. Published values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/improve_contrast/set`
|
|
|
|
Topic to turn improve_contrast for a camera on and off. Expected values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/improve_contrast/state`
|
|
|
|
Topic with current state of improve_contrast for a camera. Published values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/motion_threshold/set`
|
|
|
|
Topic to adjust motion threshold for a camera. Expected value is an integer.
|
|
|
|
### `frigate/<camera_name>/motion_threshold/state`
|
|
|
|
Topic with current motion threshold for a camera. Published value is an integer.
|
|
|
|
### `frigate/<camera_name>/motion_contour_area/set`
|
|
|
|
Topic to adjust motion contour area for a camera. Expected value is an integer.
|
|
|
|
### `frigate/<camera_name>/motion_contour_area/state`
|
|
|
|
Topic with current motion contour area for a camera. Published value is an integer.
|
|
|
|
### `frigate/<camera_name>/ptz`
|
|
|
|
Topic to send PTZ commands to camera.
|
|
|
|
| Command | Description |
|
|
| ---------------------- | ----------------------------------------------------------------------------------------- |
|
|
| `preset_<preset_name>` | send command to move to preset with name `<preset_name>` |
|
|
| `MOVE_<dir>` | send command to continuously move in `<dir>`, possible values are [UP, DOWN, LEFT, RIGHT] |
|
|
| `ZOOM_<dir>` | send command to continuously zoom `<dir>`, possible values are [IN, OUT] |
|
|
| `STOP` | send command to stop moving |
|
|
|
|
### `frigate/<camera_name>/ptz_autotracker/set`
|
|
|
|
Topic to turn the PTZ autotracker for a camera on and off. Expected values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/ptz_autotracker/state`
|
|
|
|
Topic with current state of the PTZ autotracker for a camera. Published values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/ptz_autotracker/active`
|
|
|
|
Topic to determine if PTZ autotracker is actively tracking an object. Published values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/birdseye/set`
|
|
|
|
Topic to turn Birdseye for a camera on and off. Expected values are `ON` and `OFF`. Birdseye mode
|
|
must be enabled in the configuration.
|
|
|
|
### `frigate/<camera_name>/birdseye/state`
|
|
|
|
Topic with current state of Birdseye for a camera. Published values are `ON` and `OFF`.
|
|
|
|
### `frigate/<camera_name>/birdseye_mode/set`
|
|
|
|
Topic to set Birdseye mode for a camera. Birdseye offers different modes to customize under which circumstances the camera is shown.
|
|
|
|
_Note: Changing the value from `CONTINUOUS` -> `MOTION | OBJECTS` will take up to 30 seconds for
|
|
the camera to be removed from the view._
|
|
|
|
| Command | Description |
|
|
| ------------ | ----------------------------------------------------------------- |
|
|
| `CONTINUOUS` | Always included |
|
|
| `MOTION` | Show when detected motion within the last 30 seconds are included |
|
|
| `OBJECTS` | Shown if an active object tracked within the last 30 seconds |
|
|
|
|
### `frigate/<camera_name>/birdseye_mode/state`
|
|
|
|
Topic with current state of the Birdseye mode for a camera. Published values are `CONTINUOUS`, `MOTION`, `OBJECTS`.
|