Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Hikvision IP Cam disconnected by AX Pro #124

Open
enrico-stronati opened this issue Sep 9, 2024 · 18 comments
Open

Hikvision IP Cam disconnected by AX Pro #124

enrico-stronati opened this issue Sep 9, 2024 · 18 comments
Assignees
Labels
question Further information is requested

Comments

@enrico-stronati
Copy link

Hi, I have tried more and more to understande why all my IP Cameras are disconnected by AX Pro when hikaxpro_hacs is activeted.

I have even tried to de-active the HA integration above and no cameras lost connection.

When this happens, after a few seconds, the cameras' connection is again bringed on.

The disconnection happen - more or less - one time on two days, without a rational rule. Sometime one time a day, sometimes not happen for more days.

There is a way to grab debug information on this specific aspects thet could be useful for you?

Regards

@petrleocompel petrleocompel self-assigned this Sep 10, 2024
@petrleocompel petrleocompel added the question Further information is requested label Sep 10, 2024
@petrleocompel
Copy link
Owner

Home assistant logs are standard thing.

No clue why your cameras would be disconnected after that. We use only standard API of the device.
Sadly at this it sound like the Hikvision device is unable to handle all the requests which are being there.
(camera, cloud, local API)

In this case there might not even be something in the logs. 😞

More questions about your setup.

  • wired or wireless cameras?
  • is your device wired or is connected wireless?
  • what model of device you have?
  • Cannot be that your network ? DHCP renewal? Switch restart? or something?

@enrico-stronati
Copy link
Author

Hi petrleocompel, thanks a lot for your reply.
I'm going to answer your questions.

  • wired or wireless cameras?
    R: wired IP cams.

  • is your device wired or is connected wireless?
    R: AX Pro panel is connected by LAN and by WiFi and setted to use LAN as preferred.

  • what model of device you have?
    R: AX Pro model DS-PWA96-M2H-WE, cams are DS-2CD2346G2-ISU/SL and DS-2CD2046G2-IU

  • Cannot be that your network ?
    R: no, I have a monitoring system for LAN and no other issues I have.

  • DHCP renewal?
    R: No, I use static IP address for cams, control panel and LAN devices. Only for "clients" I use DHCP wih a different subnet.

  • Switch restart? or something?
    R: I exclude this kind of problems.

It seems somethings like AXPro threshold, after a while (no possibility to desume a rule) the AXPro cut-off the IP connection.
But this happens only when your plug-in is running on HA. If I stops it, no disconnections happen.

I know there is a way to have HA debug, but this not help us because the connection is broken by the AX Pro. Do you know if there is a way to trace specific kind of issues on AX Pro?

Regards.

@petrleocompel
Copy link
Owner

Great responses.

  • DS-PWA96-M2H-WE - should be capable enough... but no clue how it handles the cameras processing.

Sadly HikVision is currently kinda black box... I do not even have an access to current "developer docs" they closed it behind portal for "partners".

So 90 % of currently implemented stuff is from old docs and reverse engineering apps / requests. Even before docs were sometimes not including values and stuff which device really sends.

Just as I was going through a little bit of details of the device take a look in yours...
http://{yourDeviceIP}/doc/index.html#/operations/maintain/deviceTest

Device log can be enabled and exported. Maybe there could be something.

But I noticed the SSH option. I will have to take a look on the internals of the system. What is it running.

@enrico-stronati
Copy link
Author

Here you have the log.

  • ==> IP Addr of my HA appliance
  • xxxxxxxxx ==> user used by AX Pro addon on HA
  • Guasti ==> ERROR

Let me know if this is useful.

cidLog.txt

@petrleocompel
Copy link
Owner

Sadly log is not really helpful. No event is visible there. 😞

@enrico-stronati
Copy link
Author

enrico-stronati commented Sep 15, 2024

Hi petrleocomplel,

I tried to catch some error raised by HA and I catch the follow, I hope it could give you more details.

Registratore: custom_components.hikvision_axpro
Fonte: helpers/update_coordinator.py:367
Integrazione: hikvision_axpro
Prima occorrenza: 10 settembre 2024 alle ore 23:29:45 (4 occorrenze)
Ultima registrazione: 14:15:25

Error requesting hikvision_axpro data: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
Error requesting hikvision_axpro data: HTTPConnectionPool(host='192.168.1.9', port=80): Max retries exceeded with url: /ISAPI/SecurityCP/status/subSystems?format=json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f96cda8ec30>: Failed to establish a new connection: [Errno 111] Connection refused'))
Error requesting hikvision_axpro data: HTTPConnectionPool(host='192.168.1.9', port=80): Max retries exceeded with url: /ISAPI/SecurityCP/status/subSystems?format=json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f96d04cb470>: Failed to establish a new connection: [Errno 111] Connection refused'))

After this error the cams have lost the connection with AXPro and then they are been reconnected.

Regards.

@petrleocompel
Copy link
Owner

Yeah this is saying that the device is not accepting connection. More and more it seems more like a crash on the device side.

@enrico-stronati
Copy link
Author

When you say "device side" you mean AX Pro or Cams?

@petrleocompel
Copy link
Owner

Device is always the "AX Pro" in this context. The notifications you are getting are basically that the device seems to reboot or close connections.

It could be actually problem of "overload" what is your settings of the integration? What is the pull interval you have configured ?

@enrico-stronati
Copy link
Author

Hi petrleocompel, first of all, many thanks for you support.

My AX Pro installation has many wired sensors and a few wireless, following the list:

  • 9 cams, 4 of them with videocheck
  • 3 sirens
  • 1 keyboard
  • 1 remote control
  • 31 sensors (28 wired and 3 wireless)

Pull interval is set to 2 seconds.

@petrleocompel
Copy link
Owner

petrleocompel commented Sep 16, 2024

I think you answered it for yourself. 2 seconds pull + 31 sensors + 9 cams ....

Increase the pull interval and the stability will get better.

AX pro is not a powerful device. It will do the job but pull 2 sec can cause some troubles. Especially with cameras checking.

@enrico-stronati
Copy link
Author

I don't know how your add-on works....if I understand, correct execution is related to shooting range and number of sensors?
If so, how could the HA quickly detect alarm conditions?
In other words, if I set 15 secs and a window is opened, how many time does HA take to receive alarn condition?

@petrleocompel
Copy link
Owner

No not at all.
The integration is pulling state of the system.
We cannot receive "events" from the system there is no API for that. See issue #2

If you set it to 15 sec and somebody opens and closes the window in that 15 sec interval it not be seen in HA.
Sadly all of this is more problem of the hikvision than the integration.
We could do the pull more often but then the AXPro is not powerful enough to handle all the requests.

@enrico-stronati
Copy link
Author

Mhmmm, this doesn't allow to use sensors linked to the control panel to start automations, for example.
What do you think about?
Have you other experience on this need?
So, I will try to reduce polling frequency and then will give you back a feeedback.

@petrleocompel
Copy link
Owner

You can use then. The trigger will just take longer "trigger".

Problematic is if the "state would return to previous one before triggering in HA.

This is the scenarios and what can happen.

image

@enrico-stronati
Copy link
Author

Ok, I understand.
Is there a way to "opt out" of polling all objects in the AX Pro environment that are not used by HA?
This could be useful in this case. Because of the above scheme I intend to use HA only to arm/disarm with code and to read the status of windows.
Grazie (regards).

@petrleocompel
Copy link
Owner

Nope.
Also it really would not be. There is not much to opt-out. We pull 3 apis.

  • "zone status" - all zones and their states
  • "sensor statuses" - all sensors and their states
  • "relays statuses" - all relays and their states

if you do not have for example "any relay" the system response will be instant. So zero need to opt-out.

@enrico-stronati
Copy link
Author

Hi Petr Leo Compel, just to know you that with a more long time polling, the system seems be more stable.
Regards.

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

No branches or pull requests

2 participants