pyHik icon indicating copy to clipboard operation
pyHik copied to clipboard

faceSnap sensor support

Open Yevgenium opened this issue 2 years ago • 11 comments

Every time I boot Home Assistant, I get this error: WARNING (SyncWorker_1) [pyhik.hikvision] Sensor type "faceSnap" is unsupported.

I think it has to do with the 'Face Capture' function in the 'VCA Resource': image

Is it possible to make a sensor for this function available in the Home Assistant?

Yevgenium avatar Dec 21 '21 08:12 Yevgenium

It can potentially be added as long as the responses it produces are formatted in the same manner as other events. Can you supply a curl output from your triggers endpoint as well as a snippet from the eventstream containing a "faceSnap" event?

mezz64 avatar Dec 23 '21 19:12 mezz64

I have this error, but new to HikVision - if you can give some instructions on how to get the information you require I am happy to help :)

pete-leese avatar Jan 17 '22 22:01 pete-leese

Sure thing.

Can you run a curl on the expected trigger path and post the output? Change that last flag if you're not using digest auth.

curl http://YOUR_CAM_IP/ISAPI/Event/triggers --digest

This will let you monitor the alertStream, I'd expect the first one to work, but please try both and let me know what the outputs are.

curl --digest -N http://YOUR_CAM_IP/Event/notification/alertStream
or
curl --digest -N http://YOUR_CAM_IP/ISAPI/Event/notification/alertStream

mezz64 avatar Jan 21 '22 16:01 mezz64

This XML file does not appear to have any style information associated with it. The document tree is shown below. <EventTriggerList xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0"> <EventTrigger> <id>VMD-1</id> <eventType>VMD</eventType> <eventDescription>VMD Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList> <EventTriggerNotification> <id>center</id> <notificationMethod>center</notificationMethod> <notificationRecurrence>beginning</notificationRecurrence> </EventTriggerNotification> </EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>tamper-1</id> <eventType>tamperdetection</eventType> <eventDescription>shelteralarm Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList> <EventTriggerNotification> <id>center</id> <notificationMethod>center</notificationMethod> <notificationRecurrence>beginning</notificationRecurrence> </EventTriggerNotification> </EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>diskfull</id> <eventType>diskfull</eventType> <eventDescription>exception Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList> <EventTriggerNotification> <id>center</id> <notificationMethod>center</notificationMethod> <notificationRecurrence>beginning</notificationRecurrence> </EventTriggerNotification> </EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>diskerror</id> <eventType>diskerror</eventType> <eventDescription>exception Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList> <EventTriggerNotification> <id>center</id> <notificationMethod>center</notificationMethod> <notificationRecurrence>beginning</notificationRecurrence> </EventTriggerNotification> </EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>nicbroken</id> <eventType>nicbroken</eventType> <eventDescription>exception Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>ipconflict</id> <eventType>ipconflict</eventType> <eventDescription>exception Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>illaccess</id> <eventType>illaccess</eventType> <eventDescription>exception Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList> <EventTriggerNotification> <id>center</id> <notificationMethod>center</notificationMethod> <notificationRecurrence>beginning</notificationRecurrence> </EventTriggerNotification> </EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>badvideo</id> <eventType>badvideo</eventType> <eventDescription>exception Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList> <EventTriggerNotification> <id>center</id> <notificationMethod>center</notificationMethod> <notificationRecurrence>beginning</notificationRecurrence> </EventTriggerNotification> </EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>storageDetection-1</id> <eventType>storageDetection</eventType> <eventDescription>storageDetection Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>faceSnap-1</id> <eventType>faceSnap</eventType> <eventDescription>faceSnap Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList> <EventTriggerNotification> <id>center</id> <notificationMethod>center</notificationMethod> <notificationRecurrence>beginning</notificationRecurrence> </EventTriggerNotification> </EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>luma-1</id> <eventType>luma</eventType> <eventDescription>luma Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>chroma-1</id> <eventType>chroma</eventType> <eventDescription>chroma Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>snow-1</id> <eventType>snow</eventType> <eventDescription>snow Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>streak-1</id> <eventType>streak</eventType> <eventDescription>streak Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>freeze-1</id> <eventType>freeze</eventType> <eventDescription>freeze Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>sigLose-1</id> <eventType>sigLose</eventType> <eventDescription>sigLose Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>clarity-1</id> <eventType>clarity</eventType> <eventDescription>clarity Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>jitter-1</id> <eventType>jitter</eventType> <eventDescription>jitter Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>block-1</id> <eventType>block</eventType> <eventDescription>block Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>flowers-1</id> <eventType>flowers</eventType> <eventDescription>flowers Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>noise-1</id> <eventType>noise</eventType> <eventDescription>noise Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>ghost-1</id> <eventType>ghost</eventType> <eventDescription>ghost Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>purple-1</id> <eventType>purple</eventType> <eventDescription>purple Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>ICR-1</id> <eventType>ICR</eventType> <eventDescription>ICR Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> <EventTrigger> <id>protectiveFilm-1</id> <eventType>protectiveFilm</eventType> <eventDescription>protectiveFilm Event trigger Information</eventDescription> <videoInputChannelID>1</videoInputChannelID> <dynVideoInputChannelID>1</dynVideoInputChannelID> <EventTriggerNotificationList></EventTriggerNotificationList> </EventTrigger> </EventTriggerList>

EvertJob avatar Jan 21 '22 16:01 EvertJob

Sure thing.

Can you run a curl on the expected trigger path and post the output? Change that last flag if you're not using digest auth.

curl http://YOUR_CAM_IP/ISAPI/Event/triggers --digest

This will let you monitor the alertStream, I'd expect the first one to work, but please try both and let me know what the outputs are.

curl --digest -N http://YOUR_CAM_IP/Event/notification/alertStream
or
curl --digest -N http://YOUR_CAM_IP/ISAPI/Event/notification/alertStream

Ok, got it working:

<EventNotificationAlert version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema"> <ipAddress>192.168.0.195</ipAddress> <ipv6Address>fd26:5592:576:47db:aeb9:2fff:fea8:c2bc</ipv6Address> <portNo>80</portNo> <protocol>HTTP</protocol> <macAddress>ac:b9:2f:a8:c2:bc</macAddress> <channelID>1</channelID> <dateTime>2022-01-21T17:26:55+08:00</dateTime> <activePostCount>1</activePostCount> <eventType>videoloss</eventType> <eventState>inactive</eventState> <eventDescription>videoloss alarm</eventDescription> <channelName>Camera 01</channelName> <Extensions> <serialNumber>DS-2CD2387G2-LU20211012AAWRG82683996</serialNumber> <eventPush>DS-2CD2387G2-LU20211012AAWRG82683996,2022-01-21T17:26:55+08:00,1.0</eventPush> </Extensions> </EventNotificationAlert>

Nothing else is showing up, no motion and no facial identification

EvertJob avatar Jan 21 '22 16:01 EvertJob

The alertStream endpoint should be a continuous stream of data. If faceSnap is what I think it is you should start logging the endpoint and then walk in front of the camera to see if it throws a faceSnap event.

mezz64 avatar Jan 21 '22 20:01 mezz64

No, don’t see anything else exact the line’s I’ve posted above.

Sent from my iPhone

On 21 Jan 2022, at 21:35, mezz64 @.***> wrote:



The alertStream endpoint should be a continuous stream of data. If faceSnap is what I think it is you should start logging the endpoint and then walk in front of the camera to see if it throws a faceSnap event.

— Reply to this email directly, view it on GitHubhttps://github.com/mezz64/pyHik/issues/81#issuecomment-1018840477, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AN3SBV6XJF6LJXTJRYNSOFDUXG7SHANCNFSM5KPTXU4A. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.***>

EvertJob avatar Jan 21 '22 21:01 EvertJob

Can you post the curl command you are using? If you only get that output and then the connection closes when attaching to the alertStream i'm afraid this component isn't going to work for you since we rely on a continuous stream of events from the device to process.

mezz64 avatar Jan 24 '22 16:01 mezz64

Ok,

got something

curl -v 'http://admin:[email protected]/Event/notification/alertStream' --digest -o outputface.txt

When I walk past the camera this is coming up:" outputface.txt

EvertJob avatar Jan 26 '22 09:01 EvertJob

@mezz64 - any update on this? I am seeing the following which I believe is related to this issue:

Logger: pyhik.hikvision Source: /usr/local/lib/python3.9/site-packages/pyhik/hikvision.py:302 First occurred: May 23, 2022, 10:55:54 (4 occurrences) Last logged: May 23, 2022, 10:55:54

Sensor type "faceContrast" is unsupported. Sensor type "faceContrastSuccess" is unsupported.

Symbiot78 avatar May 24 '22 20:05 Symbiot78

Sorry for the slow follow-up on this one, can @EvertJob and @Symbiot78 try out the changes on this branch (https://github.com/mezz64/pyHik/tree/face_sens)? From what I can tell the event log formatting is the same so we should be able to pick these up without issue. Just need someone to test.

mezz64 avatar Oct 27 '22 02:10 mezz64