diff --git a/plugins/onvif/src/onvif-api.ts b/plugins/onvif/src/onvif-api.ts index 5f70c1db10..6af3daac88 100644 --- a/plugins/onvif/src/onvif-api.ts +++ b/plugins/onvif/src/onvif-api.ts @@ -146,9 +146,11 @@ export class OnvifCameraAPI { ret.emit('event', OnvifEvent.BinaryStop) } else if (eventTopic.includes('RuleEngine/CellMotionDetector/Motion')) { - // unclear if the IsMotion false is indicative of motion stop? - if (event.message.message.data.simpleItem.$.Name === 'IsMotion' && dataValue) { - ret.emit('event', OnvifEvent.MotionBuggy); + if (event.message.message.data.simpleItem.$.Name === 'IsMotion') { + if (dataValue) + ret.emit('event', OnvifEvent.MotionStart); + else + ret.emit('event', OnvifEvent.MotionStop); } } else if (eventTopic.includes('RuleEngine/ObjectDetector')) { diff --git a/plugins/onvif/src/onvif-events.ts b/plugins/onvif/src/onvif-events.ts index 77c4f331b3..77378003b6 100644 --- a/plugins/onvif/src/onvif-events.ts +++ b/plugins/onvif/src/onvif-events.ts @@ -40,14 +40,12 @@ export async function listenEvents(thisDevice: ScryptedDeviceBase, client: Onvif // furthermore, cameras are not guaranteed to send motion stop events, which makes. // for the sake of providing normalized motion durations through scrypted, debounce the motion. triggerMotion(); - // thisDevice.motionDetected = true; } else if (event === OnvifEvent.MotionStop) { - // reset the trigger to debounce per above. - if (thisDevice.motionDetected) - triggerMotion(); - - // thisDevice.motionDetected = false; + // Camera sent an explicit stop signal - clear motion immediately rather than + // debouncing, so the motion badge reflects the true state of the camera. + clearTimeout(motionTimeout); + thisDevice.motionDetected = false; } else if (event === OnvifEvent.AudioStart) thisDevice.audioDetected = true;