petrleocompel / hikaxpro_hacs

HACS repository of Hikvision Ax Pro integration for home assistant
MIT License
40 stars 4 forks source link

DS-PHA20-P support #56

Closed idealser closed 1 year ago

idealser commented 1 year ago

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):

Use internal API lib (AXHub) enabled


2023-07-31 18:32:45.842 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] Session_Capabilities response
2023-07-31 18:32:45.842 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] Status: 200
2023-07-31 18:32:45.842 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] Content: b'<SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">\n<sessionID>c346a2ca7e30117b4f4be40b082dba364ef7be7dbd71c0dd34b565c111a4e41d</sessionID>\n<challenge>28e9f281d2faa796ec0f622e04b0c1fd</challenge>\n<iterations>100</iterations>\n<isIrreversible>true</isIrreversible>\n<sessionIDVersion>2</sessionIDVersion>\n<salt>1af4fa93346bb3d96f50b4195ac8b14cc4634b01781a3fb923c0533ff1c1defc</salt>\n</SessionLoginCap>\n'
2023-07-31 18:32:45.842 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] Text: <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>c346a2ca7e30117b4f4be40b082dba364ef7be7dbd71c0dd34b565c111a4e41d</sessionID>
<challenge>28e9f281d2faa796ec0f622e04b0c1fd</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>1af4fa93346bb3d96f50b4195ac8b14cc4634b01781a3fb923c0533ff1c1defc</salt>
</SessionLoginCap>

2023-07-31 18:32:45.842 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] Headers: {'Date': 'Mon, 31 Jul 2023 20:32:43 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '428', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99'} 2023-07-31 18:32:45.842 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] End Session_Capabilities response 2023-07-31 18:32:45.843 WARNING (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] Debug data

c346a2ca7e30117b4f4be40b082dba364ef7be7dbd71c0dd34b565c111a4e41d 28e9f281d2faa796ec0f622e04b0c1fd 100 true 2 1af4fa93346bb3d96f50b4195ac8b14cc4634b01781a3fb923c0533ff1c1defc

2023-07-31 18:32:46.015 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] Connect response 2023-07-31 18:32:46.015 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] Status: 401 2023-07-31 18:32:46.015 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] Content: b'<?xml version="1.0" encoding="UTF-8" ?>\n\n401\nUnauthorized\nfalse\nc346a2ca7e30117b4f4be40b082dba364ef7be7dbd71c0dd34b565c111a4e41d\nunlock\n0\n3\n' 2023-07-31 18:32:46.015 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] Text: <?xml version="1.0" encoding="UTF-8" ?>

401 Unauthorized false c346a2ca7e30117b4f4be40b082dba364ef7be7dbd71c0dd34b565c111a4e41d unlock 0 3

2023-07-31 18:32:46.015 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] Headers: {'Date': 'Mon, 31 Jul 2023 20:32:43 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '358', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99', 'WWW-Authenticate': 'Digest realm="DVRNVRDVS", domain="::", qop="auth", nonce="0674b6eb6b72cfb4e4c68cd580778bf5bceb406cb2541d9ddce584b137700433::ada73907:DVRNVRDVS:1690835564807", opaque="", algorithm="MD5", stale="false", Basic realm="DVRNVRDVS"'} 2023-07-31 18:32:46.015 DEBUG (SyncWorker_7) [custom_components.hikvision_axpro.hikax.hikax] End connect response


> Use internal API lib (AXHub) disabled

2023-07-31 18:01:50.543 DEBUG (SyncWorker_0) [hikaxpro] Session_Capabilities response 2023-07-31 18:01:50.543 DEBUG (SyncWorker_0) [hikaxpro] Status: 200 2023-07-31 18:01:50.543 DEBUG (SyncWorker_0) [hikaxpro] Content: b'\n4bdf543ac123ec9dc8944c524aa10ec4929437ae363da9b4c1cc817ca3681d4b\n41fc1314295e4ee7f32c960f85ba48c7\n100\ntrue\n2\n91a9e85159d8d3f44d9c5ca4b40b5d772dbb75ba14995cfced3126e257e4da13\n\n' 2023-07-31 18:01:50.544 DEBUG (SyncWorker_0) [hikaxpro] Text:

4bdf543ac123ec9dc8944c524aa10ec4929437ae363da9b4c1cc817ca3681d4b 41fc1314295e4ee7f32c960f85ba48c7 100 true 2 91a9e85159d8d3f44d9c5ca4b40b5d772dbb75ba14995cfced3126e257e4da13

2023-07-31 18:01:50.544 DEBUG (SyncWorker_0) [hikaxpro] Headers: {'Date': 'Mon, 31 Jul 2023 20:01:49 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '428', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99'} 2023-07-31 18:01:50.544 DEBUG (SyncWorker_0) [hikaxpro] End Session_Capabilities response 2023-07-31 18:01:50.544 DEBUG (SyncWorker_0) [hikaxpro] Debug data

4bdf543ac123ec9dc8944c524aa10ec4929437ae363da9b4c1cc817ca3681d4b 41fc1314295e4ee7f32c960f85ba48c7 100 true 2 91a9e85159d8d3f44d9c5ca4b40b5d772dbb75ba14995cfced3126e257e4da13

2023-07-31 18:01:50.714 DEBUG (SyncWorker_0) [hikaxpro] Connect response 2023-07-31 18:01:50.714 DEBUG (SyncWorker_0) [hikaxpro] Status: 401 2023-07-31 18:01:50.714 DEBUG (SyncWorker_0) [hikaxpro] Content: b'<?xml version="1.0" encoding="UTF-8" ?>\n\n401\nUnauthorized\nfalse\n4bdf543ac123ec9dc8944c524aa10ec4929437ae363da9b4c1cc817ca3681d4b\nunlock\n0\n4\n' 2023-07-31 18:01:50.714 DEBUG (SyncWorker_0) [hikaxpro] Text: <?xml version="1.0" encoding="UTF-8" ?>

401 Unauthorized false 4bdf543ac123ec9dc8944c524aa10ec4929437ae363da9b4c1cc817ca3681d4b unlock 0 4

2023-07-31 18:01:50.714 DEBUG (SyncWorker_0) [hikaxpro] Headers: {'Date': 'Mon, 31 Jul 2023 20:01:49 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '358', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99', 'WWW-Authenticate': 'Digest realm="DVRNVRDVS", domain="::", qop="auth", nonce="0674b6eb6b72cfb4e4c68cd580778bf5bceb406cb2541d9ddce584b137700433::ad8aea38:DVRNVRDVS:1690833709624", opaque="", algorithm="MD5", stale="false", Basic realm="DVRNVRDVS"'} 2023-07-31 18:01:50.714 DEBUG (SyncWorker_0) [hikaxpro] End connect response


When I successfully connect through web interface here are the executed requests:

> capabilities request

curl 'http://admin:password@10.0.10.10/ISAPI/Security/sessionLogin/capabilities?username=admin&random=36759723' \ -H 'Accept: /' \ -H 'Accept-Language: en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7,ro;q=0.6' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Cookie: dispatch=null; passwordLength=16; language=en; authType=3; WebSession_f49ee536a4=23533c6723b3cd488ff3c908358b655b9933a3709309949ebb65b441bc06d988; WebSession=null' \ -H 'If-Modified-Since: 0' \ -H 'Pragma: no-cache' \ -H 'Referer: http://10.0.10.10/doc/page/login.asp' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \ -H 'X-Requested-With: XMLHttpRequest' \ --compressed \ --insecure


> capabilities response
10bf5269b6e11edeb79587ed88d1cd5579e25374eedf716a82fe8ac790aea6bd ef3b8fc2f615f9eb1247b58bfb0230b9 100 true 2 1af4fa93346bb3d96f50b4195ac8b14cc4634b01781a3fb923c0533ff1c1defc

> sessionLogin request

curl 'http://10.0.10.10/ISAPI/Security/sessionLogin' \ -H 'Accept: /' \ -H 'Accept-Language: en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7,ro;q=0.6' \ -H 'Cache-Control: no-cache' \ -H 'Connection: keep-alive' \ -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \ -H 'Cookie: dispatch=null; passwordLength=16; language=en; authType=3; WebSession_f49ee536a4=db246f2f8037f2b72ae91674dff4b2ad9a585e13e16b2bfa5950f52a5254f7ca; WebSession=null' \ -H 'If-Modified-Since: 0' \ -H 'Origin: http://10.0.10.10' \ -H 'Pragma: no-cache' \ -H 'Referer: http://10.0.10.10/doc/page/login.asp' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \ -H 'X-Requested-With: XMLHttpRequest' \ --data-raw 'adminpassword_hash6df736bb16ab005fe4f5373323b78d4aea20f451dba77073c50b5cae149c4ba22' \ --compressed \ --insecure


> sessionLogin response
200 OK true false true ef513fe6fbd27f179e3bb570a4eac80e359257d1eef78689386ddec66ccc8d9b 2


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?
petrleocompel commented 1 year ago

Can you provide some example with success auth with some provided login credentials?

like for admin / pass ? with salt and etc. I will create test and try where can be a problem.

idealser commented 1 year ago

Sure, Credentials: admin/pass123456

Capabilities

curl 'http://admin:pass123456@10.0.10.10/ISAPI/Security/sessionLogin/capabilities?username= admin&random=42040138' \
  -H 'Accept: */*' \
  -H 'Accept-Language: en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7,ro;q=0.6' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Cookie: dispatch=null; passwordLength=16; language=en; authType=3; WebSession_f49ee536a4=ef513fe6fbd27f179e3bb570a4eac80e359257d1eef78689386ddec66ccc8d9b; WebSession=null' \
  -H 'If-Modified-Since: 0' \
  -H 'Pragma: no-cache' \
  -H 'Referer: http://10.0.10.10/doc/page/login.asp?_1690923263018&page=config' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \
  -H 'X-Requested-With: XMLHttpRequest' \
  --compressed \
  --insecure
<SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>631c98ab7b7c24976a074cf57bf67b6c88077b20c23dbf26fd5e35eb71d5cd7b</sessionID>
<challenge>1ce688aed61ff5cdf8547ac4560ac4ee</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

Login

curl 'http://10.0.10.10/ISAPI/Security/sessionLogin' \
  -H 'Accept: */*' \
  -H 'Accept-Language: en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7,ro;q=0.6' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
  -H 'Cookie: dispatch=null; passwordLength=16; language=en; authType=3; WebSession_f49ee536a4=ef513fe6fbd27f179e3bb570a4eac80e359257d1eef78689386ddec66ccc8d9b; WebSession=null' \
  -H 'If-Modified-Since: 0' \
  -H 'Origin: http://10.0.10.10' \
  -H 'Pragma: no-cache' \
  -H 'Referer: http://10.0.10.10/doc/page/login.asp?_1690923263018&page=config' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \
  -H 'X-Requested-With: XMLHttpRequest' \
  --data-raw '<SessionLogin><userName>admin</userName><password>f9c529aaa5928ffd84fe171679627d0cc094101f70d3cf7e017a88d7faad127c</password><sessionID>631c98ab7b7c24976a074cf57bf67b6c88077b20c23dbf26fd5e35eb71d5cd7b</sessionID><sessionIDVersion>2</sessionIDVersion></SessionLogin>' \
  --compressed \
  --insecure
<SessionLogin version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<statusValue>200</statusValue>
<statusString>OK</statusString>
<isSupportLoginTiming>true</isSupportLoginTiming>
<isRiskPassword>false</isRiskPassword>
<isActivated>true</isActivated>
<sessionID>f57f93159282fb7051d43c3f727c8e748fa892f69a3cc135891beb4ac6761492</sessionID>
<sessionIDVersion>2</sessionIDVersion>
</SessionLogin>

And the next capabilities request

curl 'http://10.0.10.10/ISAPI/Security/sessionLogin' \
  -H 'Accept: */*' \
  -H 'Accept-Language: en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7,ro;q=0.6' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
  -H 'Cookie: dispatch=null; passwordLength=16; language=en; authType=3; WebSession_f49ee536a4=ef513fe6fbd27f179e3bb570a4eac80e359257d1eef78689386ddec66ccc8d9b; WebSession=null' \
  -H 'If-Modified-Since: 0' \
  -H 'Origin: http://10.0.10.10' \
  -H 'Pragma: no-cache' \
  -H 'Referer: http://10.0.10.10/doc/page/login.asp?_1690923263018&page=config' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36' \
  -H 'X-Requested-With: XMLHttpRequest' \
  --data-raw '<SessionLogin><userName>admin</userName><password>f9c529aaa5928ffd84fe171679627d0cc094101f70d3cf7e017a88d7faad127c</password><sessionID>631c98ab7b7c24976a074cf57bf67b6c88077b20c23dbf26fd5e35eb71d5cd7b</sessionID><sessionIDVersion>2</sessionIDVersion></SessionLogin>' \
  --compressed \
  --insecure
<SecurityCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<supportUserNums>16</supportUserNums>
<userBondIpNums>1</userBondIpNums>
<userBondMacNums>1</userBondMacNums>
<SecurityLimits>
<LoginPasswordLenLimit min="8" max="16"/>
</SecurityLimits>
<isSupportConfigFileImport>true</isSupportConfigFileImport>
<isSupportConfigFileExport>true</isSupportConfigFileExport>
<isSptAdminCap>true</isSptAdminCap>
<securityVersion opt="1"/>
<keyIterateNum>100</keyIterateNum>
<isSupportUserCheck>true</isSupportUserCheck>
<keypadPassword min="4" max="6">true</keypadPassword>
<installerKeypadPassword min="4" max="6"></installerKeypadPassword>
<operatorKeypadPassword min="4" max="6"></operatorKeypadPassword>
<userOperateType opt="1,2,3">1</userOperateType>
<isSptUserEnabled>true</isSptUserEnabled>
<isIrreversible>true</isIrreversible>
<salt>437b1e123384415c0af4a539a10e3448251f0d888427dfaaf9ce1de854accaa8</salt>
</SecurityCap>
idealser commented 1 year ago

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
}
petrleocompel commented 1 year ago

@idealser It seems like I am missing something. Can you check during web init in some request is bSupport ? beacuse I dont see it available anywhere. And maybe for this system type it is needed to load other info (capabilities - authInfo) or get the authType.

Also in first I am looking for a way how to detect this authorization and then also how to implement it correctly.

idealser commented 1 year ago

@petrleocompel Seems like I provided wrong information regarding the code. Those screens could be more useful.

Screenshot 2023-08-02 at 09 19 50 Screenshot 2023-08-02 at 09 18 36

I can also provide the js files, containing those methods. Or even provide direct access to the web UI, if it helps.

petrleocompel commented 1 year ago

It seems to be clear now. Your device is using older auth protocol but still higher hash with irreversibility. Basically sessionIDVersion = 2 not 2.1. So no double salt.

I will implement it in core lib. And later try to make beta release of 2.1.0-beta1

petrleocompel commented 1 year ago

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.

idealser commented 1 year ago

Got Unexpected error while connecting to the device on 2.1.0-beta1. AX Hub checkbox was enabled.

2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Session_Capabilities response
2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Status: 200
2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Content: b'<SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">\n<sessionID>f4a6bf2fe2f3f4605830319704e1c078c13e099e044c0dae86f566c2ce34676d</sessionID>\n<challenge>d2e0285141072119dac229ec036c386c</challenge>\n<iterations>100</iterations>\n<isIrreversible>true</isIrreversible>\n<sessionIDVersion>2</sessionIDVersion>\n<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>\n</SessionLoginCap>\n'
2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Text: <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>f4a6bf2fe2f3f4605830319704e1c078c13e099e044c0dae86f566c2ce34676d</sessionID>
<challenge>d2e0285141072119dac229ec036c386c</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Headers: {'Date': 'Wed, 02 Aug 2023 12:36:29 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '428', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99'}
2023-08-02 10:36:31.150 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] End Session_Capabilities response
2023-08-02 10:36:31.150 WARNING (SyncWorker_4) [custom_components.hikvision_axpro.hikax.hikax] Debug data <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>f4a6bf2fe2f3f4605830319704e1c078c13e099e044c0dae86f566c2ce34676d</sessionID>
<challenge>d2e0285141072119dac229ec036c386c</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-02 10:36:31.153 ERROR (MainThread) [custom_components.hikvision_axpro.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/hikvision_axpro/hikax/hikax.py", line 38, in get_session_params
    session_cap = self.parse_session_response(response.text)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/hikax/hikax.py", line 66, in parse_session_response
    session_cap = SessionLoginCap.SessionLoginCap(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: SessionLoginCap.__init__() missing 1 required positional argument: 'session_id_version'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/hikvision_axpro/config_flow.py", line 178, in async_step_user
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/config_flow.py", line 151, in validate_input
    if not await hub.authenticate():
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/config_flow.py", line 116, in authenticate
    is_connect_success = await self.hass.async_add_executor_job(self.axpro.connect)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/hikax/hikax.py", line 93, in connect
    params = self.get_session_params()
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/hikax/hikax.py", line 41, in get_session_params
    raise errors.IncorrectResponseContentError()
errors.errors.IncorrectResponseContentError: Response content is not in expected form.
petrleocompel commented 1 year ago

Axhub should not be enabled.

idealser commented 1 year ago

Without AxHub:

2023-08-02 11:06:52.569 DEBUG (SyncWorker_7) [hikaxpro] Session_Capabilities response
2023-08-02 11:06:52.569 DEBUG (SyncWorker_7) [hikaxpro] Status: 200
2023-08-02 11:06:52.570 DEBUG (SyncWorker_7) [hikaxpro] Content: b'<SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">\n<sessionID>e1cef3551fd32155763de89d49b6f75a1ad86d6b08a48953bd835b78cf558a7e</sessionID>\n<challenge>35894957aca6b5e41ffb455844b54f18</challenge>\n<iterations>100</iterations>\n<isIrreversible>true</isIrreversible>\n<sessionIDVersion>2</sessionIDVersion>\n<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>\n</SessionLoginCap>\n'
2023-08-02 11:06:52.570 DEBUG (SyncWorker_7) [hikaxpro] Text: <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>e1cef3551fd32155763de89d49b6f75a1ad86d6b08a48953bd835b78cf558a7e</sessionID>
<challenge>35894957aca6b5e41ffb455844b54f18</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-02 11:06:52.570 DEBUG (SyncWorker_7) [hikaxpro] Headers: {'Date': 'Wed, 02 Aug 2023 13:06:51 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '428', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99'}
2023-08-02 11:06:52.570 DEBUG (SyncWorker_7) [hikaxpro] End Session_Capabilities response
2023-08-02 11:06:52.570 DEBUG (SyncWorker_7) [hikaxpro] Debug data <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>e1cef3551fd32155763de89d49b6f75a1ad86d6b08a48953bd835b78cf558a7e</sessionID>
<challenge>35894957aca6b5e41ffb455844b54f18</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-02 11:06:52.714 DEBUG (SyncWorker_7) [hikaxpro] Connect response
2023-08-02 11:06:52.714 DEBUG (SyncWorker_7) [hikaxpro] Status: 400
2023-08-02 11:06:52.714 DEBUG (SyncWorker_7) [hikaxpro] Content: b'<?xml version="1.0" encoding="UTF-8" ?>\n<ResponseStatus version="1.0" xmlns="urn:psialliance-org">\n<requestURL>/ISAPI/Security/sessionLogin</requestURL>\n<statusCode>4</statusCode>\n<statusString>Invalid Operation</statusString>\n<subStatusCode>lowPrivilege</subStatusCode>\n</ResponseStatus>\n'
2023-08-02 11:06:52.714 DEBUG (SyncWorker_7) [hikaxpro] Text: <?xml version="1.0" encoding="UTF-8" ?>
<ResponseStatus version="1.0" xmlns="urn:psialliance-org">
<requestURL>/ISAPI/Security/sessionLogin</requestURL>
<statusCode>4</statusCode>
<statusString>Invalid Operation</statusString>
<subStatusCode>lowPrivilege</subStatusCode>
</ResponseStatus>

2023-08-02 11:06:52.714 DEBUG (SyncWorker_7) [hikaxpro] Headers: {'Date': 'Wed, 02 Aug 2023 13:06:52 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '289', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99'}
2023-08-02 11:06:52.714 DEBUG (SyncWorker_7) [hikaxpro] End connect response
idealser commented 1 year ago

@petrleocompel thanks, connected with V2.0.1 beta 2. Still have some troubles on next steps :)

Got an error on setup:

2023-08-02 21:46:45.367 DEBUG (SyncWorker_2) [hikaxpro] Session_Capabilities response
2023-08-02 21:46:45.367 DEBUG (SyncWorker_2) [hikaxpro] Status: 200
2023-08-02 21:46:45.369 DEBUG (SyncWorker_2) [hikaxpro] Content: b'<SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">\n<sessionID>fbe4d791d4acb5038e42d33cf1343a07e4a271b5b106376138a3ee1daac71e07</sessionID>\n<challenge>435379fe1b8e2ccd2616049ac6bc2004</challenge>\n<iterations>100</iterations>\n<isIrreversible>true</isIrreversible>\n<sessionIDVersion>2</sessionIDVersion>\n<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>\n</SessionLoginCap>\n'
2023-08-02 21:46:45.370 DEBUG (SyncWorker_2) [hikaxpro] Text: <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>fbe4d791d4acb5038e42d33cf1343a07e4a271b5b106376138a3ee1daac71e07</sessionID>
<challenge>435379fe1b8e2ccd2616049ac6bc2004</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-02 21:46:45.370 DEBUG (SyncWorker_2) [hikaxpro] Headers: {'Date': 'Wed, 02 Aug 2023 23:46:44 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '428', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99'}
2023-08-02 21:46:45.370 DEBUG (SyncWorker_2) [hikaxpro] End Session_Capabilities response
2023-08-02 21:46:45.370 DEBUG (SyncWorker_2) [hikaxpro] Debug data <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>fbe4d791d4acb5038e42d33cf1343a07e4a271b5b106376138a3ee1daac71e07</sessionID>
<challenge>435379fe1b8e2ccd2616049ac6bc2004</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-02 21:46:45.628 DEBUG (SyncWorker_2) [hikaxpro] Connect response
2023-08-02 21:46:45.629 DEBUG (SyncWorker_2) [hikaxpro] Status: 200
2023-08-02 21:46:45.629 DEBUG (SyncWorker_2) [hikaxpro] Content: b'<SessionLogin version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">\n<statusValue>200</statusValue>\n<statusString>OK</statusString>\n<isSupportLoginTiming>true</isSupportLoginTiming>\n<isRiskPassword>false</isRiskPassword>\n<isActivated>true</isActivated>\n<sessionID>8d54c96ef049838c9e976ec46a55f6c322b0f55ddc74222ac2fa30e52c661215</sessionID>\n<sessionIDVersion>2</sessionIDVersion>\n</SessionLogin>\n'
2023-08-02 21:46:45.629 DEBUG (SyncWorker_2) [hikaxpro] Text: <SessionLogin version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<statusValue>200</statusValue>
<statusString>OK</statusString>
<isSupportLoginTiming>true</isSupportLoginTiming>
<isRiskPassword>false</isRiskPassword>
<isActivated>true</isActivated>
<sessionID>8d54c96ef049838c9e976ec46a55f6c322b0f55ddc74222ac2fa30e52c661215</sessionID>
<sessionIDVersion>2</sessionIDVersion>
</SessionLogin>

2023-08-02 21:46:45.629 DEBUG (SyncWorker_2) [hikaxpro] Headers: {'Date': 'Wed, 02 Aug 2023 23:46:44 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '405', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99', 'Set-Cookie': 'WebSession_f49ee536a4=8d54c96ef049838c9e976ec46a55f6c322b0f55ddc74222ac2fa30e52c661215;path=/;HttpOnly'}
2023-08-02 21:46:45.629 DEBUG (SyncWorker_2) [hikaxpro] End connect response
2023-08-02 21:46:45.630 INFO (MainThread) [homeassistant.setup] Setting up hikvision_axpro
2023-08-02 21:46:45.630 INFO (MainThread) [homeassistant.setup] Setup of domain hikvision_axpro took 0.0 seconds
2023-08-02 21:46:45.657 DEBUG (SyncWorker_6) [hikaxpro] Session_Capabilities response
2023-08-02 21:46:45.657 DEBUG (SyncWorker_6) [hikaxpro] Status: 200
2023-08-02 21:46:45.657 DEBUG (SyncWorker_6) [hikaxpro] Content: b'<SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">\n<sessionID>23271557e8776e75d062c012c7939e1b26bfe08415671de0f116aed4f4d7ec88</sessionID>\n<challenge>3b1981f475af31c6809eccc9f3f8e7ce</challenge>\n<iterations>100</iterations>\n<isIrreversible>true</isIrreversible>\n<sessionIDVersion>2</sessionIDVersion>\n<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>\n</SessionLoginCap>\n'
2023-08-02 21:46:45.657 DEBUG (SyncWorker_6) [hikaxpro] Text: <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>23271557e8776e75d062c012c7939e1b26bfe08415671de0f116aed4f4d7ec88</sessionID>
<challenge>3b1981f475af31c6809eccc9f3f8e7ce</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-02 21:46:45.657 DEBUG (SyncWorker_6) [hikaxpro] Headers: {'Date': 'Wed, 02 Aug 2023 23:46:44 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '428', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99'}
2023-08-02 21:46:45.657 DEBUG (SyncWorker_6) [hikaxpro] End Session_Capabilities response
2023-08-02 21:46:45.657 DEBUG (SyncWorker_6) [hikaxpro] Debug data <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>23271557e8776e75d062c012c7939e1b26bfe08415671de0f116aed4f4d7ec88</sessionID>
<challenge>3b1981f475af31c6809eccc9f3f8e7ce</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-02 21:46:45.842 DEBUG (SyncWorker_6) [hikaxpro] Connect response
2023-08-02 21:46:45.842 DEBUG (SyncWorker_6) [hikaxpro] Status: 200
2023-08-02 21:46:45.843 DEBUG (SyncWorker_6) [hikaxpro] Content: b'<SessionLogin version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">\n<statusValue>200</statusValue>\n<statusString>OK</statusString>\n<isSupportLoginTiming>true</isSupportLoginTiming>\n<isRiskPassword>false</isRiskPassword>\n<isActivated>true</isActivated>\n<sessionID>4c13e0286dc1e970a1c1652f3f85895ca2b88259f8fc2408bba4869ab1376278</sessionID>\n<sessionIDVersion>2</sessionIDVersion>\n</SessionLogin>\n'
2023-08-02 21:46:45.843 DEBUG (SyncWorker_6) [hikaxpro] Text: <SessionLogin version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<statusValue>200</statusValue>
<statusString>OK</statusString>
<isSupportLoginTiming>true</isSupportLoginTiming>
<isRiskPassword>false</isRiskPassword>
<isActivated>true</isActivated>
<sessionID>4c13e0286dc1e970a1c1652f3f85895ca2b88259f8fc2408bba4869ab1376278</sessionID>
<sessionIDVersion>2</sessionIDVersion>
</SessionLogin>

2023-08-02 21:46:45.843 DEBUG (SyncWorker_6) [hikaxpro] Headers: {'Date': 'Wed, 02 Aug 2023 23:46:44 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '405', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99', 'Set-Cookie': 'WebSession_f49ee536a4=4c13e0286dc1e970a1c1652f3f85895ca2b88259f8fc2408bba4869ab1376278;path=/;HttpOnly'}
2023-08-02 21:46:45.843 DEBUG (SyncWorker_6) [hikaxpro] End connect response
2023-08-02 21:46:45.879 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] <DeviceInfo version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<deviceName>0-1234Hik</deviceName>
<deviceID>48513034-3933-3830-3331-c0517e1d6ca8</deviceID>
<model>DS-PHA20-P</model>
<serialNumber>DS-PHA20-P20201228AAWRQ04938031W</serialNumber>
<macAddress>c0:51:7e:1d:6c:a8</macAddress>
<firmwareVersion>V1.3.2</firmwareVersion>
<firmwareReleasedDate>build 220121</firmwareReleasedDate>
<hardwareVersion>0x1000</hardwareVersion>
<encoderVersion>V1.0</encoderVersion>
<encoderReleasedDate>build 000000</encoderReleasedDate>
<deviceType>PHA</deviceType>
<telecontrolID>0</telecontrolID>
<charEncodeFormat>UTF-8</charEncodeFormat>
<languageType opt="english,spanish,russian,polish,turkish,greek,czech,brazilianportuguese,croatian,slovenian,romanian,slovakia">english</languageType>
</DeviceInfo>

2023-08-02 21:46:45.880 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] {'DeviceInfo': {'@version': '2.0', '@xmlns': 'http://www.hikvision.com/ver20/XMLSchema', 'deviceName': '0-1234Hik', 'deviceID': '48513034-3933-3830-3331-c0517e1d6ca8', 'model': 'DS-PHA20-P', 'serialNumber': 'DS-PHA20-P20201228AAWRQ04938031W', 'macAddress': 'c0:51:7e:1d:6c:a8', 'firmwareVersion': 'V1.3.2', 'firmwareReleasedDate': 'build 220121', 'hardwareVersion': '0x1000', 'encoderVersion': 'V1.0', 'encoderReleasedDate': 'build 000000', 'deviceType': 'PHA', 'telecontrolID': '0', 'charEncodeFormat': 'UTF-8', 'languageType': {'@opt': 'english,spanish,russian,polish,turkish,greek,czech,brazilianportuguese,croatian,slovenian,romanian,slovakia', '#text': 'english'}}}
2023-08-02 21:46:45.926 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] { "List": [ { "Zone": { "id": 0, "zoneName": "Door", "detectorType": "other", "zoneType": "Delay", "subSystemNo": 1, "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "RelatedChanList": [ { "RelatedChan": { "relator": "host", "cameraSeq": "", "relatedChan": 0 } } ], "moduleChannel": 255, "moduleType": "localWired", "moduleStatus": "online", "sensitivity": 500, "resistor": 2.2, "tamperType": "disable", "zoneAttrib": "wired", "doubleZoneCfgEnable": false, "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 1, "zoneName": "Hall", "detectorType": "passiveInfraredDetector", "zoneType": "Follow", "subSystemNo": 1, "delayTime": 1, "stayAwayEnabled": true, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "RelatedChanList": [ { "RelatedChan": { "relator": "host", "cameraSeq": "", "relatedChan": 0 } } ], "moduleChannel": 255, "moduleType": "localWired", "moduleStatus": "online", "sensitivity": 500, "resistor": 2.2, "tamperType": "disable", "zoneAttrib": "wired", "doubleZoneCfgEnable": false, "armNoBypassEnabled": false } }, { "Zone": { "id": 2, "zoneName": "Living", "detectorType": "passiveInfraredDetector", "zoneType": "Follow", "subSystemNo": 1, "delayTime": 1, "stayAwayEnabled": true, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "RelatedChanList": [ { "RelatedChan": { "relator": "host", "cameraSeq": "", "relatedChan": 0 } } ], "moduleChannel": 255, "moduleType": "localWired", "moduleStatus": "online", "sensitivity": 500, "resistor": 2.2, "tamperType": "disable", "zoneAttrib": "wired", "doubleZoneCfgEnable": false, "armNoBypassEnabled": false } }, { "Zone": { "id": 3, "zoneName": "Bedroom", "detectorType": "passiveInfraredDetector", "zoneType": "Follow", "subSystemNo": 1, "delayTime": 1, "stayAwayEnabled": true, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "RelatedChanList": [ { "RelatedChan": { "relator": "host", "cameraSeq": "", "relatedChan": 0 } } ], "moduleChannel": 255, "moduleType": "localWired", "moduleStatus": "online", "sensitivity": 500, "resistor": 2.2, "tamperType": "disable", "zoneAttrib": "wired", "doubleZoneCfgEnable": false, "armNoBypassEnabled": false } }, { "Zone": { "id": 4, "zoneName": "Zone 5", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 5, "zoneName": "Zone 6", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 6, "zoneName": "Zone 7", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 7, "zoneName": "Zone 8", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 8, "zoneName": "Zone 9", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 9, "zoneName": "Zone 10", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 10, "zoneName": "Zone 11", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 11, "zoneName": "Zone 12", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 12, "zoneName": "Zone 13", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 13, "zoneName": "Zone 14", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 14, "zoneName": "Zone 15", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 15, "zoneName": "Zone 16", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 16, "zoneName": "Zone 17", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 17, "zoneName": "Zone 18", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 18, "zoneName": "Zone 19", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 19, "zoneName": "Zone 20", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } } ] }
2023-08-02 21:46:45.927 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Hikvision_axpro_10.0.10.10 for hikvision_axpro
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 390, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 105, in async_setup_entry
    await hass.async_add_executor_job(coordinator.init_device)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 177, in init_device
    self.load_devices()
  File "/config/custom_components/hikvision_axpro/__init__.py", line 181, in load_devices
    devices = self._load_devices()
              ^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 194, in _load_devices
    return ZonesConf.from_dict(response.json())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 895, in from_dict
    list = from_list(ListElement.from_dict, obj.get("List"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 29, in from_list
    return [f(y) for y in x]
           ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 29, in <listcomp>
    return [f(y) for y in x]
            ^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 879, in from_dict
    zone = ZoneConfig.from_dict(obj.get("Zone"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 675, in from_dict
    chime_enabled = from_bool(obj.get("chimeEnabled"))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/model.py", line 18, in from_bool
    assert isinstance(x, bool)
petrleocompel commented 1 year ago

Seems easy to fix. Tomorrow will do and release v2.1.0-beta3

petrleocompel commented 1 year ago

v2.1.0-beta3 was released

idealser commented 1 year ago

On v2.1.0-beta3

2023-08-03 08:14:55.614 DEBUG (SyncWorker_1) [hikaxpro] Session_Capabilities response
2023-08-03 08:14:55.614 DEBUG (SyncWorker_1) [hikaxpro] Status: 200
2023-08-03 08:14:55.615 DEBUG (SyncWorker_1) [hikaxpro] Content: b'<SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">\n<sessionID>6c6ca3a73eedfe7b643950d0d3379f9c3dc51e539c380b07fd347b62e2d0380d</sessionID>\n<challenge>9d7d9f805d6b5549ba6eeeede188b891</challenge>\n<iterations>100</iterations>\n<isIrreversible>true</isIrreversible>\n<sessionIDVersion>2</sessionIDVersion>\n<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>\n</SessionLoginCap>\n'
2023-08-03 08:14:55.615 DEBUG (SyncWorker_1) [hikaxpro] Text: <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>6c6ca3a73eedfe7b643950d0d3379f9c3dc51e539c380b07fd347b62e2d0380d</sessionID>
<challenge>9d7d9f805d6b5549ba6eeeede188b891</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-03 08:14:55.615 DEBUG (SyncWorker_1) [hikaxpro] Headers: {'Date': 'Thu, 03 Aug 2023 10:14:54 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '428', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99'}
2023-08-03 08:14:55.615 DEBUG (SyncWorker_1) [hikaxpro] End Session_Capabilities response
2023-08-03 08:14:55.615 DEBUG (SyncWorker_1) [hikaxpro] Debug data <SessionLoginCap version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<sessionID>6c6ca3a73eedfe7b643950d0d3379f9c3dc51e539c380b07fd347b62e2d0380d</sessionID>
<challenge>9d7d9f805d6b5549ba6eeeede188b891</challenge>
<iterations>100</iterations>
<isIrreversible>true</isIrreversible>
<sessionIDVersion>2</sessionIDVersion>
<salt>bef6d541c1ac37f74d90b9d3dc642ab6ea54b17d653b10f24464867b6dbeacb5</salt>
</SessionLoginCap>

2023-08-03 08:14:55.803 DEBUG (SyncWorker_1) [hikaxpro] Connect response
2023-08-03 08:14:55.804 DEBUG (SyncWorker_1) [hikaxpro] Status: 200
2023-08-03 08:14:55.804 DEBUG (SyncWorker_1) [hikaxpro] Content: b'<SessionLogin version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">\n<statusValue>200</statusValue>\n<statusString>OK</statusString>\n<isSupportLoginTiming>true</isSupportLoginTiming>\n<isRiskPassword>false</isRiskPassword>\n<isActivated>true</isActivated>\n<sessionID>c4f452501e2a43b59f3c181c019a7d4287a1f980d38f287c4ed28c2cefd3108e</sessionID>\n<sessionIDVersion>2</sessionIDVersion>\n</SessionLogin>\n'
2023-08-03 08:14:55.804 DEBUG (SyncWorker_1) [hikaxpro] Text: <SessionLogin version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<statusValue>200</statusValue>
<statusString>OK</statusString>
<isSupportLoginTiming>true</isSupportLoginTiming>
<isRiskPassword>false</isRiskPassword>
<isActivated>true</isActivated>
<sessionID>c4f452501e2a43b59f3c181c019a7d4287a1f980d38f287c4ed28c2cefd3108e</sessionID>
<sessionIDVersion>2</sessionIDVersion>
</SessionLogin>

2023-08-03 08:14:55.804 DEBUG (SyncWorker_1) [hikaxpro] Headers: {'Date': 'Thu, 03 Aug 2023 10:14:54 GMT', 'Server': 'Webs', 'X-Frame-Options': 'SAMEORIGIN', 'Cache-Control': 'no-cache', 'Content-Length': '405', 'Content-Type': 'application/xml; charset="UTF-8"', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=60, max=99', 'Set-Cookie': 'WebSession_f49ee536a4=c4f452501e2a43b59f3c181c019a7d4287a1f980d38f287c4ed28c2cefd3108e;path=/;HttpOnly'}
2023-08-03 08:14:55.804 DEBUG (SyncWorker_1) [hikaxpro] End connect response
2023-08-03 08:14:55.842 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] <DeviceInfo version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<deviceName>4-8265Alferin Dmitrii</deviceName>
<deviceID>48513034-3933-3830-3331-c0517e1d6ca8</deviceID>
<model>DS-PHA20-P</model>
<serialNumber>DS-PHA20-P20201228AAWRQ04938031W</serialNumber>
<macAddress>c0:51:7e:1d:6c:a8</macAddress>
<firmwareVersion>V1.3.2</firmwareVersion>
<firmwareReleasedDate>build 220121</firmwareReleasedDate>
<hardwareVersion>0x1000</hardwareVersion>
<encoderVersion>V1.0</encoderVersion>
<encoderReleasedDate>build 000000</encoderReleasedDate>
<deviceType>PHA</deviceType>
<telecontrolID>0</telecontrolID>
<charEncodeFormat>UTF-8</charEncodeFormat>
<languageType opt="english,spanish,russian,polish,turkish,greek,czech,brazilianportuguese,croatian,slovenian,romanian,slovakia">english</languageType>
</DeviceInfo>

2023-08-03 08:14:55.843 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] {'DeviceInfo': {'@version': '2.0', '@xmlns': 'http://www.hikvision.com/ver20/XMLSchema', 'deviceName': '4-8265Alferin Dmitrii', 'deviceID': '48513034-3933-3830-3331-c0517e1d6ca8', 'model': 'DS-PHA20-P', 'serialNumber': 'DS-PHA20-P20201228AAWRQ04938031W', 'macAddress': 'c0:51:7e:1d:6c:a8', 'firmwareVersion': 'V1.3.2', 'firmwareReleasedDate': 'build 220121', 'hardwareVersion': '0x1000', 'encoderVersion': 'V1.0', 'encoderReleasedDate': 'build 000000', 'deviceType': 'PHA', 'telecontrolID': '0', 'charEncodeFormat': 'UTF-8', 'languageType': {'@opt': 'english,spanish,russian,polish,turkish,greek,czech,brazilianportuguese,croatian,slovenian,romanian,slovakia', '#text': 'english'}}}
2023-08-03 08:14:55.885 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] { "List": [ { "Zone": { "id": 0, "zoneName": "Door", "detectorType": "other", "zoneType": "Delay", "subSystemNo": 1, "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "RelatedChanList": [ { "RelatedChan": { "relator": "host", "cameraSeq": "", "relatedChan": 0 } } ], "moduleChannel": 255, "moduleType": "localWired", "moduleStatus": "online", "sensitivity": 500, "resistor": 2.2, "tamperType": "disable", "zoneAttrib": "wired", "doubleZoneCfgEnable": false, "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 1, "zoneName": "Hall", "detectorType": "passiveInfraredDetector", "zoneType": "Follow", "subSystemNo": 1, "delayTime": 1, "stayAwayEnabled": true, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "RelatedChanList": [ { "RelatedChan": { "relator": "host", "cameraSeq": "", "relatedChan": 0 } } ], "moduleChannel": 255, "moduleType": "localWired", "moduleStatus": "online", "sensitivity": 500, "resistor": 2.2, "tamperType": "disable", "zoneAttrib": "wired", "doubleZoneCfgEnable": false, "armNoBypassEnabled": false } }, { "Zone": { "id": 2, "zoneName": "Living", "detectorType": "passiveInfraredDetector", "zoneType": "Follow", "subSystemNo": 1, "delayTime": 1, "stayAwayEnabled": true, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "RelatedChanList": [ { "RelatedChan": { "relator": "host", "cameraSeq": "", "relatedChan": 0 } } ], "moduleChannel": 255, "moduleType": "localWired", "moduleStatus": "online", "sensitivity": 500, "resistor": 2.2, "tamperType": "disable", "zoneAttrib": "wired", "doubleZoneCfgEnable": false, "armNoBypassEnabled": false } }, { "Zone": { "id": 3, "zoneName": "Bedroom", "detectorType": "passiveInfraredDetector", "zoneType": "Follow", "subSystemNo": 1, "delayTime": 1, "stayAwayEnabled": true, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "RelatedChanList": [ { "RelatedChan": { "relator": "host", "cameraSeq": "", "relatedChan": 0 } } ], "moduleChannel": 255, "moduleType": "localWired", "moduleStatus": "online", "sensitivity": 500, "resistor": 2.2, "tamperType": "disable", "zoneAttrib": "wired", "doubleZoneCfgEnable": false, "armNoBypassEnabled": false } }, { "Zone": { "id": 4, "zoneName": "Zone 5", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 5, "zoneName": "Zone 6", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 6, "zoneName": "Zone 7", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 7, "zoneName": "Zone 8", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 8, "zoneName": "Zone 9", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 9, "zoneName": "Zone 10", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 10, "zoneName": "Zone 11", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 11, "zoneName": "Zone 12", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 12, "zoneName": "Zone 13", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 13, "zoneName": "Zone 14", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 14, "zoneName": "Zone 15", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 15, "zoneName": "Zone 16", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 16, "zoneName": "Zone 17", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 17, "zoneName": "Zone 18", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 18, "zoneName": "Zone 19", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } }, { "Zone": { "id": 19, "zoneName": "Zone 20", "detectorType": "other", "zoneType": "Instant", "delayTime": 1, "stayAwayEnabled": false, "silentEnabled": false, "timeoutLimit": true, "timeoutType": "tigger", "timeout": 30, "relateDetector": false, "detectorSeq": "", "RelatedChanList": [ { "RelatedChan": { "cameraSeq": "", "relatedChan": 0 } } ], "linkageAddress": 255, "moduleChannel": 255, "moduleType": "extendWireless", "checkTime": 1, "moduleStatus": "offline", "zoneAttrib": "wireless", "armNoBypassEnabled": false, "doubleKnockEnabled": false, "doubleKnockTime": 5 } } ] }
2023-08-03 08:14:55.914 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] { "List": [ { "Output": { "id": 0, "name": "Relay 1", "related": true, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "localWired", "address": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 1, "name": "Relay 2", "related": true, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "localWired", "address": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 2, "name": "Relay 3", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 3, "name": "Relay 4", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 4, "name": "Relay 5", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 5, "name": "Relay 6", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 6, "name": "Relay 7", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 7, "name": "Relay 8", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 8, "name": "Relay 9", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 9, "name": "Relay 10", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 10, "name": "Relay 11", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 11, "name": "Relay 12", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 12, "name": "Relay 13", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 13, "name": "Relay 14", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 14, "name": "Relay 15", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 15, "name": "Relay 16", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 16, "name": "Relay 17", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 17, "name": "Relay 18", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 18, "name": "Relay 19", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } }, { "Output": { "id": 19, "name": "Relay 20", "related": false, "outputModuleNo": 0, "channelNo": 0, "LinkageList": [ { "linkage": "manualCtrl" } ], "duration": 60, "moduleType": "extendWireless", "linkageAddress": 255, "durationConstOutputEnable": false, "moduleChannel": 0 } } ] }
2023-08-03 08:14:56.043 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] SubSystem status: SubSystemResponse(sub_sys_list=[SubSysList(sub_sys=SubSys(id=1, arming=<Arming.DISARM: 'disarm'>, alarm=False, enabled=True, name='Apartment', delay_time=None)), SubSysList(sub_sys=SubSys(id=2, arming=<Arming.DISARM: 'disarm'>, alarm=False, enabled=False, name='Area2', delay_time=None)), SubSysList(sub_sys=SubSys(id=3, arming=<Arming.DISARM: 'disarm'>, alarm=False, enabled=False, name='Area3', delay_time=None)), SubSysList(sub_sys=SubSys(id=4, arming=<Arming.DISARM: 'disarm'>, alarm=False, enabled=False, name='Area4', delay_time=None))])
2023-08-03 08:14:56.044 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] Axpro status: disarmed
2023-08-03 08:14:56.187 DEBUG (SyncWorker_4) [custom_components.hikvision_axpro] Zones: {'ZoneList': [{'Zone': {'id': 0, 'name': 'Door', 'status': 'online', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Delay', 'signal': 0}}, {'Zone': {'id': 1, 'name': 'Hall', 'status': 'online', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Follow', 'signal': 0}}, {'Zone': {'id': 2, 'name': 'Living', 'status': 'online', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Follow', 'signal': 0}}, {'Zone': {'id': 3, 'name': 'Bedroom', 'status': 'online', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Follow', 'signal': 0}}, {'Zone': {'id': 4, 'name': 'Zone 5', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 5, 'name': 'Zone 6', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 6, 'name': 'Zone 7', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 7, 'name': 'Zone 8', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 8, 'name': 'Zone 9', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 9, 'name': 'Zone 10', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 10, 'name': 'Zone 11', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 11, 'name': 'Zone 12', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 12, 'name': 'Zone 13', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 13, 'name': 'Zone 14', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 14, 'name': 'Zone 15', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 15, 'name': 'Zone 16', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 16, 'name': 'Zone 17', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 17, 'name': 'Zone 18', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 18, 'name': 'Zone 19', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}, {'Zone': {'id': 19, 'name': 'Zone 20', 'status': 'notRelated', 'tamperEvident': False, 'shielded': False, 'bypassed': False, 'armed': False, 'alarm': False, 'zoneType': 'Instant', 'signal': 0}}]}
2023-08-03 08:14:56.199 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Hikvision_axpro_10.0.10.10 for hikvision_axpro
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 390, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 105, in async_setup_entry
    await hass.async_add_executor_job(coordinator.init_device)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 182, in init_device
    self._update_data()
  File "/config/custom_components/hikvision_axpro/__init__.py", line 269, in _update_data
    current_relays_state = self._update_relays_status()
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/__init__.py", line 226, in _update_relays_status
    raise hikaxpro.errors.UnexpectedResponseCodeError(response.status_code, response.text)
errors.errors.UnexpectedResponseCodeError: Unexpected response status code 400 returned with message { "statusCode": 6, "statusString": "Invalid Content", "subStatusCode": "badParameters", "errorCode": 1610612737, "errorMsg": "badParameters" }
petrleocompel commented 1 year ago

Can you try to send POST request via postman to /ISAPI/SecurityCP/status/outputStatus?format=json (get cookie from browser after logging in) and payload / body

{"OutputCond":{"searchID":"homeassistant","searchResultPosition": 0,"maxResults": 50}}

Seems like your device version has different way how to get status of relays...

idealser commented 1 year ago
{
    "statusCode": 6,
    "statusString": "Invalid Content",
    "subStatusCode": "badParameters",
    "errorCode": 1610612737,
    "errorMsg": "badParameters"
}
Screenshot 2023-08-03 at 11 47 32
idealser commented 1 year ago

Is this the data required?

Screenshot 2023-08-03 at 11 54 42
petrleocompel commented 1 year ago

The URL is correct provided by me. But the payload is wrong try the same url with

{"searchID":"test","searchResultPosition":1,"maxResults":100}
idealser commented 1 year ago
Screenshot 2023-08-03 at 12 09 32
petrleocompel commented 1 year ago

My mistake has to be encapsulated, try

{"OutputCond":{"searchID":"test","searchResultPosition":1,"maxResults":100}}
idealser commented 1 year ago

Same error...

I found this URL for the relays: ISAPI/SecurityCP/status/exDevStatus?format=json

{
    "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"
                }
            }
        ]
    }
}
petrleocompel commented 1 year ago

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 __init__.py remove lines self._update_relays_status(). And you might will have everything else working.

idealser commented 1 year ago

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...

petrleocompel commented 1 year ago

It is hidden in Hikvision network documentation

https://github.com/petrleocompel/hikaxpro_hacs/issues/7#issuecomment-1448388842

petrleocompel commented 1 year ago

Seems like latest builds of network SDK does not contain documentation of ISAPI ๐Ÿ˜ฎโ€๐Ÿ’จ

petrleocompel commented 1 year ago

But there is a live version of those docs https://tpp.hikvision.com/Wiki/ISAPI/Access%20Control%20on%20Person/GUID-7C2E47E4-CA5A-416E-9A4C-1FDA4B85153D.html

idealser commented 1 year ago

I found it for Linux: https://www.hikvision.com/en/support/tools/hitools/clf4633a00e385d6ea/

there are some docs inside in PDF

petrleocompel commented 1 year ago

Device Network SDK (Security Control)_Developer Guide_V6.1.5.X_20220311.zip I have my backup - providing... It is much better than PDF

idealser commented 1 year ago

Got it. But I was unable to get it without moduleType

Screenshot 2023-08-03 at 12 47 50
petrleocompel commented 1 year ago

For now. I will add module type but it is not required... Later will convert all statuses to use /ISAPI/SecurityCP/status/exDevStatus

idealser commented 1 year ago

It's weird but it won't work without it... Maybe some sort of bug in the device's API or an outdated version.

petrleocompel commented 1 year ago

v2.1.0-beta4 released

idealser commented 1 year ago

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:

2023-08-03 10:09:18.234 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140521728316112] Unexpected response status code 400 returned with message { "statusCode": 4, "statusString": "Invalid Operation", "subStatusCode": "lowPrivilege", "errorCode": 1073741826, "errorMsg": "lowPrivilege" }
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 205, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1965, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2005, in _execute_service
    return await cast(
           ^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 848, in entity_service_call
    response_data = task.result()  # pop exception if have
                    ^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1192, in async_request_call
    return await coro
           ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/alarm_control_panel.py", line 127, in async_alarm_arm_away
    await self.coordinator.async_arm_away()
  File "/config/custom_components/hikvision_axpro/__init__.py", line 294, in async_arm_away
    is_success = await self.hass.async_add_executor_job(self.axpro.arm_away, sub_id)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/hikaxpro.py", line 197, in arm_away
    return self._base_json_request(f"http://{self.host}{consts.Endpoints.Alarm_ArmAway.replace('{}', sid)}",
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/hikaxpro.py", line 180, in _base_json_request
    raise errors.UnexpectedResponseCodeError(response.status_code, response.text)
errors.errors.UnexpectedResponseCodeError: Unexpected response status code 400 returned with message { "statusCode": 4, "statusString": "Invalid Operation", "subStatusCode": "lowPrivilege", "errorCode": 1073741826, "errorMsg": "lowPrivilege" }
petrleocompel commented 1 year ago

There is going to be a different parameters again :/

idealser commented 1 year ago

Checked disarm:

Screenshot 2023-08-03 at 13 17 26

Arm:

Screenshot 2023-08-03 at 13 19 35

Are you using the same calls?

petrleocompel commented 1 year ago

If you defined "code" in configuration.. try to remove it.

image

Yes But the payload is different

{"Operate": {"moduleOperateCode": code}}

Or is empty... if no code.

idealser commented 1 year ago

Initially I tried without it. Thought it would change the situation

idealser commented 1 year ago

Reinitialized the integration without adding any code:

2023-08-03 11:57:47.854 DEBUG (SyncWorker_0) [custom_components.hikvision_axpro] { "OutputSearch": { "searchID": "homeassistant", "responseStatusStrg": "OK", "numOfMatches": 1, "totalMatches": 1, "OutputList": [ { "Output": { "id": 1, "name": "Relay 2", "status": "off", "tamperEvident": false, "charge": "normal", "linkage": "alarm", "signal": 0 } } ] } }
2023-08-03 11:57:47.854 DEBUG (SyncWorker_0) [custom_components.hikvision_axpro] Relay status: {1: RelayStatus(id=1, name='Relay 2', status=<RelayStatusEnum.OFF: 'off'>, access_module_type=None, module_channel=None, sub_system_list=None, scenario_type=None, relay_attrib=None, device_no=None)}
2023-08-03 11:57:47.855 DEBUG (MainThread) [custom_components.hikvision_axpro] Finished fetching hikvision_axpro data in 0.400 seconds (success: True)
2023-08-03 11:58:09.543 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139718262742736] Unexpected response status code 400 returned with message { "statusCode": 4, "statusString": "Invalid Operation", "subStatusCode": "lowPrivilege", "errorCode": 1073741826, "errorMsg": "lowPrivilege" }
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 205, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1965, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2005, in _execute_service
    return await cast(
           ^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 848, in entity_service_call
    response_data = task.result()  # pop exception if have
                    ^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1192, in async_request_call
    return await coro
           ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/alarm_control_panel.py", line 119, in async_alarm_arm_home
    await self.coordinator.async_arm_home()
  File "/config/custom_components/hikvision_axpro/__init__.py", line 286, in async_arm_home
    is_success = await self.hass.async_add_executor_job(self.axpro.arm_home, sub_id)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/hikaxpro.py", line 189, in arm_home
    return self._base_json_request(f"http://{self.host}{consts.Endpoints.Alarm_ArmHome.replace('{}', sid)}",
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/hikaxpro.py", line 180, in _base_json_request
    raise errors.UnexpectedResponseCodeError(response.status_code, response.text)
errors.errors.UnexpectedResponseCodeError: Unexpected response status code 400 returned with message { "statusCode": 4, "statusString": "Invalid Operation", "subStatusCode": "lowPrivilege", "errorCode": 1073741826, "errorMsg": "lowPrivilege" }

And tried this payload with empty code and without it: {"Operate": {"moduleOperateCode": code}}

{
    "statusCode": 6,
    "statusString": "Invalid Content",
    "subStatusCode": "badParameters",
    "errorCode": 1610612737,
    "errorMsg": "badParameters"
}
petrleocompel commented 1 year ago

I fixed usage of the "relay status methods" in v2.1.0-beta6. Currently thinking about how to workout arm / disarm for AX Hybrid.

idealser commented 1 year ago

Thanks, let me know if you need to check anything

idealser commented 1 year ago

I was checking logs recently and noticed following message during arm/disarm:

Failed to call service alarm_control_panel/alarm_arm_away. 
Unexpected response status code 400 returned with message { "statusCode": 4, "statusString": "Invalid Operation", "subStatusCode": "lowPrivilege", "errorCode": 1073741826, "errorMsg": "lowPrivilege" }

Sub status code is lowPrivilege. Could this happen because only admin accounts can execute this request? The one that I use is an operator.

petrleocompel commented 1 year ago

Acutally yes. That can be the problem. But this really depends on device implementation of ISAPI. You can test it ๐Ÿคทโ€โ™‚๏ธ

idealser commented 1 year ago

Unfortunately alarm provider prevents me from using admin account. But I'll try to get the credentials somehow...

idealser commented 1 year ago
Screenshot 2023-08-24 at 12 19 18

Changed sid to the exact id of my zone (1) and it started to work. It appears that 0xffffffff could not be used in my case.

UPD: Works natively when configured with "Include areas as separate zones for arm/disarm" checked. Can't use main home entity but I have a single area and it's being controlled without any issue.

petrleocompel commented 1 year ago

IF you enable image in configuration you should be able to activate the zone then ๐Ÿ˜‡ Because this activates full system but if you use this zone approach it uses the zone IDs

idealser commented 1 year ago

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.

petrleocompel commented 1 year ago

You can hide the "main panel" via settings and use the zones. You can create yourself some "template" panel via yaml. Use the hidden entity for "status" and group all zones for control. ๐Ÿ˜‡ Great if any problems please report always with "device" you are using.

If you would later comment here your solution i will add it to "readme" for others.