Support all audio type in MQTT (#19768)

* Support all audio type in MQTT

* Formatting
This commit is contained in:
Nicolas Mowen 2025-08-26 08:50:50 -06:00 committed by GitHub
parent 6c3f99150c
commit 195f705616
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -279,6 +279,8 @@ The height and crop of snapshots can be configured in the config.
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. 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.
`all` can be used as the audio_type for the status of all audio types.
### `frigate/<camera_name>/audio/dBFS` ### `frigate/<camera_name>/audio/dBFS`
Publishes the dBFS value for audio detected on this camera. Publishes the dBFS value for audio detected on this camera.

View File

@ -181,6 +181,10 @@ class AudioActivityManager:
new_detections = new_activity[camera].get("detections", []) new_detections = new_activity[camera].get("detections", [])
if self.compare_audio_activity(camera, new_detections, now): if self.compare_audio_activity(camera, new_detections, now):
logger.debug(f"Audio detections for {camera}: {new_activity}") logger.debug(f"Audio detections for {camera}: {new_activity}")
self.publish(
f"{camera}/audio/all",
"ON" if len(self.current_audio_detections[camera]) > 0 else "OFF",
)
self.publish( self.publish(
"audio_detections", "audio_detections",
json.dumps(self.current_audio_detections), json.dumps(self.current_audio_detections),