Amcrest ONVIF events

Current Development version likely to have breaking changes
Post Reply
User avatar
Basildane
Posts: 119
Joined: Mon Sep 16, 2013 1:09 pm

Amcrest ONVIF events

Post by Basildane »

I have 1.37.66 running with Amcrest AI cameras that have ONVIF push events.
I verified with ODM that the camera is sending motion notifications.
The topic I receive is tns1:RuleEngine/CellMotionDetector/Motion.
The data is IsMotion: true.

I have tried various configuration options in my monitor Onvif settings, but I do not receive any motion triggers in zoneminder.
For ONVIF_URL I have http://10.11.0.13/onvif/device_service
For ONVIF_EVENTS_PATH I currently have /Events.
For ONVIF_Alarm_Text I have Motion.

I'm not clear what Zoneminder is expecting for these fields. I'm watching the camera send events to ODM but ZM is doing nothing.
A little help please?

BTW: 1.37 looks like it's going to be great.
User avatar
Basildane
Posts: 119
Joined: Mon Sep 16, 2013 1:09 pm

Re: Amcrest ONVIF events

Post by Basildane »

I tried variations of "tns1:RuleEngine/CellMotionDetector/Motion" for the ONVIF_EVENTS_PATH, but got a SQL error that the field is too long.
User avatar
iconnor
Posts: 3403
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Amcrest ONVIF events

Post by iconnor »

The settings you had work for my amcrest cams.

Path should just be /Events.

Use the ONVIF_Alarm_Text to match the message. THe default of Motion should have worked for you.

TUrn on debug and see what the logs say.
User avatar
Basildane
Posts: 119
Joined: Mon Sep 16, 2013 1:09 pm

Re: Amcrest ONVIF events

Post by Basildane »

Hi!

I turned on LOG_DEBUG. I waited for an Onvif event, then checked the logs. I see nothing regarding Onvif here.
https://paste.aquilatech.com/?cb7c91499 ... rP7VyuggBk
User avatar
Basildane
Posts: 119
Joined: Mon Sep 16, 2013 1:09 pm

Re: Amcrest ONVIF events

Post by Basildane »

My mistake, I missed this.

Code: Select all

2025/07/09 18:49:58	zmc_m4	136313	DB1	AMCREST url is http://10.11.0.13/onvif/device_service/eventManager.cgi?action=attach&codes=[VideoMotion]	zm_monitor_amcrest.cpp	51
User avatar
Basildane
Posts: 119
Joined: Mon Sep 16, 2013 1:09 pm

Re: Amcrest ONVIF events

Post by Basildane »

I set the Alarm Text to "VideoMotion" but still no hits.
User avatar
Basildane
Posts: 119
Joined: Mon Sep 16, 2013 1:09 pm

Re: Amcrest ONVIF events

Post by Basildane »

I cleaned the logs and stopped everything and did a full test to capture what I could.
At 17:23:45 I got a detection from the camera. Here is the full log. Zoneminder did nothing with this.

What am I doing wrong please?

Code: Select all

07/10/25 17:23:44.627836 zmc_m4[523326].DB1-zm_monitor_amcrest.cpp/51 [AMCREST url is http://10.11.0.13/onvif/device_service/eventManager.cgi?action=attach&codes=[VideoMotion]]
07/10/25 17:23:45.818127 zmc_m4[523326].DB1-zm_monitor_amcrest.cpp/76 [AMCREST response code 0, response ]
07/10/25 17:23:45.822736 zmc_m4[523326].DB1-zm_monitor_amcrest.cpp/87 [AMCREST Healthy]
User avatar
Basildane
Posts: 119
Joined: Mon Sep 16, 2013 1:09 pm

Re: Amcrest ONVIF events

Post by Basildane »

Code: Select all

<s:Envelope
    xmlns:sc="http://www.w3.org/2003/05/soap-encoding"
    xmlns:s="http://www.w3.org/2003/05/soap-envelope"
    xmlns:tt="http://www.onvif.org/ver10/schema"
    xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
    xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
    xmlns:wsa5="http://www.w3.org/2005/08/addressing"
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
    xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"
    xmlns:tns1="http://www.onvif.org/ver10/topics">
    <s:Header>
        <wsa5:Action>
            http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesResponse
            </wsa5:Action>
        <wsa5:To>
            http://10.11.0.13/onvif/Subscription?Idx=9
            </wsa5:To>
        </s:Header>
    <s:Body>
        <tev:PullMessagesResponse>
            <tev:CurrentTime>
                2025-07-10T22:04:37Z
                </tev:CurrentTime>
            <tev:TerminationTime>
                2025-07-10T22:05:47Z
                </tev:TerminationTime>
            <wsnt:NotificationMessage>
                <wsnt:Topic
                    Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">
                    tns1:RuleEngine/CellMotionDetector/Motion
                    </wsnt:Topic>
                <wsnt:Message>
                    <tt:Message
                        UtcTime="2025-07-10T22:04:37Z"
                        PropertyOperation="Changed">
                        <tt:Source>
                            <tt:SimpleItem
                                Name="VideoSourceConfigurationToken"
                                Value="00000"/>
                            <tt:SimpleItem
                                Name="VideoAnalyticsConfigurationToken"
                                Value="00000"/>
                            <tt:SimpleItem
                                Name="Rule"
                                Value="00000"/>
                            </tt:Source>
                        <tt:Data>
                            <tt:SimpleItem
                                Name="IsMotion"
                                Value="true"/>
                            </tt:Data>
                        </tt:Message>
                    </wsnt:Message>
                </wsnt:NotificationMessage>
            <wsnt:NotificationMessage>
                <wsnt:Topic
                    Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">
                    tns1:VideoSource/MotionAlarm
                    </wsnt:Topic>
                <wsnt:Message>
                    <tt:Message
                        UtcTime="2025-07-10T22:04:37Z"
                        PropertyOperation="Changed">
                        <tt:Source>
                            <tt:SimpleItem
                                Name="Source"
                                Value="00000"/>
                            </tt:Source>
                        <tt:Data>
                            <tt:SimpleItem
                                Name="State"
                                Value="true"/>
                            </tt:Data>
                        </tt:Message>
                    </wsnt:Message>
                </wsnt:NotificationMessage>
            </tev:PullMessagesResponse>
        </s:Body>
    </s:Envelope>
User avatar
Basildane
Posts: 119
Joined: Mon Sep 16, 2013 1:09 pm

Re: Amcrest ONVIF events

Post by Basildane »

OK, in desperation, I ran wireshark on both Zoneminder and ODM.

ODM is sending requests like this:

Code: Select all

http://10.11.0.13/onvif/Subscription?Idx=11
to subscribe to events. This works.

Zoneminder is repeatedly sending this:

Code: Select all

http://10.11.0.13/onvif/device_service/eventManager.cgi?action=attach&codes=[VideoMotion]
Every 10 seconds, and getting no response from the camera.
User avatar
Basildane
Posts: 119
Joined: Mon Sep 16, 2013 1:09 pm

[Solved] Re: Amcrest ONVIF events

Post by Basildane »

Setting use_Amcrest_API to false, I started getting Onvif events.
PencilGeek
Posts: 15
Joined: Wed May 28, 2025 2:45 pm

Re: [Solved] Re: Amcrest ONVIF events

Post by PencilGeek »

Basildane wrote: Fri Jul 11, 2025 3:53 pm Setting use_Amcrest_API to false, I started getting Onvif events.
I spent a fair amount of time yesterday playing with this. I'm getting a bunch of errors with my Amcrest camera.

Code: Select all

ONVIF Couldn't create subscription at http://10.1.6.15/onvif/device_service/Events! 12, fault:Wsse authorized time check failed., detail:null
Could you please post all off your ONVIF settings in ZM? In another thread, another person speculated that you would need to create a different (non-admin) user before ONVIF would work. So knowing your settings would be helpful.

Also, how are you using ODM to test this? Other than basic status screens in ODM, I don't see anywhere that I can actually test ONVIF.

As an aside topic, but kind of related. Since I never had ONVIF working, I have (what appears to be) a fully functioning python script that queries all of my cameras periodically, captures the event types, an triggers ZM. I think I have the last bugs worked out of it. It is currently handling 10 cameras and allows you to cross-trigger from one camera to another to obtain better perspective of coverage (e.g. front yard, street, etc.) when needed.
User avatar
iconnor
Posts: 3403
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Amcrest ONVIF events

Post by iconnor »

THe Amcrest_API thing is entirely separate from ONVIF. It is an entirely different API. I need to get aroudn to removing it from the ONVIF page.

I also see no purpose in using it if ONVIF works.
User avatar
Basildane
Posts: 119
Joined: Mon Sep 16, 2013 1:09 pm

Re: [Solved] Re: Amcrest ONVIF events

Post by Basildane »

PencilGeek wrote: Fri Jul 11, 2025 5:44 pm Could you please post all off your ONVIF settings in ZM?
I have been testing with these two cameras.

Code: Select all

Model: Amcrest IP8M-DLB2998EW-AI
ONVIF_URL: http://10.11.0.13/onvif/device_service
ONVIF_EVENTS_PATH: /Events
ONVIF_Alarm_Text: Motion
The second one is

Code: Select all

Model: GW Security GW-5061IP
ONVIF_URL: http://10.11.0.11/onvif/device_service
ONVIF_EVENTS_PATH: /Events
ONVIF_Alarm_Text: Motion
Once I realized that I need to turn off Amcrest_API, then it started working.
I'm still working on the cameras to try and get them to be reliable. The GW is triggering every time the wind blows.
And I have to wait until night tonight to verify everything is working. I read that some amcrest cameras don't do Onvif at night. I will be testing all night.

My new Amcrest replaces a Grandstream that got hit by lightning 3 weeks ago. This is my 3rd camera replacement and 1 network switch that have been hit by lightning in 20 years. I installed lightning arrestors a few years ago, no network damage this time, but the GS camera was fried.
PencilGeek
Posts: 15
Joined: Wed May 28, 2025 2:45 pm

Re: [Solved] Re: Amcrest ONVIF events

Post by PencilGeek »

Basildane wrote: Fri Jul 11, 2025 9:27 pm
PencilGeek wrote: Fri Jul 11, 2025 5:44 pm Could you please post all off your ONVIF settings in ZM?
I have been testing with these two cameras.

Code: Select all

Model: Amcrest IP8M-DLB2998EW-AI
ONVIF_URL: http://10.11.0.13/onvif/device_service
ONVIF_EVENTS_PATH: /Events
ONVIF_Alarm_Text: Motion
The second one is

Code: Select all

Model: GW Security GW-5061IP
ONVIF_URL: http://10.11.0.11/onvif/device_service
ONVIF_EVENTS_PATH: /Events
ONVIF_Alarm_Text: Motion
Once I realized that I need to turn off Amcrest_API, then it started working.
I'm still working on the cameras to try and get them to be reliable. The GW is triggering every time the wind blows.
And I have to wait until night tonight to verify everything is working. I read that some amcrest cameras don't do Onvif at night. I will be testing all night.

My new Amcrest replaces a Grandstream that got hit by lightning 3 weeks ago. This is my 3rd camera replacement and 1 network switch that have been hit by lightning in 20 years. I installed lightning arrestors a few years ago, no network damage this time, but the GS camera was fried.
I've got the same Amcrest cameras. I'm getting that timestamp mismatch error I cited above. My TZ on the computer is the same TZ as ZoneMinder, yet I'm getting this timestamp mismatch. I also checked the timestamp in the log against the timestamp reported by the camera (the 175... number below), and they match. So I'm at a loss why this is reporting this problem.

Code: Select all

07/11/25 14:12:36.259864 zmc_m5[337118].ERR-zm_monitor_onvif.cpp/109 [ONVIF Couldn't create subscription at http://10.1.6.15/onvif/device_service/Events! 12, fault:Wsse authorized time check failed., detail:null]
07/11/25 14:12:36.261094 zmc_m5[337048].DB1-zm_db.cpp/223 [Success running sql query INSERT INTO `Logs` ( `TimeKey`, `Component`, `ServerId`, `Pid`, `Level`, `Code`, `Message`, `File`, `Line` ) VALUES ( 1752268356.259864, 'zmc_m5', 0, 337118, -2, 'ERR', 'ONVIF Couldn\'t create subscription at http://10.1.6.15/onvif/
User avatar
Basildane
Posts: 119
Joined: Mon Sep 16, 2013 1:09 pm

Re: Amcrest ONVIF events

Post by Basildane »

My amcrest is working great, but the GW keeps locking on ALERT and gets stuck.

Code: Select all

zmc_m1	589677	ERR	Failed to get ONVIF messages! 28 Connection refused
Post Reply