petrleocompel / hikaxpro_hacs

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

Arming does not work - lowPrivilege #107

Closed HappyPlotter closed 7 months ago

HappyPlotter commented 7 months ago

Hello, just installed the addon (thank you for this). It seems like the arming is not working. The error is :

Logger: homeassistant.helpers.script.websocket_api_script
Source: helpers/script.py:507
First occurred: 11:02:55 PM (3 occurrences)
Last logged: 11:04:22 PM

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 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/helpers/script.py", line 507, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
    raise result from None
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1580, in async_request_call
    return await coro
           ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/hikvision_axpro/alarm_control_panel.py", line 236, in async_alarm_arm_away
    await self.coordinator.async_arm_away(self.sys.id)
  File "/config/custom_components/hikvision_axpro/__init__.py", line 319, in async_arm_away
    is_success = await self.hass.async_add_executor_job(self.axpro.arm_away, sub_id)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/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.12/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" }

The user is the admin and the "include areas as separate zones" is checked

petrleocompel commented 7 months ago

I guess you are using your Hikvision accounts credentials. What version of firmware do you have ? what device exactly it is ?

HappyPlotter commented 7 months ago

That is correct, the account is from the cloud. The device is DS-PWA96-M2H-WE Device Version V1.2.9 build 231207

Unfortunately it does not allow to create a local account, it wont allow to enter the password Edit : image

It seems like it does not recognize the device

petrleocompel commented 7 months ago

Can you login in Web UI of AXPro with this account ?

HappyPlotter commented 7 months ago

Yes, there is no issues connecting to the web ui with this account. Also all the devices are being seen by HA. It is just the arming that has issues (probably disarming too)

petrleocompel commented 7 months ago

Can you take a screenshot of users page? (just hide your email and name from that)

HappyPlotter commented 7 months ago

image

petrleocompel commented 7 months ago

So you are logging in with user 501.

HappyPlotter commented 7 months ago

Correct

petrleocompel commented 7 months ago

Can you post screenshot of the configuration from HA ? (again anonymise your details) image

HappyPlotter commented 7 months ago

image

Edit : There is a code there but I removed it for the picture

petrleocompel commented 7 months ago

Can you try to disable option for including areas ? and then try to arm ? And which "zone" are you trying to arm ?

petrleocompel commented 7 months ago

But option "use code for arming" is disabled. So please do not input the code.

HappyPlotter commented 7 months ago

The AX pro as a whole. I still get the error

image

HappyPlotter commented 7 months ago

I have tried all the possible ways, with code, without code, with zones and without zones

petrleocompel commented 7 months ago

I will have to check my firmware version and get back to this to review what is happening.

petrleocompel commented 7 months ago

I have tried all the possible ways, with code, without code, with zones and without zones

I guess results were all time the same "lowPrivilege".

HappyPlotter commented 7 months ago

Yes, always "lowPrivilege"

HappyPlotter commented 7 months ago

There is also one other warning that I see

This error originated from a custom integration.

Logger: custom_components.hikvision_axpro.model Source: custom_components/hikvision_axpro/model.py:780 integration: hikvision_axpro First occurred: 8:45:18 PM (40 occurrences) Last logged: 9:41:30 PM

Invalid detector_wiring_mode noEOL

petrleocompel commented 7 months ago

Which version of integration you are using i guess 2.1.1?

HappyPlotter commented 7 months ago

2.1.1, it is a fresh (3 week) installation

HappyPlotter commented 7 months ago

This issue is related to #108 after removing the "installer" from the user, it is arming and disarming

petrleocompel commented 7 months ago

Closed via #108