mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 17:25:22 +03:00
Send mqtt message when motion is detected
This commit is contained in:
parent
0a4d658c7f
commit
a57b60e259
@ -255,6 +255,8 @@ class FrigateApp:
|
||||
args=(
|
||||
name,
|
||||
config,
|
||||
self.mqtt_client,
|
||||
self.config.mqtt.topic_prefix,
|
||||
model_shape,
|
||||
self.config.model.merged_labelmap,
|
||||
self.detection_queue,
|
||||
|
||||
@ -340,6 +340,8 @@ def capture_camera(name, config: CameraConfig, process_info):
|
||||
def track_camera(
|
||||
name,
|
||||
config: CameraConfig,
|
||||
mqtt_client,
|
||||
mqtt_prefix,
|
||||
model_shape,
|
||||
labelmap,
|
||||
detection_queue,
|
||||
@ -381,6 +383,8 @@ def track_camera(
|
||||
|
||||
process_frames(
|
||||
name,
|
||||
mqtt_client,
|
||||
mqtt_prefix,
|
||||
frame_queue,
|
||||
frame_shape,
|
||||
model_shape,
|
||||
@ -468,6 +472,8 @@ def detect(
|
||||
|
||||
def process_frames(
|
||||
camera_name: str,
|
||||
mqtt_client,
|
||||
mqtt_prefix,
|
||||
frame_queue: mp.Queue,
|
||||
frame_shape,
|
||||
model_shape,
|
||||
@ -518,6 +524,9 @@ def process_frames(
|
||||
# look for motion if enabled
|
||||
motion_boxes = motion_detector.detect(frame) if motion_enabled.value else []
|
||||
|
||||
if mqtt_client:
|
||||
mqtt_client(f"{mqtt_prefix}/{camera_name}/motion/detected", True if motion_boxes else False, False)
|
||||
|
||||
regions = []
|
||||
|
||||
# if detection is disabled
|
||||
|
||||
Loading…
Reference in New Issue
Block a user