Compare commits

...
Author SHA1 Message Date
Josh Hawkins 140680215b don't strip the fallback detect size when cloning 2026-11-28 18:30:43 -06:00
Josh Hawkins 63807d753c track where each camera's detect resolution came from
The health tab's stream check told users to set the detect resolution whenever a probe returned no size, even when they had already set it, and a camera running on the 1280x720 fallback after a failed startup probe was never flagged unless the stream check was run by hand. The config now records whether the resolution came from the config, a startup probe, or the fallback, and /api/config exposes it per camera. The stream check skips the probe warning when the resolution is set, a camera on the fallback gets a detect settings warning that also shows on the health tab, and cloning detect from a fallback camera no longer copies the fallback size.
2026-11-28 18:20:38 -06:00
Josh Hawkins bd90051a15 add note about explicit detect resolution 2026-11-28 15:54:44 -06:00
Josh Hawkins fc3ace56c6 stop at startup when the database location isn't writable
The ownership sweep only covers /config and /media/frigate, so a database.path on another volume stayed root-owned after upgrading and Frigate boot-looped on a SQLite error. Frigate now checks the database directory and files before opening them and exits with an error naming the path, the runtime uid/gid, and the new docs section. backup.db is checked only when a migration is about to write it.
2026-11-28 13:24:02 -06:00
Josh Hawkins 48d15f44cd disable relative movement when the camera doesn't report its position 2026-11-28 07:00:20 -06:00
Josh Hawkins c05f76c859 don't seed relative move translation from a status without position 2026-11-28 06:53:29 -06:00
Josh Hawkins 19a212dfb1 re-sweep a replaced media volume despite the ownership sentinel
The boot sweep skipped whenever the sentinel in /config matched, so wiping or swapping /media/frigate while keeping the config volume left the new root-owned folder unswept and Frigate failed to create /media/frigate/recordings. The sentinel is now honored only when each volume root is still owned by the runtime user. Filesystems that accept chown without applying it (CIFS without setuids) get an unmanaged sentinel after a clean sweep so they don't re-sweep on every boot.
2026-11-27 07:09:53 -06:00
Josh Hawkins 8c773c2e2e encode notice ids in notice action urls
Notice ids went into the URL raw, so a detector on a repeated device like openvino:GPU#2 had everything after the # dropped as a fragment. The acknowledge, mute, and unhide requests 404'd and the buttons did nothing. The hooks now encode the id.
2026-11-26 06:56:17 -06:00
22 changed files with 377 additions and 72 deletions
+12
View File
@@ -314,6 +314,18 @@ jobs:
sleep 2
done
if [ "$ok" -ne 1 ]; then echo "sentinel skip never logged"; docker logs frigate-puid; exit 1; fi
# a replaced media volume re-sweeps despite the sentinel
docker stop frigate-puid
sudo rm -rf /tmp/frigate-media-puid
sudo mkdir /tmp/frigate-media-puid
docker start frigate-puid
up=0
for i in $(seq 1 60); do
docker exec frigate-puid curl -fs http://127.0.0.1:5000/api/version && up=1 && break
sleep 5
done
if [ "$up" -ne 1 ]; then echo "replaced media volume was not swept"; docker logs frigate-puid; exit 1; fi
docker exec frigate-puid stat -c %u:%g /media/frigate | grep -qx 1500:1500
docker rm -f frigate-puid
- name: Assert read-only rootfs with --user works
run: |
+25 -10
View File
@@ -70,16 +70,6 @@ if [[ -n "$mode" ]]; then
sentinel_content="${sentinel_content}:${mode}"
fi
# safe-sentinel reports only a root-owned regular file, so a forged or
# symlinked sentinel in the runtime-user-owned /config can't suppress the sweep
if [[ "$dry_run" -eq 0 && -n "$sentinel" ]]; then
if existing=$(/usr/local/bin/safe-sentinel read "$sentinel" 2>/dev/null) && \
[[ "$existing" == "$sentinel_content" ]]; then
echo "[INFO] fix-ownership: ${target_uid}:${target_gid} (schema ${schema}) already applied, skipping"
exit 0
fi
fi
# A sweep that could not chown everything must not be recorded as complete:
# the sentinel would make every later boot skip it and the entries would stay
# unreachable once services run unprivileged.
@@ -102,6 +92,24 @@ mismatch_expr=(
-a ! -path /config/.permissions_version
)
first_mismatched_root() {
find "$@" -maxdepth 0 "${mismatch_expr[@]}" -print -quit 2>/dev/null || true
}
# safe-sentinel reports only a root-owned regular file, so a forged or
# symlinked sentinel in the runtime-user-owned /config can't suppress the sweep.
# A mismatched volume root means the volume was replaced or wiped since the
# sweep (Docker recreates a missing bind source as root), so it sweeps again,
# unless the sentinel records a filesystem that ignores chown.
if [[ "$dry_run" -eq 0 && -n "$sentinel" ]]; then
if existing=$(/usr/local/bin/safe-sentinel read "$sentinel" 2>/dev/null) && \
{ [[ "$existing" == "${sentinel_content}:unmanaged" ]] || \
{ [[ "$existing" == "$sentinel_content" ]] && [[ -z "$(first_mismatched_root "$@")" ]]; }; }; then
echo "[INFO] fix-ownership: ${target_uid}:${target_gid} (schema ${schema}) already applied, skipping"
exit 0
fi
fi
exec 3>&1
for path in "$@"; do
@@ -199,6 +207,13 @@ if [[ "$dry_run" -eq 0 && -d /config ]]; then
fi
if [[ "$dry_run" -eq 0 && -n "$sentinel" && "$swept_clean" -eq 1 ]]; then
# CIFS without the setuids option accepts chown and changes nothing, so
# the root can never match. Without this every boot would sweep again.
unmanaged_root=$(first_mismatched_root "$@")
if [[ -n "$unmanaged_root" ]]; then
echo "[WARN] fix-ownership: ${unmanaged_root} kept its owner after chown; its filesystem ignores ownership changes, so set the owner through its mount options"
sentinel_content="${sentinel_content}:unmanaged"
fi
/usr/local/bin/safe-sentinel write "$sentinel" "$sentinel_content" || \
echo "[WARN] fix-ownership: could not write ${sentinel}; the sweep will run again on next boot"
fi
+3 -1
View File
@@ -84,7 +84,7 @@ A camera is enabled by default but can be disabled by using `enabled: False`. Ca
Each role can only be assigned to one input per camera. The options for roles are as follows:
| Role | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------ |
| ------------ | --------------------------------------------------------------------------------------------------------------- |
| `detect` | Main feed for object detection. [docs](object_detectors.md) |
| `record` | Saves segments of the video feed based on configuration settings. [docs](record.md) |
| `record_sub` | Saves segments of a second, lower quality stream with its own retention. [docs](record.md#sub-stream-recording) |
@@ -160,6 +160,8 @@ If you only define one stream in your `inputs` and do not assign a `detect` role
If you plan to use Frigate for recording only, it is still recommended to define a `detect` role for a low resolution stream to minimize resource usage from the required stream decoding.
Setting the `detect` `width` and `height` explicitly is recommended. When they are unset, Frigate probes the detect stream at every startup, which can add several seconds per camera. Cameras added with the [Add Camera Wizard](#adding-a-camera-with-the-add-camera-wizard) have them set automatically.
:::
For camera model specific settings check the [camera specific](camera_specific.md) infos.
+11 -1
View File
@@ -86,6 +86,16 @@ Once the volumes are aligned, start Frigate normally. A file at `/config/.permis
If something under your volumes can't be chowned, a read-only btrfs snapshot directory for example, the sweep warns and names the path and doesn't record the migration as finished. It retries on the next boot instead. Either move those paths outside `/media/frigate` or expect the scan to repeat.
### Custom database location
The sweep only covers `/config` and `/media/frigate`. If `database.path` points somewhere else, such as a separate volume, align that directory yourself before upgrading, and again after running with `FRIGATE_RUN_AS_ROOT=true`:
```bash
chown -R 1000:1000 /path/to/your/database/dir
```
Use your `PUID` and `PGID` if you've changed them. Until the directory and its files are writable, Frigate stops at startup with an error naming the path it can't write.
### Network storage
Recordings on a NAS behave differently, so check what you have before migrating:
@@ -94,7 +104,7 @@ Recordings on a NAS behave differently, so check what you have before migrating:
findmnt -T /path/to/your/storage -o TARGET,FSTYPE,OPTIONS
```
**SMB and CIFS** don't store per-file ownership at all. It's synthesized from the mount options, so a per-file `chown` fails and isn't needed. Mount the share as the uid and gid Frigate runs as, and every file already looks correct to the sweep:
**SMB and CIFS** don't store per-file ownership at all. It's synthesized from the mount options, so a per-file `chown` has no effect and isn't needed. Mount the share as the uid and gid Frigate runs as, and every file already looks correct to the sweep:
```
//nas/frigate /media/frigate cifs credentials=/root/.smb,uid=1000,gid=1000,file_mode=0664,dir_mode=0775 0 0
+2
View File
@@ -336,6 +336,8 @@ def config(request: Request):
for cmd in camera_dict["ffmpeg_cmds"]:
cmd["cmd"] = clean_camera_user_pass(" ".join(cmd["cmd"]))
camera_dict["detect_resolution_source"] = camera.detect_resolution_source
# masking misses vendor-specific credentials in paths and args, and the
# non-admin UI never reads them
if not is_admin:
+30 -12
View File
@@ -4,6 +4,7 @@ import multiprocessing as mp
import os
import secrets
import shutil
import sys
from collections.abc import Callable
from multiprocessing import Queue
from multiprocessing.managers import DictProxy, SyncManager
@@ -91,7 +92,7 @@ from frigate.timeline import TimelineProcessor
from frigate.track.object_processing import TrackedObjectProcessor
from frigate.util.builtin import empty_and_close_queue
from frigate.util.image import UntrackedSharedMemory
from frigate.util.ownership import chown_to_runtime
from frigate.util.ownership import chown_to_runtime, find_unwritable_database_path
from frigate.util.process import FrigateProcess
from frigate.util.runtime_deps import RuntimeDependencyError
from frigate.util.services import set_file_limit
@@ -197,8 +198,32 @@ class FrigateApp:
except PermissionError:
logger.error("Unable to write to /config to save DB state")
def exit_if_unwritable(paths: tuple[str, ...]) -> None:
unwritable = find_unwritable_database_path(paths)
if unwritable is None:
return
logger.error(
"Frigate is running as uid %s, gid %s and can't write to %s. Make "
"sure it exists and is owned by that user, see "
"https://docs.frigate.video/configuration/non_root#custom-database-location",
os.getuid(),
os.getgid(),
unwritable,
)
sys.exit(1)
db_path = self.config.database.path
backup_path = db_path.replace("frigate.db", "backup.db")
db_files = (db_path, f"{db_path}-wal", f"{db_path}-shm", backup_path)
# the ownership sweep covers /config and /media/frigate only, so a
# database kept elsewhere can still be owned by root after upgrading
exit_if_unwritable(db_files[:3])
# Migrate DB schema
migrate_db = SqliteDatabase(self.config.database.path)
migrate_db = SqliteDatabase(db_path)
# Run migrations
del logging.getLogger("peewee_migrate").handlers[:]
@@ -206,10 +231,8 @@ class FrigateApp:
if len(router.diff) > 0:
logger.info("Making backup of DB before migrations...")
shutil.copyfile(
self.config.database.path,
self.config.database.path.replace("frigate.db", "backup.db"),
)
exit_if_unwritable((backup_path,))
shutil.copyfile(db_path, backup_path)
router.run()
@@ -235,12 +258,7 @@ class FrigateApp:
# a root frigate service creates these as root; wal and shm recreated
# later in the run are realigned by the per-boot /config sweep
for db_file in (
self.config.database.path,
f"{self.config.database.path}-wal",
f"{self.config.database.path}-shm",
self.config.database.path.replace("frigate.db", "backup.db"),
):
for db_file in db_files:
if os.path.exists(db_file):
chown_to_runtime(db_file)
+11
View File
@@ -1,5 +1,6 @@
import os
from enum import Enum
from typing import Literal
from pydantic import Field, PrivateAttr, model_validator
@@ -208,6 +209,12 @@ class CameraConfig(FrigateBaseModel):
_ffmpeg_cmds: list[dict[str, list[str]]] = PrivateAttr()
# "config" when set by the user, "probed" from the stream at startup, or
# "default" when the probe failed and the fallback size is in use
_detect_resolution_source: Literal["config", "probed", "default"] = PrivateAttr(
default="config"
)
def __init__(self, **config):
# Set zone colors
if "zones" in config:
@@ -249,6 +256,10 @@ class CameraConfig(FrigateBaseModel):
def ffmpeg_cmds(self) -> list[dict[str, list[str]]]:
return self._ffmpeg_cmds
@property
def detect_resolution_source(self) -> Literal["config", "probed", "default"]:
return self._detect_resolution_source
def get_formatted_name(self) -> str:
"""Return the friendly name if set, otherwise return a formatted version of the camera name."""
if self.friendly_name:
+5
View File
@@ -1213,6 +1213,11 @@ class FrigateConfig(FrigateBaseModel):
if stream_info.get("height")
else DEFAULT_DETECT_DIMENSIONS["height"]
)
camera_config._detect_resolution_source = (
"probed"
if stream_info.get("width") and stream_info.get("height")
else "default"
)
# Warn if detect fps > 10
if camera_config.detect.fps > 10 and camera_config.type != "lpr":
+15 -16
View File
@@ -351,12 +351,13 @@ class OnvifController:
autotracking_config.enabled_in_config and autotracking_config.enabled
)
# setup relative move request when FOV relative movement is supported
if (
fov_supported = (
fov_space_id is not None
and configs.DefaultRelativePanTiltTranslationSpace is not None
):
# one-off GetStatus to seed Translation field
)
# relative moves are seeded from the current position
if fov_supported:
status = None
try:
status = await ptz.GetStatus({"ProfileToken": profile.token})
@@ -364,6 +365,15 @@ class OnvifController:
except Exception as e:
logger.warning(f"Unable to get status from camera {camera_name}: {e}")
if status is None or status.Position is None:
logger.warning(
"Disabling relative movement for %s: camera does not report its PTZ position",
camera_name,
)
fov_supported = False
# setup relative move request when FOV relative movement is supported
if fov_supported:
rel_move_request = ptz.create_type("RelativeMove")
rel_move_request.ProfileToken = profile.token
logger.debug(f"{camera_name}: Relative move request: {rel_move_request}")
@@ -373,15 +383,8 @@ class OnvifController:
]["URI"]
if rel_move_request.Translation is None:
if status is not None:
# seed from current position
rel_move_request.Translation = status.Position
rel_move_request.Translation.PanTilt.space = fov_uri
else:
# fallback: construct Translation explicitly
rel_move_request.Translation = {
"PanTilt": {"x": 0, "y": 0, "space": fov_uri}
}
# configure zoom on relative move request
if (
@@ -497,11 +500,7 @@ class OnvifController:
except Exception as e:
logger.debug(f"Focus not supported for {camera_name}: {e}")
# detect FOV relative movement support
if (
fov_space_id is not None
and configs.DefaultRelativePanTiltTranslationSpace is not None
):
if fov_supported:
supported_features.append("pt-r-fov")
cam["relative_fov_range"] = (
ptz_config.Spaces.RelativePanTiltTranslationSpace[fov_space_id]
+1
View File
@@ -280,6 +280,7 @@ class TestHttpApp(BaseTestHttp):
assert camera["ffmpeg"]["inputs"][0]["input_args"] == auth_header
assert camera["ffmpeg"]["input_args"] == auth_header
assert camera["ffmpeg_cmds"]
assert camera["detect_resolution_source"] == "config"
assert config["go2rtc"]["streams"]["front_door"][0] == secret_path
assert "webtorrent" in config["go2rtc"]
+40
View File
@@ -2483,5 +2483,45 @@ class TestFfmpegPath(unittest.TestCase):
)
class TestDetectResolutionSource(unittest.TestCase):
def setUp(self):
self.config = {
"mqtt": {"host": "mqtt"},
"cameras": {
"back": {
"ffmpeg": {
"inputs": [
{"path": "rtsp://10.0.0.1:554/video", "roles": ["detect"]}
]
},
}
},
}
def test_set_in_config(self):
self.config["cameras"]["back"]["detect"] = {"width": 1920, "height": 1080}
camera = FrigateConfig(**self.config).cameras["back"]
assert camera.detect_resolution_source == "config"
def test_set_globally(self):
self.config["detect"] = {"width": 1920, "height": 1080}
camera = FrigateConfig(**self.config).cameras["back"]
assert camera.detect_resolution_source == "config"
@patch(
"frigate.config.config.stream_info_retriever.get_stream_info",
return_value={"width": 2560, "height": 1440, "fourcc": "h264"},
)
def test_probed_from_stream(self, _):
camera = FrigateConfig(**self.config).cameras["back"]
assert camera.detect_resolution_source == "probed"
assert (camera.detect.width, camera.detect.height) == (2560, 1440)
def test_probe_failed_uses_default(self):
camera = FrigateConfig(**self.config).cameras["back"]
assert camera.detect_resolution_source == "default"
assert (camera.detect.width, camera.detect.height) == (1280, 720)
if __name__ == "__main__":
unittest.main(verbosity=2)
+50
View File
@@ -1,5 +1,7 @@
"""Tests for runtime ownership helpers."""
import os
import tempfile
import unittest
from unittest.mock import patch
@@ -73,5 +75,53 @@ class TestChownToRuntime(unittest.TestCase):
ownership.chown_to_runtime("/config/test") # must not raise
class TestFindUnwritableDatabasePath(unittest.TestCase):
def setUp(self) -> None:
tmp = tempfile.TemporaryDirectory()
self.addCleanup(tmp.cleanup)
self.db_dir = os.path.join(tmp.name, "db")
os.mkdir(self.db_dir)
# restore access so cleanup can remove the tree
self.addCleanup(os.chmod, self.db_dir, 0o755)
self.db_path = os.path.join(self.db_dir, "frigate.db")
self.db_files = (
self.db_path,
f"{self.db_path}-wal",
f"{self.db_path}-shm",
os.path.join(self.db_dir, "backup.db"),
)
def test_writable_directory_without_database(self):
assert ownership.find_unwritable_database_path(self.db_files) is None
def test_writable_directory_and_database(self):
open(self.db_path, "w").close()
assert ownership.find_unwritable_database_path(self.db_files) is None
def test_missing_directory(self):
missing_dir = os.path.join(self.db_dir, "missing")
db_files = (os.path.join(missing_dir, "frigate.db"),)
assert ownership.find_unwritable_database_path(db_files) == missing_dir
@unittest.skipIf(os.geteuid() == 0, "root bypasses permission checks")
def test_unwritable_directory(self):
os.chmod(self.db_dir, 0o555)
assert ownership.find_unwritable_database_path(self.db_files) == self.db_dir
@unittest.skipIf(os.geteuid() == 0, "root bypasses permission checks")
def test_unwritable_database(self):
open(self.db_path, "w").close()
os.chmod(self.db_path, 0o444)
assert ownership.find_unwritable_database_path(self.db_files) == self.db_path
@unittest.skipIf(os.geteuid() == 0, "root bypasses permission checks")
def test_unwritable_backup(self):
backup = self.db_files[3]
open(self.db_path, "w").close()
open(backup, "w").close()
os.chmod(backup, 0o444)
assert ownership.find_unwritable_database_path(self.db_files) == backup
if __name__ == "__main__":
unittest.main()
+19
View File
@@ -165,6 +165,25 @@ class TestOnvifInitRequests(unittest.IsolatedAsyncioTestCase):
self.assertTrue(await controller._init_onvif(CAMERA))
self.assertIsNone(controller.cams[CAMERA]["video_source_token"])
async def test_fov_movement_requires_reported_position(self) -> None:
# cameras with StatusPosition="false" omit Position from GetStatus
for position in (MagicMock(), None):
with self.subTest(position=position):
controller = _make_controller(autotracking_enabled=False)
ptz = controller.cams[CAMERA]["onvif"].create_ptz_service.return_value
ptz_config = MagicMock()
ptz_config.Spaces.RelativePanTiltTranslationSpace = [
{"URI": "http://www.onvif.org/TranslationSpaceFov"}
]
ptz.GetConfigurationOptions = AsyncMock(return_value=ptz_config)
ptz.GetStatus = AsyncMock(return_value=MagicMock(Position=position))
self.assertTrue(await controller._init_onvif(CAMERA))
self.assertEqual(
"pt-r-fov" in controller.cams[CAMERA]["features"],
position is not None,
)
class TestManualRelativeMoveMetrics(unittest.IsolatedAsyncioTestCase):
"""A manual move from the UI (click to move, drag to zoom) sends move_relative
+18
View File
@@ -45,3 +45,21 @@ def chown_to_runtime(path: str) -> None:
os.chown(path, *ids)
except OSError as err:
logger.warning(f"Unable to set ownership of {path}: {err}")
def find_unwritable_database_path(db_files: tuple[str, ...]) -> str | None:
"""Return the database directory or file the current user can't write, if any.
db_files starts with the database itself. SQLite creates its -wal and -shm
files next to it, so the directory has to be writable too.
"""
db_dir = os.path.dirname(os.path.abspath(db_files[0]))
if not os.access(db_dir, os.W_OK | os.X_OK):
return db_dir
for path in db_files:
if os.path.exists(path) and not os.access(path, os.R_OK | os.W_OK):
return path
return None
+5 -2
View File
@@ -52,22 +52,25 @@ export function deepMerge<T extends Record<string, unknown>>(
export const BASE_CONFIG = {
...configSnapshot,
version: "0.15.0-test",
// injected by the /config endpoint rather than the Pydantic model, so it
// is absent from the snapshot
// injected by the /config endpoint rather than the Pydantic model, so they
// are absent from the snapshot, as is each camera's detect_resolution_source
plus: { enabled: false },
cameras: {
...configSnapshot.cameras,
front_door: {
...configSnapshot.cameras.front_door,
friendly_name: "Front Door",
detect_resolution_source: "config",
},
backyard: {
...configSnapshot.cameras.backyard,
friendly_name: "Backyard",
detect_resolution_source: "config",
},
garage: {
...configSnapshot.cameras.garage,
friendly_name: "Garage",
detect_resolution_source: "config",
},
},
};
+94 -16
View File
@@ -57,6 +57,14 @@ const EVENT_NOTICE = {
muted_at: null,
};
// a repeated device gets a '#2' suffix, which a raw URL would cut off as a fragment
const SUFFIXED_NOTICE = {
...EVENT_NOTICE,
id: "detector_stuck:openvino:GPU#2",
scope: "openvino:GPU#2",
params: { detector: "openvino:GPU#2" },
};
test.describe("System — Health tab @medium", () => {
test("Health is the default tab and lists notices by severity", async ({
frigateApp,
@@ -95,19 +103,20 @@ test.describe("System — Health tab @medium", () => {
for (const action of ["acknowledge", "mute"] as const) {
test(`${action} posts and removes the row`, async ({ frigateApp }) => {
const path = `/api/notices/${encodeURIComponent(SUFFIXED_NOTICE.id)}/${action}`;
await frigateApp.installDefaults({
config: RESTREAMED,
stats: QUIET_STATS,
notices: [EVENT_NOTICE],
notices: [SUFFIXED_NOTICE],
});
// the list shrinks after the POST so the refetch shows the row gone
let hidden = false;
await frigateApp.page.route("**/api/notices", (route) =>
route.fulfill({ json: hidden ? [] : [EVENT_NOTICE] }),
route.fulfill({ json: hidden ? [] : [SUFFIXED_NOTICE] }),
);
await frigateApp.page.route(
`**/api/notices/detector_stuck/${action}`,
(url) => url.pathname.endsWith(path),
(route) => {
hidden = true;
return route.fulfill({ json: { success: true } });
@@ -117,11 +126,10 @@ test.describe("System — Health tab @medium", () => {
await frigateApp.goto("/system#health");
const request = frigateApp.page.waitForRequest(
(req) =>
req.url().includes(`/api/notices/detector_stuck/${action}`) &&
req.method() === "POST",
new URL(req.url()).pathname.endsWith(path) && req.method() === "POST",
);
await frigateApp.page
.getByTestId("health-problem-notice:detector_stuck")
.getByTestId(`health-problem-notice:${SUFFIXED_NOTICE.id}`)
.getByRole("button", {
name: action === "mute" ? "Mute" : "Acknowledge",
exact: true,
@@ -264,8 +272,9 @@ test.describe("System — Health tab @medium", () => {
url.searchParams.get("include_hidden") === "true",
(route) => route.fulfill({ json: [MUTED_NOTICE] }),
);
const path = `/api/notices/${encodeURIComponent(MUTED_NOTICE.id)}/hidden`;
await frigateApp.page.route(
"**/api/notices/model_download_failed:yolo/model.onnx/hidden",
(url) => url.pathname.endsWith(path),
(route) => route.fulfill({ json: { success: true } }),
);
await frigateApp.goto("/system#health");
@@ -276,11 +285,7 @@ test.describe("System — Health tab @medium", () => {
const request = frigateApp.page.waitForRequest(
(req) =>
req
.url()
.endsWith(
"/api/notices/model_download_failed:yolo/model.onnx/hidden",
) && req.method() === "DELETE",
new URL(req.url()).pathname.endsWith(path) && req.method() === "DELETE",
);
await frigateApp.page
.getByTestId(
@@ -1067,6 +1072,76 @@ test.describe("System — Health notices sources @medium", () => {
).toHaveCount(0);
});
test("a camera on the fallback detect resolution is flagged", async ({
frigateApp,
}) => {
await frigateApp.installDefaults({
config: { cameras: { garage: { detect_resolution_source: "default" } } },
stats: QUIET_STATS,
});
await frigateApp.goto("/system#health");
const row = frigateApp.page.getByTestId(
"health-problem-config:detect:detect-resolution-not-probed:camera.garage",
);
await expect(row).toBeVisible({ timeout: 15_000 });
await expect(row).toHaveAttribute("data-severity", "warning");
await expect(
frigateApp.page.getByTestId(
"health-problem-config:detect:detect-resolution-not-probed:camera.front_door",
),
).toHaveCount(0);
});
test("an unprobeable resolution is only flagged when Frigate must probe it", async ({
frigateApp,
}) => {
const noSize = [
{
return_code: 0,
stderr: "",
stdout: {
streams: [
{ codec_type: "video", codec_name: "h264" },
{ codec_type: "audio", codec_name: "aac" },
],
},
},
];
await frigateApp.installDefaults({
config: {
cameras: {
backyard: { detect_resolution_source: "probed" },
front_door: { detect_resolution_source: "default" },
},
},
ffprobe: { backyard: noSize, front_door: noSize, garage: noSize },
stats: QUIET_STATS,
});
await frigateApp.goto("/system#health");
await frigateApp.page
.getByRole("button", { name: "Run stream checks" })
.click();
await expect(
frigateApp.page.getByTestId(
"health-problem-stream:backyard:0:resolution-unknown",
),
).toBeVisible({ timeout: 15_000 });
await expect(
frigateApp.page.getByTestId(
"health-problem-stream:garage:0:resolution-unknown",
),
).toHaveCount(0);
// the startup probe's own row already covers this camera
await expect(
frigateApp.page.getByTestId(
"health-problem-stream:front_door:0:resolution-unknown",
),
).toHaveCount(0);
});
test("wizard-only Reolink advice stays off the tab", async ({
frigateApp,
}) => {
@@ -1281,10 +1356,14 @@ test.describe("System — Health notices sources @medium", () => {
// the list gains the mute after the POST so the refetch hides the row
let muted = false;
await frigateApp.page.route(`**/api/notices/${id}/mute`, (route) => {
const path = `/api/notices/${encodeURIComponent(id)}/mute`;
await frigateApp.page.route(
(url) => url.pathname.endsWith(path),
(route) => {
muted = true;
return route.fulfill({ json: { success: true } });
});
},
);
await frigateApp.page.route("**/api/notices/muted_checks", (route) =>
route.fulfill({ json: muted ? [{ id, muted_at: NOW }] : [] }),
);
@@ -1297,8 +1376,7 @@ test.describe("System — Health notices sources @medium", () => {
);
const request = frigateApp.page.waitForRequest(
(req) =>
req.url().includes(`/api/notices/${id}/mute`) &&
req.method() === "POST",
new URL(req.url()).pathname.endsWith(path) && req.method() === "POST",
);
await row.getByRole("button", { name: "Mute", exact: true }).click();
await request;
@@ -2028,6 +2028,7 @@
},
"detect": {
"fpsGreaterThanFive": "Setting the detect FPS higher than 5 is not recommended. Higher values may cause performance issues and will not provide any benefit.",
"resolutionNotProbed": "Frigate could not probe the resolution of this camera's detect stream, so it is using a default of 1280x720, which may not match the camera. Set the detect width and height to match the stream.",
"disabled": "Object detection is disabled. Snapshots, review items, and enrichments such as face recognition, license plate recognition, and Generative AI will not function.",
"runtimeDisabled": "Object detection is enabled in your config, but it is currently turned off for this camera. Snapshots, review items, and enrichments such as face recognition, license plate recognition, and Generative AI will not function until it is turned back on from the camera's live view, or until the active profile stops disabling it.",
"sceneWithoutModel": "No detection model is configured for this scene, so this camera falls back to the Default model. Add a model for this scene to give the camera its own.",
@@ -18,6 +18,17 @@ const detect: SectionConfigOverrides = {
condition: (ctx) =>
ctx.level === "camera" && ctx.formData?.enabled === false,
},
{
key: "detect-resolution-not-probed",
health: true,
messageKey: "configMessages.detect.resolutionNotProbed",
severity: "warning",
// profiles hide width and height
condition: (ctx) =>
ctx.level === "camera" &&
!ctx.profileName &&
ctx.fullCameraConfig?.detect_resolution_source === "default",
},
],
fieldMessages: [
{
+2 -2
View File
@@ -58,7 +58,7 @@ export function useHealthProblems(
const muteCheck = useCallback(
async (id: string) => {
await axios.post(`notices/${id}/mute`);
await axios.post(`notices/${encodeURIComponent(id)}/mute`);
mutateMutedChecks();
},
[mutateMutedChecks],
@@ -66,7 +66,7 @@ export function useHealthProblems(
const unmuteCheck = useCallback(
async (id: string) => {
await axios.delete(`notices/${id}/hidden`);
await axios.delete(`notices/${encodeURIComponent(id)}/hidden`);
mutateMutedChecks();
},
[mutateMutedChecks],
+5 -3
View File
@@ -60,15 +60,17 @@ export function useNotices(showHidden: boolean) {
);
const acknowledge = useCallback(
(id: string) => act(axios.post(`notices/${id}/acknowledge`)),
(id: string) =>
act(axios.post(`notices/${encodeURIComponent(id)}/acknowledge`)),
[act],
);
const mute = useCallback(
(id: string) => act(axios.post(`notices/${id}/mute`)),
(id: string) => act(axios.post(`notices/${encodeURIComponent(id)}/mute`)),
[act],
);
const unhide = useCallback(
(id: string) => act(axios.delete(`notices/${id}/hidden`)),
(id: string) =>
act(axios.delete(`notices/${encodeURIComponent(id)}/hidden`)),
[act],
);
+3
View File
@@ -36,6 +36,8 @@ export interface FaceRecognitionConfig {
export type SearchModel = "jinav1" | "jinav2" | (string & NonNullable<unknown>);
export type SearchModelSize = "small" | "large";
export type DetectResolutionSource = "config" | "probed" | "default";
export type LiveTranscodeQuality = {
height: number;
bitrate: number;
@@ -116,6 +118,7 @@ export interface CameraConfig {
cmd: string;
roles: string[];
}[];
detect_resolution_source?: DetectResolutionSource;
live: {
height: number;
quality: number;
+6 -1
View File
@@ -58,6 +58,10 @@ export function streamHealth(
checked += 1;
const link = `/settings?page=cameraFfmpeg&camera=${encodeURIComponent(name)}`;
const copiesAudio = recordCopiesAudio(camera);
// a set resolution needs no probe, and a failed startup probe has its own row
const resolutionCovered =
camera.detect_resolution_source === "config" ||
camera.detect_resolution_source === "default";
let flagged = false;
if (check.error) {
@@ -125,7 +129,8 @@ export function streamHealth(
(issue): issue is StreamIssue & { type: "warning" | "error" } =>
issue.type !== "good" &&
!WIZARD_ONLY_RULES.has(issue.rule) &&
(issue.rule !== "audio-codec-record" || copiesAudio),
(issue.rule !== "audio-codec-record" || copiesAudio) &&
(issue.rule !== "resolution-unknown" || !resolutionCovered),
)
.forEach((issue) => {
flagged = true;