Skip to content

Commit b6ea861

Browse files
committed
Fix MQTT publish for built-in motion detections
1 parent 69de0d0 commit b6ea861

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/video/unified_detection_thread.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "core/config.h"
3939
#include "core/path_utils.h"
4040
#include "core/shutdown_coordinator.h"
41+
#include "core/mqtt_client.h"
4142
#include "utils/strings.h"
4243
#include "video/unified_detection_thread.h"
4344
#include "video/packet_buffer.h"
@@ -2469,6 +2470,14 @@ static bool run_detection_on_frame(unified_detection_ctx_t *ctx, AVPacket *pkt)
24692470
if (store_detections_in_db(ctx->stream_name, &result, now, rec_id) != 0) {
24702471
log_warn("[%s] Failed to store motion detections in database", ctx->stream_name);
24712472
}
2473+
2474+
// Keep MQTT/Home Assistant motion topics in sync with built-in
2475+
// motion detections. Other detection backends publish here via
2476+
// their own pipelines; built-in motion must do the same after
2477+
// threshold and zone filtering.
2478+
mqtt_publish_detection(ctx->stream_name, &result, now);
2479+
mqtt_set_motion_state(ctx->stream_name, &result);
2480+
24722481
pthread_mutex_lock(&ctx->mutex);
24732482
ctx->total_detections += result.count;
24742483
pthread_mutex_unlock(&ctx->mutex);

0 commit comments

Comments
 (0)