agent icon indicating copy to clipboard operation
agent copied to clipboard

ONVIF motion events to trigger recording

Open OttoHollmann opened this issue 8 months ago • 5 comments

Hi there,

I’d like to know if kerberos-agent can be configured to use ONVIF motion events to trigger recordings.

I've successfully set up ONVIF in Kerberos, but recordings are not being triggered.

To verify, I used a simple script with the node-onvif-events library and confirmed that my camera is indeed sending ONVIF motion events.

I'm using the latest Docker ARM image, and I've configured the following environment variables:

  • AGENT_NAME
  • AGENT_CAPTURE_IPCAMERA_RTSP
  • AGENT_CAPTURE_IPCAMERA_ONVIF_XADDR
  • AGENT_CAPTURE_IPCAMERA_ONVIF_USERNAME
  • AGENT_CAPTURE_IPCAMERA_ONVIF_PASSWORD

Am I missing something in the configuration, or is this feature currently not implemented?

Thanks in advance!

OttoHollmann avatar Apr 14 '25 20:04 OttoHollmann

Hey @OttoHollmann thanks for reporting! Currently we do not have an ONVIF event listener as we currently compute motion our selves. What I understand is that you have setup a motion region on the ONVIF camera, and expect our Agent to respond to an event and make a recording.

cedricve avatar Apr 23 '25 05:04 cedricve

Thank you for the confirmation.

Yes, you’ve understood it correctly. I’d like to use the camera’s motion detection (since it offers advanced motion settings with hardware acceleration) and run Agent on the Raspberry Pi as a lightweight recorder.

Would it be straightforward to implement? If so, I’ll give it a try.

OttoHollmann avatar Apr 23 '25 17:04 OttoHollmann

cool, we have an onvif library here: https://github.com/kerberos-io/onvif. There is an event handler which we are currently using to read IO inputs and output values. Which is happening here: https://github.com/kerberos-io/agent/blob/master/machinery/src/cloud/Cloud.go#L299-L404

I would expect that ONVIF will push a message on the queue if motion is detected, if we could retrieve that message we should start a recording by push an event in motion channel: https://github.com/kerberos-io/agent/blob/master/machinery/src/computervision/main.go#L164-L168

This will then trigger a recording. I think all is possible, it is just a matter to know how to retrieve the ONVIF event (pullmessagepoint is just my assumption)

cedricve avatar Apr 23 '25 20:04 cedricve

hey @OttoHollmann was wondering if you did some magic here? Happy to assist.

cedricve avatar May 22 '25 05:05 cedricve

Thank you for asking. I haven’t had much time, and I also got a little bit stuck with parsing events, but it should be resolved now. I’ve just created a draft PR #194 with my changes.

There are a couple of things left to finish, but for now, it works.

Can you please do a brief review to see if I’m on the right track?

OttoHollmann avatar May 27 '25 20:05 OttoHollmann