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=(
|
args=(
|
||||||
name,
|
name,
|
||||||
config,
|
config,
|
||||||
|
self.mqtt_client,
|
||||||
|
self.config.mqtt.topic_prefix,
|
||||||
model_shape,
|
model_shape,
|
||||||
self.config.model.merged_labelmap,
|
self.config.model.merged_labelmap,
|
||||||
self.detection_queue,
|
self.detection_queue,
|
||||||
|
|||||||
@ -340,6 +340,8 @@ def capture_camera(name, config: CameraConfig, process_info):
|
|||||||
def track_camera(
|
def track_camera(
|
||||||
name,
|
name,
|
||||||
config: CameraConfig,
|
config: CameraConfig,
|
||||||
|
mqtt_client,
|
||||||
|
mqtt_prefix,
|
||||||
model_shape,
|
model_shape,
|
||||||
labelmap,
|
labelmap,
|
||||||
detection_queue,
|
detection_queue,
|
||||||
@ -381,6 +383,8 @@ def track_camera(
|
|||||||
|
|
||||||
process_frames(
|
process_frames(
|
||||||
name,
|
name,
|
||||||
|
mqtt_client,
|
||||||
|
mqtt_prefix,
|
||||||
frame_queue,
|
frame_queue,
|
||||||
frame_shape,
|
frame_shape,
|
||||||
model_shape,
|
model_shape,
|
||||||
@ -468,6 +472,8 @@ def detect(
|
|||||||
|
|
||||||
def process_frames(
|
def process_frames(
|
||||||
camera_name: str,
|
camera_name: str,
|
||||||
|
mqtt_client,
|
||||||
|
mqtt_prefix,
|
||||||
frame_queue: mp.Queue,
|
frame_queue: mp.Queue,
|
||||||
frame_shape,
|
frame_shape,
|
||||||
model_shape,
|
model_shape,
|
||||||
@ -518,6 +524,9 @@ def process_frames(
|
|||||||
# look for motion if enabled
|
# look for motion if enabled
|
||||||
motion_boxes = motion_detector.detect(frame) if motion_enabled.value else []
|
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 = []
|
regions = []
|
||||||
|
|
||||||
# if detection is disabled
|
# if detection is disabled
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user