-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
DS-PHA20-P support #56
Comments
Can you provide some example with success auth with some provided login credentials? like for |
Sure, Capabilities
Login
And the next capabilities request
|
Took a look at the web interface sources and this seems to be the hash function it uses: _strToAESKey(r.szPassword, r.szUserName) //usage
// definition
_strToAESKey = function(e, a) {
var t = "";
if (self.iKeyIterateNum > 0) {
var s = JSON.parse(_oUtils.decode(_oWebSession.getItem("authInfo"))).cloudCount
, n = _oWebSession.getItem("authType") || $.cookie("authType");
t = "support" !== s || self.oSecurityCap.oIrreversibleEncrypt.cloudSensitiveInfoEncryptType ? "support" === s
&& self.oSecurityCap.oIrreversibleEncrypt.cloudSensitiveInfoEncryptType ? SHA256(getIrreversibleKey(e, a) + "AaBbCcDd1234!@#$") : "3" === n
&& self.oSecurityCap.oIrreversibleEncrypt.bSupport ? SHA256(getIrreversibleKey(e, a) + "AaBbCcDd1234!@#$") : SHA256(e + "AaBbCcDd1234!@#$") : SHA256(e + "AaBbCcDd1234!@#$");
for (var o = 1; self.iKeyIterateNum > o; o++)
t = SHA256(t)
}
return self.szAESKey = t && t.substring(0, 32),
self.szAESKey
}
getIrreversibleKey = function(e, a) {
var t = e;
if (self.oSecurityCap.oIrreversibleEncrypt.bSupport) {
var s = self.oSecurityCap.oIrreversibleEncrypt.salt;
return SHA256(a + s + e)
}
return t
} |
@idealser It seems like I am missing something. Can you check during web init in some request is Also in first I am looking for a way how to detect this authorization and then also how to implement it correctly. |
@petrleocompel Seems like I provided wrong information regarding the code. Those screens could be more useful. I can also provide the js files, containing those methods. Or even provide direct access to the web UI, if it helps. |
It seems to be clear now. Your device is using older auth protocol but still higher hash with irreversibility. I will implement it in core lib. And later try to make beta release of 2.1.0-beta1 |
Beta release was done. you can check if it works. Expect maybe other problems. Feel free to reopen with this device specific problem and logs. |
Got Unexpected error while connecting to the device on 2.1.0-beta1. AX Hub checkbox was enabled.
|
Axhub should not be enabled. |
Without AxHub:
|
@petrleocompel thanks, connected with V2.0.1 beta 2. Still have some troubles on next steps :) Got an error on setup:
|
Seems easy to fix. Tomorrow will do and release v2.1.0-beta3 |
v2.1.0-beta3 was released |
On v2.1.0-beta3
|
Can you try to send {"OutputCond":{"searchID":"homeassistant","searchResultPosition": 0,"maxResults": 50}} Seems like your device version has different way how to get status of relays... |
The URL is correct provided by me. {"searchID":"test","searchResultPosition":1,"maxResults":100} |
My mistake has to be encapsulated, try {"OutputCond":{"searchID":"test","searchResultPosition":1,"maxResults":100}} |
Same error... I found this URL for the relays: {
"ExDevStatus": {
"OutputModList": [
],
"OutputList": [
{
"Output": {
"id": 0,
"name": "Relay 1",
"status": "off",
"tamperEvident": false,
"charge": "normal",
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 1,
"name": "Relay 2",
"status": "off",
"tamperEvident": false,
"charge": "normal",
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 2,
"name": "Relay 3",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 3,
"name": "Relay 4",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 4,
"name": "Relay 5",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 5,
"name": "Relay 6",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 6,
"name": "Relay 7",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 7,
"name": "Relay 8",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 8,
"name": "Relay 9",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 9,
"name": "Relay 10",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 10,
"name": "Relay 11",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 11,
"name": "Relay 12",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 12,
"name": "Relay 13",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 13,
"name": "Relay 14",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 14,
"name": "Relay 15",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 15,
"name": "Relay 16",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 16,
"name": "Relay 17",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 17,
"name": "Relay 18",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 18,
"name": "Relay 19",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
},
{
"Output": {
"id": 19,
"name": "Relay 20",
"status": "notRelated",
"tamperEvident": false,
"linkage": "alarm",
"signal": 0
}
}
],
"SirenList": [
{
"Siren": {
"id": 1,
"name": "Sounder 1",
"status": "off",
"tamperEvident": false,
"sirenAttrib": "wired"
}
},
{
"Siren": {
"id": 2,
"name": "Sounder 2",
"seq": "",
"status": "notRelated",
"tamperEvident": false,
"sirenAttrib": "wireless",
"signal": 0
}
},
{
"Siren": {
"id": 3,
"name": "Sounder 3",
"seq": "",
"status": "notRelated",
"tamperEvident": false,
"sirenAttrib": "wireless",
"signal": 0
}
}
],
"RepeaterList": [
{
"Repeater": {
"id": 1,
"name": "Repeater 1",
"seq": "",
"status": "notRelated",
"tamperEvident": false,
"signal": 0
}
},
{
"Repeater": {
"id": 2,
"name": "Repeater 2",
"seq": "",
"status": "notRelated",
"tamperEvident": false,
"signal": 0
}
}
],
"ExtensionList": [
{
"ExtensionModule": {
"id": 1,
"address": 255,
"type": "wiredOutput",
"status": "online",
"moduleAttrib": "wired"
}
}
],
"KeypadList": [
{
"Keypad": {
"id": 1,
"name": "Keypad 1",
"address": 0,
"status": "online",
"tamperEvident": false,
"keypadAttrib": "wired"
}
}
]
}
} |
That could work, it is grouped. I will try to use it. It is just painful that some methods are working for some devices some are not working 😞 even when it is directly from docs... If you really want to go right a way you can modify the code right now to proceed (before i will make next update) just in your instance in the integration directory modify |
I understand your pain. By the way, where did you find those methods? I couldn't find any documentation about them. And the URL seems to be working, I just don't get which payload does it require. Probably some different naming of the same fields or any other required fields missing... |
It is hidden in Hikvision network documentation |
Seems like latest builds of network SDK does not contain documentation of ISAPI 😮💨 |
But there is a live version of those docs |
I found it for Linux: there are some docs inside in PDF |
Device Network SDK (Security Control)_Developer Guide_V6.1.5.X_20220311.zip |
For now. I will add module type but it is not required... Later will convert all statuses to use |
It's weird but it won't work without it... Maybe some sort of bug in the device's API or an outdated version. |
v2.1.0-beta4 released |
Now it is connected. Parsed all zones and relays. But when I try to set the status to Home or Away it throws me an error:
|
There is going to be a different parameters again :/ |
Initially I tried without it. Thought it would change the situation |
Reinitialized the integration without adding any code:
And tried this payload with empty code and without it: {
"statusCode": 6,
"statusString": "Invalid Content",
"subStatusCode": "badParameters",
"errorCode": 1610612737,
"errorMsg": "badParameters"
} |
I fixed usage of the "relay status methods" in v2.1.0-beta6. Currently thinking about how to workout arm / disarm for |
Thanks, let me know if you need to check anything |
I was checking logs recently and noticed following message during arm/disarm:
Sub status code is lowPrivilege. Could this happen because only admin accounts can execute this request? The one that I use is an operator. |
Acutally yes. That can be the problem. But this really depends on device implementation of ISAPI. You can test it 🤷♂️ |
Unfortunately alarm provider prevents me from using admin account. But I'll try to get the credentials somehow... |
This is exactly what I did :) I believe we could close the issue at this point. I didn't obtain admin credentials to check it yet, but it works in any case through zone. |
You can hide the "main panel" via settings and use the zones. You can create yourself some "template" panel via yaml. If you would later comment here your solution i will add it to "readme" for others. |
Hello, thank you for creating such a powerful integration. Unfortunately, I've not been able to connect with DS-PHA20-P also called AX Hybrid.
I can successfully access it through web interface. However using the same credentials with HACS integrations results an 401 error. Here are the logs from HA (tried to use both AX Hub checkbox enabled and disabled):
When I successfully connect through web interface here are the executed requests:
Request chain seems to be the same for both integration and web interface. Session ID seems to be the same as provided by the capabilities request. But for some reason it could not authorise. Could it be that the password hashing has different algorithm? Does anybody has any ideas why it wouldn't work?
The text was updated successfully, but these errors were encountered: