From 59a7c79b886eb0fde7034c30c832b9e102144108 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 27 May 2025 10:02:32 -0500 Subject: [PATCH] config validator and docs --- docs/docs/configuration/audio_detectors.md | 8 +++++--- frigate/config/config.py | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/docs/configuration/audio_detectors.md b/docs/docs/configuration/audio_detectors.md index 5031e4184..33dcd456e 100644 --- a/docs/docs/configuration/audio_detectors.md +++ b/docs/docs/configuration/audio_detectors.md @@ -75,14 +75,16 @@ audio: ### Audio Transcription -Frigate supports fully local text transcription using `sherpa-onnx` and OpenAI's fully local, open source Whisper models (using `faster-whisper`). Enable audio transcription features at the global level in your config: +Frigate supports fully local text transcription using `sherpa-onnx` and OpenAI's fully local, open source Whisper models (using `faster-whisper`). Audio transcription can be enabled at the global level of your config, but since you likely will not want to use audio transcription for every camera, just set the config for audio transcription features at the global level: ```yaml audio_transcription: - enabled: True + enabled: False + device: ... + model_size: ... ``` -Audio transcription can also be enabled for select cameras only at the camera level: +Then enable audio transcription for select cameras only at the camera level: ```yaml cameras: diff --git a/frigate/config/config.py b/frigate/config/config.py index 7c7eeb1e7..5bca436b6 100644 --- a/frigate/config/config.py +++ b/frigate/config/config.py @@ -710,6 +710,21 @@ class FrigateConfig(FrigateBaseModel): self.model.create_colormap(sorted(self.objects.all_objects)) self.model.check_and_load_plus_model(self.plus_api) + # Check audio transcription and audio detection requirements + if self.audio_transcription.enabled: + # If audio transcription is enabled globally, at least one camera must have audio detection enabled + if not any(camera.audio.enabled for camera in self.cameras.values()): + raise ValueError( + "Audio transcription is enabled globally, but no cameras have audio detection enabled. At least one camera must have audio detection enabled." + ) + else: + # If audio transcription is disabled globally, check each camera with audio_transcription enabled + for camera in self.cameras.values(): + if camera.audio_transcription.enabled and not camera.audio.enabled: + raise ValueError( + f"Camera {camera.name} has audio transcription enabled, but audio detection is not enabled for this camera. Audio detection must be enabled for cameras with audio transcription when it is disabled globally." + ) + if self.plus_api and not self.snapshots.clean_copy: logger.warning( "Frigate+ is configured but clean snapshots are not enabled, submissions to Frigate+ will not be possible./"