hmjgriffon
Known around here
Can it be done? I've looked all over the web interface and it doesn't look like I can send a trigger to BI if I set up a trip wire on the camera.
I'll use the BI stuff then.no, only recorders that recognize IVS is Dahuas
VideoMotion
CrossLineDetection,CrossRegionDetection,LeftDetection,SceneChange,TakenAwayDetection,FaceDetection,RioterDetection,MoveDetection,WanderDetection,CrossFenceDetection,ParkingDetection,NumberStat,RetrogradeDetection,TrafficJunction
VideoBlind
AudioAnomaly,AudioMutation
VideoAbnormalDetection,SceneChange
LoginFailure
"events": "VideoMotion,VideoBlind,VideoAbnormalDetection,SceneChange,CrossLineDetection,CrossRegionDetection,LeftDetection,SceneChange,TakenAwayDetection,FaceDetection,RioterDetection,MoveDetection,WanderDetection,CrossFenceDetection,ParkingDetection,NumberStat,RetrogradeDetection,TrafficJunction"
python watch.py
[0] OnConnect()
[0] ParseAlarm({'Code': 'CrossLineDetection', 'action': 'Start', 'index': '0'})
[0] Alarm triggered! -> ON
[0] StartPlayer()
I have Blue iris setup in a lab environment waiting on some starlights. In the mean time, I have been playing with a Hikvision DS-2CD2042WDI and have the Hik IVS line crossing / intrusion detection working with a blue iris. Really hoping it will also work with Dahua's.Can it be done? I've looked all over the web interface and it doesn't look like I can send a trigger to BI if I set up a trip wire on the camera.
Are you still using this code? I'm getting this error:Because nobody writes documentation
Available events:
Source: Alarm tab of camera webui + F12/inspect -> networkCode:VideoMotion CrossLineDetection,CrossRegionDetection,LeftDetection,SceneChange,TakenAwayDetection,FaceDetection,RioterDetection,MoveDetection,WanderDetection,CrossFenceDetection,ParkingDetection,NumberStat,RetrogradeDetection,TrafficJunction VideoBlind AudioAnomaly,AudioMutation VideoAbnormalDetection,SceneChange LoginFailure
Example script to watch cameras on event: https://i.botox.bz/watch.py
Just add the additional ones to the event line if you use those.
for example:You can adapt that script to then trigger the BlueIris record event for that camera.Code:"events": "VideoMotion,VideoBlind,VideoAbnormalDetection,SceneChange,CrossLineDetection,CrossRegionDetection,LeftDetection,SceneChange,TakenAwayDetection,FaceDetection,RioterDetection,MoveDetection,WanderDetection,CrossFenceDetection,ParkingDetection,NumberStat,RetrogradeDetection,TrafficJunction"
I don't have BlueIris so ¯\_(ツ)_/¯ but I did read that it has a JSON API which can do just that.
Example output:
Code:python watch.py [0] OnConnect() [0] ParseAlarm({'Code': 'CrossLineDetection', 'action': 'Start', 'index': '0'}) [0] Alarm triggered! -> ON [0] StartPlayer()
Traceback (most recent call last):
File "watch.py", line 217, in <module>
Master.Run()
File "watch.py", line 187, in Run
Camera = next(filter(lambda x: x.CurlObj == CurlObj, self.Cameras))
TypeError: list object is not an iterator
"events": "VideoMotion,CrossLineDetection"
"events": "VideoMotion"
"events": "CrossLineDetection"
Are you using python2 maybe?Are you still using this code? I'm getting this error:
I get it when using:Code:Traceback (most recent call last): File "watch.py", line 217, in <module> Master.Run() File "watch.py", line 187, in Run Camera = next(filter(lambda x: x.CurlObj == CurlObj, self.Cameras)) TypeError: list object is not an iterator
But not when using:Code:"events": "VideoMotion,CrossLineDetection"
orCode:"events": "VideoMotion"
Any ideas?Code:"events": "CrossLineDetection"
Thanks.
This seems to have helped:Are you using python2 maybe?
This script needs python3.
Can't explain the error otherwise, looks unrelated.
# python3 watch.py
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
[1] OnDisconnect(Success)
[0] OnDisconnect(Success)
This means that the camera closed the connection.This seems to have helped:
I'm just getting a bunch of this now:Code:# python3 watch.py
Code:[1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success) [1] OnDisconnect(Success) [0] OnDisconnect(Success)
It worked pretty good before if I just had VideoMotion in there (but failed if I hadThis means that the camera closed the connection.
Wrong username/password maybe? Try the same request in your browser.
Or maybe your camera isn't using DIGEST auth? CurlObj.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_DIGEST)
#python watch.py
[0] OnConnect()
[0] ParseAlarm({u'action': u'Start', u'index': u'0', u'Code': u'VideoMotion'})
Motion Detected
[0] ParseAlarm({u'action': u'Stop', u'index': u'0', u'Code': u'VideoMotion'})
Motion Stopped
{
"host": "10.0.0.61",
"port": 80,
"user": "toot",
"pass": "gas",
"events": "VideoMotion"
},
{
"host": "10.0.0.61",
"port": 80,
"user": "toot",
"pass": "gas",
"events": "CrossLineDetection"
}
# python watch.py
[0] OnConnect()
[1] OnConnect()
[0] ParseAlarm({u'action': u'Start', u'index': u'0', u'Code': u'VideoMotion'})
Motion Detected
[1] ParseAlarm({u'action': u'Start', u'index': u'0', u'Code': u'CrossLineDetection'})
Motion Detected
[1] ParseAlarm({u'action': u'Stop', u'index': u'0', u'Code': u'CrossLineDetection'})
Motion Stopped
[0] ParseAlarm({u'action': u'Stop', u'index': u'0', u'Code': u'VideoMotion'})
Motion Stopped
def OnAlarm(self, State):
#print("[{0}] Alarm triggered! -> {1}".format(self.Index, "ON" if State else "OFF"))
if State:
#self.StartPlayer()
print("Motion Detected")
urllib2.urlopen("http://localhost:8080/CMD?Middle1=ON").read()
else:
#self.StopPlayer()
print("Motion Stopped")
urllib2.urlopen("http://localhost:8080/CMD?Middle1=OFF").read()
Just now. It just keeps asking for the name and password so I tried http://name:password@10.0.0.61/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion,CrossLineDetection] and that does the same thing.Have you tried visiting http://10.0.0.61/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion,CrossLineDetection] in your browser?
[1] ParseAlarm({u'action': u'Start', u'index': u'0', u'Code': u'CrossLineDetection'})
[1] ParseAlarm({u'action': u'Stop', u'index': u'0', u'Code': u'CrossLineDetection'})
I managed to get it working and talking to HomeAssistant via MQTT. IVS detection seems much more reliable than motion, but I still seem to get false positives. Maybe I don't have IVS set up correctly. Is there a guide for the 5231 anywhere?Anyone tried this with HomeAssistant?
It worked pretty good before if I just had VideoMotion in there (but failed if I had
"events": "VideoMotion,CrossLineDetection")
Code:#python watch.py [0] OnConnect() [0] ParseAlarm({u'action': u'Start', u'index': u'0', u'Code': u'VideoMotion'}) Motion Detected [0] ParseAlarm({u'action': u'Stop', u'index': u'0', u'Code': u'VideoMotion'}) Motion Stopped
Now, if I do this: (not using python3 watch.py)
It seems to work ok:Code:{ "host": "10.0.0.61", "port": 80, "user": "toot", "pass": "gas", "events": "VideoMotion" }, { "host": "10.0.0.61", "port": 80, "user": "toot", "pass": "gas", "events": "CrossLineDetection" }
I don't use BI, I have my own NVR. I'm using this to tell Openhab that there is movement on one of the cameras.Code:# python watch.py [0] OnConnect() [1] OnConnect() [0] ParseAlarm({u'action': u'Start', u'index': u'0', u'Code': u'VideoMotion'}) Motion Detected [1] ParseAlarm({u'action': u'Start', u'index': u'0', u'Code': u'CrossLineDetection'}) Motion Detected [1] ParseAlarm({u'action': u'Stop', u'index': u'0', u'Code': u'CrossLineDetection'}) Motion Stopped [0] ParseAlarm({u'action': u'Stop', u'index': u'0', u'Code': u'VideoMotion'}) Motion Stopped
Code:def OnAlarm(self, State): #print("[{0}] Alarm triggered! -> {1}".format(self.Index, "ON" if State else "OFF")) if State: #self.StartPlayer() print("Motion Detected") urllib2.urlopen("http://localhost:8080/CMD?Middle1=ON").read() else: #self.StopPlayer() print("Motion Stopped") urllib2.urlopen("http://localhost:8080/CMD?Middle1=OFF").read()
self.Index is the index of the config dict (host, port, ...), starting from 0.I'm terrible with python and programming in general. With multiple cameras, do you have any ideas how to distinguish which camera is sending the event? I'm sure it is something to do with index number of the cameras array (0, 1, 2, etc.). I'm just not sure how to do it.
Thanks. I got that but was having trouble figuring out how to insert it into my MQTT url. I figured it out just now and it works great!self.Index is the index of the config dict (host, port, ...), starting from 0.