Live VideoMotion API from Dahua NVR

eporedieis

n3wb
Joined
Mar 23, 2018
Messages
5
Reaction score
0
Hello to all, I'm new on this forum. I've a Dahua NVR and I want to control from Home Assistant VideoMotion from each cameras. I seen that you all are using cameras connected to the router to obtain this information, but I found an API that's perfect for the use from HA or any other distro.

I've only a problem: I'm not a programmer. I'm only a noob.

The link is this one:
http://localip.address/cgi-bin/eventManager.cgi?action=getEventIndexes&code=VideoMotion

When there's no motion, the file is empty. When there's motions, the file looks like this:
channels[0]=4
channels[1]=1
channels[2]=3
This code means that the first that found a VideoMotion was the camera n. 4, then the n. 1 and finally the n. 3. I think a have to create in HA a binary sensor to control if the camera n. 6 (example) is in the link of the VideoMotion.

I tried to write something but it's not correct (
curl http://localip.address/cgi-bin/eventManager.cgi?action=getEventIndexes&code=VideoMotion?loginuse=USR&loginpas=PSS | grep -Eoi “channels\[.\]=(.+)” | cut -c"12-13")
, and I don't know how to write it. I read that many of you love Domoticz: if you write something for this distro, I'll be happy to try to transform it for HA users.

Thank you all!
 

eporedieis

n3wb
Joined
Mar 23, 2018
Messages
5
Reaction score
0
I tried, but it doesn't work the api used from the component for me. But I'm going off topic, so I opened a new thread so I can tell more about the problem: link.
Thank you!!
 
Top