Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for intelbras SS 3540 MF FACE EX (Dahua ASI6213J-MW) Face recognition Acess Control #296

Open
lleonardos opened this issue Aug 12, 2023 · 2 comments

Comments

@lleonardos
Copy link

lleonardos commented Aug 12, 2023

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Im trying to Add my FaceRecognition Acess control to homeassistant, is a White label from dahua and uses the same API from what i have seen in the codes. I can add the device using the dahua integration, it recognizes as:

Device info
SS 3540 MF FACE EX
by Dahua
Firmware: 2.000.00IB007.0.R,build:2023-02-23,
but i only get the motions events in devicelog, i can turn on the lights , and unlock the door via call service.
Serial Number starts with YP4L

Describe the solution you'd like
A clear and concise description of what you want to happen.

When i call the API in python using digest Auth i get the folling response of event:

b'--myboundary'
b'Content-Type: text/plain'
b'Content-Length:67'
b''
b'Code=KeepLightOn;action=Pulse;index=0;data={'
b'   "Status" : "Off"'
b'}'
b''
{}
b''
b'--myboundary'
b'Content-Type: text/plain'
b'Content-Length:37'
b''
{}
b'Code=VideoMotion;action=Start;index=0'
b''
b'--myboundary'
b'Content-Type: text/plain'
b'Content-Length:133'
b''
{}
b'Code=_EncodePartSnap_;action=Pulse;index=0;data={'
b'   "Path" : "\\/var\\/tmp\\/partsnap3.jpg",'
b'   "PathBig" : "",'
b'   "Sequence" : 3051'
b'}'
b''
b''
{}
b'--myboundary'
b'Content-Type: text/plain'
b'Content-Length:226'
b''
b'Code=_DoorFace_;action=Pulse;index=0;data={'
b'   "Alive" : 100,'
b'   "Door" : 0,'
b'   "FeatureId" : 1,'
b'   "OpenDoorMethod" : 3,'
b'   "Similarity" : 99,'
b'   "SnapPath" : "\\/var\\/tmp\\/partsnap3.jpg",'
b'   "UserID" : "1",'
b'   "readID" : 1'
b'}'
b''
{}
b''
b'--myboundary'
b'Content-Type: text/plain'
b'Content-Length:194'
b''
{}
b'Code=_NewFile_;action=Pulse;index=0;data={'
b'   "File" : "\\/mnt\\/appdata1\\/userpic\\/SnapShot\\/2023-08-12\\/14\\/48\\/1_99_100_20230812144816459.jpg",'
b'   "Size" : 10957,'
b'   "StartTime" : 1691862496'
b'}'
b''
b''
{}
b'--myboundary'
b'Content-Type: text/plain'


And i would like to pass those attributes to HA,

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

the logs:

2023-08-12 14:12:38.848 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.1.141 on channel 0: [{'Code': 'VideoMotion', 'action': 'Start', 'index': '0'}]
2023-08-12 14:12:43.723 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.1.141 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '0'}]
2023-08-12 14:12:48.420 DEBUG (MainThread) [custom_components.dahua] ClientError fetching information from http://192.168.1.141:80/cgi-bin/configManager.cgi?action=getConfig&name=DisableLinkage

an example of the device response in the device documentation:

--myboundary
Content-Type: text/plain
Content-Length:315
 
Code=AccessControl;action=Pulse;index=0;data={
   "CardName" : "",
   "CardNo" : "12EA3004",
   "CardType" : 0,
   "CreateTime" : 1629721071,
   "Door" : 0,
   "ErrorCode" : 0,
   "Method" : 1,
   "ReaderID" : "1",
   "Status" : 1,
   "Type" : "Entry",
   "UTC" : 1629721071,
   "UserID" : "1",
   "UserType" : 0
}
 
--myboundary
Content-Type: text/plain
Content-Length:85
Code=BreakIn;action=Pulse;index=0;data={
"Name" : "SS-1",
"UTC" : 1598250815
}
 
--myboundary
Content-Type: text/plain
Content-Length:91
Code=DoorNotClosed;action=Start;index=0;data={
"Name" : "SS-1",
"UTC" : 1598250817
}
 
Code=_Button_;action=Pulse;index=0;data={
"Local" : true,
"ReaderID" : "1",
"Type" : "Button"
}

avaible at https://intelbras-caco-api.intelbras.com.br/obtendo_eventos/eventManager

any help is aprecciated as this would add support for alot of future face recognition acess control devices made by dahua

@lleonardos
Copy link
Author

i think is related to #166

@lleonardos
Copy link
Author

lleonardos commented Aug 23, 2023

i can confirm that doing what was said in #166 allowed me to view full event info.
"BTW, you can try this locally.."
Edit this file - https://github.com/rroller/dahua/blob/main/custom_components/dahua/client.py#L608

Change codes = ",".join(events) to codes = "All"

event_type: dahua_event_received data: Code: AccessControl action: Pulse index: "0" data: CardName: Lorenzo CardNo: 9B70E0EC CardType: 0 CreateTime: 1692757097 Door: 0 ErrorCode: 0 Method: 1 ReaderID: "1" Status: 1 Type: Entry UTC: 1692757097 UserID: "1" UserType: 0 name: YP4L180xxx DeviceName: YP4L180xxx origin: LOCAL time_fired: "2023-08-23T02:18:17.775297+00:00" context: id: 01H8G2YZ9FV11X5H4YK2WAVR3X parent_id: null user_id: null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant