Skip to content

Commit 195f705

Browse files
authored
Support all audio type in MQTT (#19768)
* Support all audio type in MQTT * Formatting
1 parent 6c3f991 commit 195f705

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

docs/docs/integrations/mqtt.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ The height and crop of snapshots can be configured in the config.
279279

280280
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.
281281

282+
`all` can be used as the audio_type for the status of all audio types.
283+
282284
### `frigate/<camera_name>/audio/dBFS`
283285

284286
Publishes the dBFS value for audio detected on this camera.

frigate/camera/activity_manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ def update_activity(self, new_activity: dict[str, dict[str, Any]]) -> None:
181181
new_detections = new_activity[camera].get("detections", [])
182182
if self.compare_audio_activity(camera, new_detections, now):
183183
logger.debug(f"Audio detections for {camera}: {new_activity}")
184+
self.publish(
185+
f"{camera}/audio/all",
186+
"ON" if len(self.current_audio_detections[camera]) > 0 else "OFF",
187+
)
184188
self.publish(
185189
"audio_detections",
186190
json.dumps(self.current_audio_detections),

0 commit comments

Comments
 (0)