Another Python server/script that forwards alerts from cameras.

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
User6677
Posts: 17
Joined: Sat Dec 24, 2022 9:32 am

Another Python server/script that forwards alerts from cameras.

Post by User6677 »

This is for 1.36 users (as 1.37 has onvif triggering built in I believe).

This script will connect to a number of cameras via onvif PullPoint (please note, some cameras support PullPoint, but some support only BaseSubscription, for these this will not work). The script doesn't "just" pass everything to ZM. It has a setting to delay cancellation of a motion alarm if its cancellation came very quickly after triggering. Some cameras (like ones I have) will send a string of alert..alert off...alert...alert off... and so on, for the duration of the movement. This feature is to resolve this and make it into one long alert. Also the script doesn't pass events if one is already ongoing for a monitor.

I've been running it for a couple of days now and it is working fine so I decided to share here. It needs a config file like this:

Code: Select all

zmtriggerhost: "127.0.0.1"
zmtriggerport: 6802
logpath: "/var/log/zm/onvifserver.txt"
log_file_size_limit: 2048576  # Example size in bytes
max_threads: 20
monitors:
 Yard:
    ip: '192.168.1.121'
    username: 'admin'
    password: 'password'
    port: 80
    id: 1
    expiry: 65
    note: "This is a note for monitor2."
 TheBorder:
    ip: '192.168.1.202'
    username: 'admin'
    password: 'password'
    port: 80
    id: 8
    expiry: 65
    note: "This is a note for monitor2."
It requires PyYaml and zeep to be installed as well as zmtrigger to run. The script is attached.
Attachments
onvifserv.zip
(2.99 KiB) Downloaded 10 times
Post Reply