maciej-or / hikvision_next

Home Assistant integration for Hikvision NVRs and IP cameras
104 stars 20 forks source link

Failed to setup with NVR model: DS-7616NI-E2 / 16P #5

Closed RASBR closed 1 year ago

RASBR commented 1 year ago

Hi, Sadly, didn't get it to work. below the error message from HA. any chance this will work with my NVR model?

Thanks :)

This error originated from a custom integration.

Logger: homeassistant.config_entries Source: custom_components/hikvision_next/isapi.py:303 Integration: Hikvision NVR / IP Camera (documentation) First occurred: 27 February 2023 at 19:42:11 (7 occurrences) Last logged: 00:54:11

Error setting up entry RSBR NVR for hikvision_next Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 382, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/hikvision_next/init.py", line 56, in async_setup_entry await isapi.set_alarm_server( File "/config/custom_components/hikvision_next/isapi.py", line 303, in set_alarm_server and host["ipAddress"] == address.hostname KeyError: 'ipAddress'

HIKVision NVR

RASBR commented 1 year ago

FYI... Tried installing integration again while UNCHECKING the alarm server creation, and it worked. but without:

HIKVision NVR1

RASBR commented 1 year ago

Hi, Seems it is not working yet. I don't know what is wrong still looking into it. I noticed that in some lines the IP address is somehow duplicated (192.168.192.168x.x)

Any advice?

Log: (IP changed) This error originated from a custom integration.

Logger: custom_components.hikvision_next.isapi Source: custom_components/hikvision_next/isapi.py:345 Integration: Hikvision NVR / IP Camera (documentation) First occurred: 01:01:55 (964 occurrences) Last logged: 17:02:38

Unexpected exception Cannot fetch state for scenechangedetection Client error '403 Forbidden' for url 'http://192.168.x.x/ISAPI/Smart/SceneChangeDetection/1' For more information check: https://httpstatuses.com/403 Unexpected exception Cannot fetch state for regionentrance Client error '403 Forbidden' for url 'http://192.168.192.168.x.x/ISAPI/Smart/regionEntrance/1' For more information check: https://httpstatuses.com/403 Unexpected exception Cannot fetch state for regionexiting Client error '403 Forbidden' for url 'http://192.168.192.168.x.x/ISAPI/Smart/regionExiting/1' For more information check: https://httpstatuses.com/403 Unexpected exception Cannot fetch state for fielddetection Client error '403 Forbidden' for url 'http://192.168.192.168.x.x/ISAPI/Smart/FieldDetection/1' For more information check: https://httpstatuses.com/403 Unexpected exception Cannot fetch state for linedetection Client error '403 Forbidden' for url 'http://192.168.x.x/ISAPI/Smart/LineDetection/1' For more information check: https://httpstatuses.com/403

HIKVision NVR2

maciej-or commented 1 year ago

hi, thanks for testing this early version the first issue has been submitted yesterday https://github.com/maciej-or/hikvision_next/issues/3 and is under development

403 errors can occur after NVR reboot (reload integration is needed then) or user has no permissions, please compare https://github.com/maciej-or/hikvision_next#hikvision-device-setup-checklist

maciej-or commented 1 year ago

please check dev branch with all fixes https://github.com/maciej-or/hikvision_next/tree/dev I recommend remove device from HA, copy new integration version and add device again.

RASBR commented 1 year ago

Sadly I am not very experienced in git and code. I think I will wait for the auto update.

Or will a complete removal and fresh download do the same result?

maciej-or commented 1 year ago

you can simply download zip by clicking green button Code on branch page https://github.com/maciej-or/hikvision_next/tree/dev

RASBR commented 1 year ago

Now I get "Device is already configured" but the integration nor the entities show in HA. I did the following:

  1. Deleted contents of Folder custom_components/hikvision_next
  2. Downloaded the zipfile, placed its contents in the folder mentioned in step 1
  3. Restarted HA
  4. Added the integration - "Device is already configured"

Thought to share

maciej-or commented 1 year ago

You did not remove device as I suggested. So:

  1. go to Settings / Devices & Services
  2. find existing Hikvision NVR / IP Camera integration tile
  3. from three dots menu select Delete now you can add NVR again using [+ Add Integration] button I keep my fingers crossed
RASBR commented 1 year ago

Nothing changed.

I even tried removing the HACS integration from the 'Three dots' and download it again. same message!

RASBR commented 1 year ago

Hi, Were you able to find a fix?

maciej-or commented 1 year ago

If removing device didn't help, the only way is modify core.device_registry file.

! PLEASE DO BACKUP before !

Edit config/.storage/core.device_registry and remove all entries associated with hikvision_next identifier. Restart HA after that and try add NVR.

entries to remove will look like:

  {
    "area_id": null,
    "config_entries": [
      "ed9e2c698a48ff933f1c8d66bfde2825"
    ],
    "configuration_url": null,
    "connections": [],
    "disabled_by": null,
    "entry_type": null,
    "hw_version": null,
    "id": "51ef0f99e8cb345818aad0845a99ee07",
    "identifiers": [
      [
        "hikvision_next",
        "DS-2CD3T20D-I36ee9dc0000000000"
      ]
    ],
    "manufacturer": "Hikvision",
    "model": "DS-2CD3T20D-I3",
    "name_by_user": null,
    "name": "gate",
    "sw_version": "V5.4.23 build 161020",
    "via_device_id": "c457f09b19222a64940d4a0000000000"
  }
RASBR commented 1 year ago

Hi, Firstly allow me to say big thank you! I guess the removal was successful. I did the following:

  1. Made sure I have a very recent backup (thanks for the reminder)
  2. Uninstalled (removed) integration from HACS.
  3. Edited 'core.device_registry' exactly as you said.
  4. Rebooted HA (I have Intel NUC with HA OS)

HA restarted and seems to be working.

Did you update/fix the integration? Should I try to install again?

maciej-or commented 1 year ago

As far fixes are stil on dev branch, you can test it. The release will come soon.

maciej-or commented 1 year ago

https://github.com/maciej-or/hikvision_next/releases/tag/v1.0.1

RASBR commented 1 year ago

Thanks for the notice. Did a quick install, on the Integration page I am not seeing the 'Connected Devices'. Will check and read documentation more later tonight.

msp1974 commented 1 year ago

I wonder if this is also the same issue as #34 as it seems it is also not loading it as a NVR but individual camera. I wonder if this is another Hikvision device_type not reporting NVR but something else?