Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ONVIF event subscription: Return available list of event types supported by the camera #662

Open
curtishall opened this issue Feb 21, 2024 · 4 comments
Assignees

Comments

@curtishall
Copy link
Member

curtishall commented Feb 21, 2024

Currently the (old) onvif_tool (out of spec) only supported motion events. Edge based motion events (camera triggered motion events) are overly sensitive and really not that useful for customers when they can use our own motion detection built into our software already.

However more and more cameras, even cheap ones, are starting to support basic AI (person / vehicle / catdog / etc). We should expand on our existing nodejs onvif code base and detect the available event subscription options and return that when queried. In the web UI the end user can select the event type(s) to start recording (respecting the pre/post recording that we have now for onvif triggering (

<input type="checkbox" class="click-event" data-function="triggerONVIFevents" <?php echo (($device_schedule->schedule_data[0]['onvif_events_enabled']) ? ' checked="checked"': '' ); ?> /> <?php echo TRIGGER_ONVIF_EVENTS; ?>
)

The nodejs code returns the following when connecting to a ONVIF supported camera that has multiple event types:

Connected to ONVIF Device
Manufacturer  REOLINK
Model         RLC-823A
Firmware      v3.1.0.2831_23102509_v1.0.0.31
Serial Number 19216886176
Device Time   Wed Feb 21 2024 00:59:55 GMT+0000 (Coordinated Universal Time)
Found Event - /VIDEOSOURCE/MOTIONALARM
  Source={"simpleItemDescription":{"$":{"Name":"Source","Type":"tt:ReferenceToken"}}}
  Data={"simpleItemDescription":{"$":{"Name":"State","Type":"xsd:boolean"}}}
Found Event - /VIDEOSOURCE/IMAGETOODARK/IMAGINGSERVICE
  Source={"simpleItemDescription":{"$":{"Name":"Source","Type":"tt:ReferenceToken"}}}
  Data={"simpleItemDescription":{"$":{"Name":"State","Type":"xsd:boolean"}}}
Found Event - /MEDIA/PROFILECHANGED
  Data={"simpleItemDescription":{"$":{"Name":"Token","Type":"tt:ReferenceToken"}}}
Found Event - /MEDIA/CONFIGURATIONCHANGED
  Source={"simpleItemDescription":{"$":{"Name":"Token","Type":"tt:ReferenceToken"}}}
  Data={"simpleItemDescription":{"$":{"Name":"Type","Type":"xsd:string"}}}
Found Event - /RULEENGINE/CELLMOTIONDETECTOR/MOTION
  Source={"simpleItemDescription":[{"$":{"Name":"VideoSourceConfigurationToken","Type":"tt:ReferenceToken"}},{"$":{"Name":"VideoAnalyticsConfigurationToken","Type":"tt:ReferenceToken"}},{"$":{"Name":"Rule","Type":"xsd:string"}}]}
  Data={"simpleItemDescription":{"$":{"Name":"IsMotion","Type":"xsd:boolean"}}}


EVENT: 2024-02-21T00:59:55.000Z RuleEngine/CellMotionDetector/Motion PROP:Initialized SRC:VideoSourceConfigurationToken=000 DATA:IsMotion=false
EVENT: 2024-02-21T00:59:55.000Z RuleEngine/MyRuleDetector/FaceDetect PROP:Initialized SRC:Source=VideoSourceToken DATA:State=false
EVENT: 2024-02-21T00:59:55.000Z RuleEngine/MyRuleDetector/PeopleDetect PROP:Initialized SRC:Source=VideoSourceToken DATA:State=false
EVENT: 2024-02-21T00:59:55.000Z RuleEngine/MyRuleDetector/VehicleDetect PROP:Initialized SRC:Source=VideoSourceToken DATA:State=false
EVENT: 2024-02-21T00:59:55.000Z RuleEngine/MyRuleDetector/DogCatDetect PROP:Initialized SRC:Source=VideoSourceToken DATA:State=false
EVENT: 2024-02-21T00:59:55.000Z VideoSource/MotionAlarm PROP:Initialized SRC:Source=000 DATA:State=false

When a person is detected:

EVENT: 2024-02-21T01:02:48.000Z RuleEngine/MyRuleDetector/PeopleDetect PROP:Changed SRC:Source=VideoSourceToken DATA:State=true

When the person is no longer detected:

EVENT: 2024-02-21T01:03:02.000Z RuleEngine/MyRuleDetector/PeopleDetect PROP:Changed SRC:Source=VideoSourceToken DATA:State=false

Note: The camera also throws motion detection too....we would encourage users NOT to select motion. Here is the motion alerts from the same event above:

EVENT: 2024-02-21T01:02:49.000Z RuleEngine/CellMotionDetector/Motion PROP:Changed SRC:VideoSourceConfigurationToken=000 DATA:IsMotion=true
EVENT: 2024-02-21T01:02:49.000Z VideoSource/MotionAlarm PROP:Changed SRC:Source=000 DATA:State=true
EVENT: 2024-02-21T01:03:12.000Z RuleEngine/CellMotionDetector/Motion PROP:Changed SRC:VideoSourceConfigurationToken=000 DATA:IsMotion=false
EVENT: 2024-02-21T01:03:12.000Z VideoSource/MotionAlarm PROP:Changed SRC:Source=000 DATA:State=false
EVENT: 2024-02-21T01:03:27.000Z RuleEngine/CellMotionDetector/Motion PROP:Changed SRC:VideoSourceConfigurationToken=000 DATA:IsMotion=true
EVENT: 2024-02-21T01:03:27.000Z VideoSource/MotionAlarm PROP:Changed SRC:Source=000 DATA:State=true
EVENT: 2024-02-21T01:03:30.000Z RuleEngine/CellMotionDetector/Motion PROP:Changed SRC:VideoSourceConfigurationToken=000 DATA:IsMotion=false
EVENT: 2024-02-21T01:03:30.000Z VideoSource/MotionAlarm PROP:Changed SRC:Source=000 DATA:State=false

Full log (all events pulled):

EVENT: 2024-02-21T01:02:48.000Z RuleEngine/MyRuleDetector/PeopleDetect PROP:Changed SRC:Source=VideoSourceToken DATA:State=true
EVENT: 2024-02-21T01:02:49.000Z RuleEngine/CellMotionDetector/Motion PROP:Changed SRC:VideoSourceConfigurationToken=000 DATA:IsMotion=true
EVENT: 2024-02-21T01:02:49.000Z VideoSource/MotionAlarm PROP:Changed SRC:Source=000 DATA:State=true
EVENT: 2024-02-21T01:03:02.000Z RuleEngine/MyRuleDetector/PeopleDetect PROP:Changed SRC:Source=VideoSourceToken DATA:State=false
EVENT: 2024-02-21T01:03:12.000Z RuleEngine/CellMotionDetector/Motion PROP:Changed SRC:VideoSourceConfigurationToken=000 DATA:IsMotion=false
EVENT: 2024-02-21T01:03:12.000Z VideoSource/MotionAlarm PROP:Changed SRC:Source=000 DATA:State=false
EVENT: 2024-02-21T01:03:27.000Z RuleEngine/CellMotionDetector/Motion PROP:Changed SRC:VideoSourceConfigurationToken=000 DATA:IsMotion=true
EVENT: 2024-02-21T01:03:27.000Z VideoSource/MotionAlarm PROP:Changed SRC:Source=000 DATA:State=true
EVENT: 2024-02-21T01:03:30.000Z RuleEngine/CellMotionDetector/Motion PROP:Changed SRC:VideoSourceConfigurationToken=000 DATA:IsMotion=false
EVENT: 2024-02-21T01:03:30.000Z VideoSource/MotionAlarm PROP:Changed SRC:Source=000 DATA:State=false
@curtishall curtishall changed the title ONVIF event subscription: Return available list of event supported by the camera ONVIF event subscription: Return available list of event types supported by the camera Feb 21, 2024
@andrey-utkin
Copy link
Contributor

@curtishall is that https://github.com/agsh/onvif/blob/master/examples/example6.js ? Do you have your own patches on top of that?

@andrey-utkin
Copy link
Contributor

andrey-utkin commented Mar 21, 2024

Let's take this https://github.com/agsh/onvif/blob/master/examples/example6.js ,

  • tweak to take command line arguments for HOSTNAME, PASSWORD etc
  • make it figure out intelligently EVENT_RECEIVER_IP_ADDRESS, EVENT_RECEIVER_PORT from the host it's running on
  • give it a sensible name and put the changed script into misc/onvif/ alongside getRtspUrls.js and others

And then some frontend magic.

@curtishall
Copy link
Member Author

@curtishall is that https://github.com/agsh/onvif/blob/master/examples/example6.js ? Do you have your own patches on top of that?

I do not

@JahleelAbraham
Copy link
Contributor

Let's take this https://github.com/agsh/onvif/blob/master/examples/example6.js ,

  • tweak to take command line arguments for HOSTNAME, PASSWORD etc
  • make it figure out intelligently EVENT_RECEIVER_IP_ADDRESS, EVENT_RECEIVER_PORT from the host it's running on
  • give it a sensible name and put the changed script into misc/onvif/ alongside getRtspUrls.js and others

And then some frontend magic.

I'll get started working on that 👍🏾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants