Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions plugins/onvif/src/onvif-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down
10 changes: 4 additions & 6 deletions plugins/onvif/src/onvif-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down