mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-05 14:47:40 +03:00
fix: sync {camera}/motion topic from camera_activity updates
applyCameraActivity expanded camera_activity into many per-camera
topics ({camera}/enabled/state, {camera}/detect/state, etc.) but
never synced the motion field into {camera}/motion.
This caused a critical bug: a stale retained MQTT "OFF" value in
{camera}/motion would permanently override the live motion state
from camera_activity.motion. In useCameraActivity the detectingMotion
check (truthy string "OFF") took priority over camera_activity.motion,
so activeMotion was always false even with real motion present.
Now applyCameraActivity writes state.motion → {camera}/motion ("ON"/
"OFF"), keeping it in sync with the authoritative camera_activity data.
https://claude.ai/code/session_019B4dJXtcxvHn97ZaqHUB62
This commit is contained in:
parent
621f484b92
commit
703ffcf82e
@ -149,6 +149,12 @@ function applyCameraActivity(payload: string) {
|
|||||||
for (const [name, state] of Object.entries(activity)) {
|
for (const [name, state] of Object.entries(activity)) {
|
||||||
applyTopicUpdate(`camera_activity/${name}`, state);
|
applyTopicUpdate(`camera_activity/${name}`, state);
|
||||||
|
|
||||||
|
// Sync motion state so {camera}/motion topic stays up-to-date with
|
||||||
|
// camera_activity and doesn't remain stale from a retained MQTT value.
|
||||||
|
if (state.motion !== undefined) {
|
||||||
|
applyTopicUpdate(`${name}/motion`, state.motion ? "ON" : "OFF");
|
||||||
|
}
|
||||||
|
|
||||||
const cameraConfig = state?.config;
|
const cameraConfig = state?.config;
|
||||||
if (!cameraConfig) continue;
|
if (!cameraConfig) continue;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user