diff --git a/docs/docs/integrations/mqtt.md b/docs/docs/integrations/mqtt.md index 8f690bcaa..cd6de8651 100644 --- a/docs/docs/integrations/mqtt.md +++ b/docs/docs/integrations/mqtt.md @@ -5,6 +5,8 @@ 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: @@ -15,23 +17,6 @@ Designed to be used as an availability topic with Home Assistant. Possible messa Causes Frigate to exit. Docker should be configured to automatically restart the container on exit. -### `frigate//` - -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//` - -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///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/events` Message published for each changed event. 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 event ends, a final message is published with `end_time` set. @@ -111,6 +96,41 @@ Message published for each changed event. The first message is published when th Same data available at `/api/stats` published at a configurable interval. +## Frigate Camera Topics + +### `frigate//` + +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//` + +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///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//audio/` + +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//audio/dBFS` + +Publishes the dBFS value for audio detected on this camera. + +**NOTE:** Requires audio detection to be enabled + +### `frigate//audio/rms` + +Publishes the rms value for audio detected on this camera. + +**NOTE:** Requires audio detection to be enabled + ### `frigate//detect/set` Topic to turn object detection for a camera on and off. Expected values are `ON` and `OFF`. diff --git a/frigate/events/audio.py b/frigate/events/audio.py index a9d9b82c7..1c39e4d59 100644 --- a/frigate/events/audio.py +++ b/frigate/events/audio.py @@ -228,6 +228,10 @@ class AudioEventMaintainer(threading.Thread): "last_detection" ] = datetime.datetime.now().timestamp() else: + self.inter_process_communicator.queue.put( + (f"{self.config.name}/audio/{label}", "ON") + ) + resp = requests.post( f"{FRIGATE_LOCALHOST}/api/events/{self.config.name}/{label}/create", json={"duration": None, "source_type": "audio"}, @@ -252,6 +256,10 @@ class AudioEventMaintainer(threading.Thread): now - detection.get("last_detection", now) > self.config.audio.max_not_heard ): + self.inter_process_communicator.queue.put( + (f"{self.config.name}/audio/{detection['label']}", "OFF") + ) + resp = requests.put( f"{FRIGATE_LOCALHOST}/api/events/{detection['id']}/end", json={ @@ -259,6 +267,7 @@ class AudioEventMaintainer(threading.Thread): + self.config.record.events.post_capture }, ) + if resp.status_code == 200: self.detections[detection["label"]] = None else: