i’m getting this json from camera events,
I’d like to build a sensor which later can use for automation.
the event publish in camera{id}/topic with below json:
"code": "CrossLineDetection",
"action": "Stop",
"index": "0",
"data": {
"Class": "Normal",
"CountInGroup": 1,
"DetectLine": [
[
8023,
7872
],
[
3530,
7872
]
],
"Direction": "RightToLeft",
"EventSeq": 41,
"Extension": {
"EventLongID": "340200000013200000010220190922233606015959900000"
},
"FrameSequence": 49271442,
"GroupID": 41,
"IndexInGroup": 0,
"Mark": 0,
"Name": "Rule 3",
"Object": {
"Action": "Appear",
"BoundingBox": [
4560,
7872,
5504,
8000
],
"Center": [
5032,
7936
],
"Confidence": 0,
"FrameSequence": 0,
"LowerBodyColor": [
0,
0,
0,
0
],
"MainColor": [
0,
0,
0,
0
],
"ObjectID": 3953,
"ObjectType": "Human",
"RelativeID": 0,
"Source": 0,
"Speed": 0,
"SpeedTypeInternal": 0
},
"PTS": 43933175900,
"RuleId": 3,
"Sequence": 0,
"Source": 27304392,
"Track": null,
"UTC": 1569195366,
"UTCMS": 671
}
}
Im not sure this can done through templates/external py script,
But i guess there are many creative people here ,
so can I create generic sensor or multiple sensor which based on
the values from above json?
for attribute --> Name : Rule 2 (it can be Rule 1/2…4)
And **Direction : LeftToRight ** (it can be also RightToLeft)
It also can be combination of those 2…
it could be awesome also using the ObjectType (which can if this event trigger by human or something else ) - but for now it less important .
What would be best approach for implementing this without
adding 4 different sensors?
case it possible ,
How can i extract those values and assign logic which describe the sensor state?
i.e if rule 1 trigger with RightToLeft - can ignore it ,
but if it would be LeftToRight - it trigger the alarm.
Thanks for the helpers!