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()
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.
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:
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
I get it when using:
Code:"events": "VideoMotion,CrossLineDetection"
But not when using:
Code:"events": "VideoMotion"
or
Code:"events": "CrossLineDetection"
Any ideas?
Thanks.
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:
Code:# python3 watch.py
I'm just getting a bunch of this now:
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)
This 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()
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'})
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)
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" }
It seems to work ok:
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
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: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.
self.Index is the index of the config dict (host, port, ...), starting from 0.