CornerBit / HikSink

Converts Hikvision camera events to MQTT
MIT License
70 stars 7 forks source link

Problem with constant reconnection: "Camera errored: Camera closed connection. Attempting reconnection..." #9

Open MindrustUK opened 2 years ago

MindrustUK commented 2 years ago

Just installed Hiksink (Standalone) and have it pointed at a Hikvision NVR. While it works, it keeps re-connecting as follows:

2022-06-15T11:01:59.543416Z  INFO hik_sink: HikSink MQTT bridge running
2022-06-15T11:01:59.543578Z  INFO Camera coms{camera=nvr id=nvr}: hik_sink::hikapi::camera: Initiating camera connection...
2022-06-15T11:01:59.706182Z  INFO Camera coms{camera=nvr id=nvr}: hik_sink::hikapi::camera: Camera connection established
2022-06-15T11:01:59.954008Z  INFO hik_sink::mqtt::connection: Connected to MQTT broker.
2022-06-15T11:02:14.121856Z  WARN Camera coms{camera=nvr id=nvr}: hik_sink::hikapi::camera: Camera errored: Camera closed connection. Attempting reconnection...
2022-06-15T11:02:14.294195Z  INFO Camera coms{camera=nvr id=nvr}: hik_sink::hikapi::camera: Camera connection established
2022-06-15T11:02:50.662578Z  WARN Camera coms{camera=nvr id=nvr}: hik_sink::hikapi::camera: Camera errored: Camera closed connection. Attempting reconnection...
2022-06-15T11:02:50.806763Z  INFO Camera coms{camera=nvr id=nvr}: hik_sink::hikapi::camera: Camera connection established

Any ideas what could be causing this or if it's intended behavior? I would've thought connections should be persistent once established?

CornerBit commented 2 years ago

The NVR is probably returning responses HikSink can't interpret. Hikvision NVRs have been the worst offenders when it comes to non-conforming event streams, so I generally recommend pointing HikSink directly at the cameras. What is the model of the NVR? Can you enable DEBUG in the config and post the logs? Cheers.

MindrustUK commented 2 years ago

Thanks for responding, the model of the NVR is: DS-7608NXI-I2

Log as attached: [nvr-debug.log](https://github.com/CornerBit/HikSink/files/8928574/nvr-debug.log

CornerBit commented 2 years ago

The NVR is closing the connection with HikSink. Can you take a look at the NVR side and see if there are any warnings in the logs?

MindrustUK commented 2 years ago

As per attached screenshot, the notable event appears to be related to: "Remote: Alarm Disarming/ Remote: Alarm Arming", any thoughts?

Screenshot from 2022-06-20 10-24-58

CornerBit commented 2 years ago

That's a very strange message to show up! Accessing the event stream shouldn't perform any actions on the NVR. Can you check if your NVR is on the latest version?

MindrustUK commented 2 years ago

I've just made sure to update to the latest firmware (V4.61.010 build 220606 ) still seeing the problem with the associated armed / disarmed messages. I'll see if I can turn up anything more with additional investigation...