kushagharahi / homebridge-dahua-alerts

Routes motion alerts for Dahua and Lorex camera streams to homebridge-camera-ffmpeg
27 stars 13 forks source link

Error Details: Didn't get a response from the NVR - connect ECONNREFUSED #11

Closed gharshaw closed 3 years ago

gharshaw commented 3 years ago

I've stepped thru all the recommendations you made with the closed issue #1. I can get postman index results when I use HTTP. It appears to me that you are requiring or sending the call to the NVR with HTTPS. Is there a way to change the config to make the call with HTTP and not HTTPS? Thanks

kushagharahi commented 3 years ago

Hi there, could you post some debug logs for me? Definitely possible to add that feature in, although I'm somewhat suspect that is the root cause. My NVR is extremely old and supports both HTTP and HTTPS.

gharshaw commented 3 years ago

[2/18/2021, 11:30:10 PM] [dahua-alerts] Error Received (for more info enable debug logging) [2/18/2021, 11:30:10 PM] [dahua-alerts] Error Details: Didn't get a response from the NVR - connect ECONNREFUSED 192.168.10.161:443 [2/18/2021, 11:30:10 PM] [dahua-alerts] Reconnecting in 10s. [2/18/2021, 11:30:20 PM] [dahua-alerts] Error Received (for more info enable debug logging) [2/18/2021, 11:30:20 PM] [dahua-alerts] Error Details: Didn't get a response from the NVR - connect ECONNREFUSED 192.168.10.161:443 [2/18/2021, 11:30:20 PM] [dahua-alerts] Reconnecting in 10s. [2/18/2021, 11:30:30 PM] [dahua-alerts] Error Received (for more info enable debug logging) [2/18/2021, 11:30:30 PM] [dahua-alerts] Error Details: Didn't get a response from the NVR - connect ECONNREFUSED 192.168.10.161:443 [2/18/2021, 11:30:30 PM] [dahua-alerts] Reconnecting in 10s. [2/18/2021, 11:30:40 PM] [dahua-alerts] Error Received (for more info enable debug logging) [2/18/2021, 11:30:40 PM] [dahua-alerts] Error Details: Didn't get a response from the NVR - connect ECONNREFUSED 192.168.10.161:443 [2/18/2021, 11:30:40 PM] [dahua-alerts] Reconnecting in 10s.

gharshaw commented 3 years ago

I have Homebridge in debug mode - is there a way to create additional debug output with dahua-alerts?

kushagharahi commented 3 years ago

No that's perfect. I have one other request. Can you look in the networking menus, under connection perhaps for an Enable https button?

It might look something like this. image

Also, what is your NVR model?

kushagharahi commented 3 years ago

Two other people had to do the same in the previous issues, such as: https://github.com/kushagharahi/homebridge-dahua-alerts/issues/10#issuecomment-762517347

gharshaw commented 3 years ago

Just rechecked my NVR and 443 was not enabled. I saw port 443 configured I missed the checkbox to enable it :-/ -

Now I am getting a different error

node:123226) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification. (Use node --trace-warnings ... to show where the warning was created) (node:123226) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '1' of undefined at /usr/lib/node_modules/homebridge-dahua-alerts/src/dahua.ts:87:53 at processTicksAndRejections (internal/process/task_queues.js:93:5) (node:123226) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:123226) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

kushagharahi commented 3 years ago

Hmm, I doubt this will change anything but could you try restarting homebridge?

gharshaw commented 3 years ago

Restarted - same error in log

gharshaw commented 3 years ago

Lorex NR818

kushagharahi commented 3 years ago

Ok, could you please replace the dist folder contents in homebridge\node_modules\homebridge-dahua-alerts\dist with the contents of this zip and restart? I've added a debug log to see if I can figure out the issue.

dist.zip

This won't fix the issue, it will just help me diagnose it further.

kushagharahi commented 3 years ago

Oh and post all the debug logs once you do that please!

kushagharahi commented 3 years ago

Ok that was really helpful, thanks! Can you try this for me? I think it might fix this specific bug.

dist.zip

gharshaw commented 3 years ago

Error is gone and received a motion alert :-) homebridge.log.txt

gharshaw commented 3 years ago

How quickly should a motion alert on the camera be detected by your plugin?

kushagharahi commented 3 years ago

How quickly should a motion alert on the camera be detected by your plugin?

It is instant as it subscribes to the websocket endpoint provided by your NVR. You can verify this by triggering motion alerts and watching the logs. Ensure you have the config for homebridge-camera-ffmpeg setup correctly. Specifically make sure to set motionTimeout to 0.

I just pushed version 1.1.2, could you please install it and verify it works as well?

gharshaw commented 3 years ago

Installed 1.1.2 and it works as well. I appreciate the plugin and the help. Enjoy the coffee :-) homebridge.log.txt

kushagharahi commented 3 years ago

Thanks for testing the latest version and verifying that it's working! Coffee is much appreciated as well 😄

If you run into any other problems please don't hesitate to open another issue!