dahua
dahua copied to clipboard
Not receiving events from NVR5xxx-I
Version
Latest
Describe the bug
When using the NVR5-I series, no events are received by the event handler. I have tested three models of NVR two of which are "-I" series and one which isn't. The one that isn't and is just a standard "4KS2" model works fine, I can receive all events from the unit.
Units Tested:
| NVR5216-8P-I | System Version | V4.002.0000000.0, Build Date: 27-07-2021 | No Events Received |
|---|
| NVR5216-16P-I | System Version | V4.002.0000000.0, Build Date: 27-07-2021 | No Events Received |
|---|
| NVR5416-16P-4KS2 | System Version | V4.001.0000007.1, Build Date: 27-08-2021 | Event Received Ok |
|---|
I'm having the same issue. I've only get some smart motion detecions randomply but could not replicate it again. I'm using DH-XVR5108HS-I3
Other things that happens on my setup is that:
- let say I add channel 0 (camara 1) and channel 1 (Camara 2)
- I disable smart motion detection for channel 1 (Camara 2) on HA
- Checking on the NVR, the disabled camara is "Camara 1"
No matter for wich camara I disable / enable smart motion detecion, the one that is disabled is channel 0 (Camara 1)
I don't have experience to attache more info, but please let me know if I can give more details.
Any help appretiated, thanks.
This is the log while I'm having smart motion events but seems not to be on ha
2022-03-01 22:09:34 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '3', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:09:34 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '3', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:09:42 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '2', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:09:42 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '2', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:09:44 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '3', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:09:44 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '3', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:09:51 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '1', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:09:51 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '1', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:09:53 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '2', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:09:53 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '2', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:09:54 DEBUG (MainThread) [custom_components.dahua] ClientError fetching information from https://192.168.0.167:443/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[0][0]
2022-03-01 22:09:54 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 1.595 seconds (success: True)
2022-03-01 22:10:02 DEBUG (MainThread) [custom_components.dahua] ClientError fetching information from https://192.168.0.167:443/cgi-bin/configManager.cgi?action=getConfig&name=Lighting[1][0]
2022-03-01 22:10:03 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '2', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:10:03 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '2', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:10:03 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 1.572 seconds (success: True)2022-03-01 22:10:04 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 0: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '3', 'data': {'SmartMotionEnable': True}}]
2022-03-01 22:10:04 DEBUG (MainThread) [custom_components.dahua] Events received from 192.168.0.167 on channel 1: [{'Code': 'VideoMotion', 'action': 'Stop', 'index': '3', 'data': {'SmartMotionEnable': True}}]
Hi @mooton85 For me it start to work if when linking each channel of the XVR I choose less options (for eg. just "smart motion detecion") What is not working yet is the avilability to enable / disable smart motion detcion (always channel 0 is updated)
Sounds like a different issue to mine to be honest, I get nothing at all.
I have noticed something in the log which I missed initially as I do have a doorbell/VTO attached and thought this was a false error as it works fine.....
2022-03-08 23:00:18 ERROR (Thread-10) [custom_components.dahua] Connection to VTO failed will try to connect in 30 seconds, error: [Errno 111] Connect call failed ('192.168.1.97', 5000), Line: 121
2022-03-08 23:00:20 DEBUG (MainThread) [custom_components.dahua] Finished fetching dahua data in 0.582 seconds (success: True)
However, the IP address listed is the NVR5-I not the doorbell, so it maybe this is related to the problem, if the integration is detecting the NVR5-I as a VTO/Doorbell and failing to subscribe to push (other functions work fine). When I add the NVR5-4KS2 this error is not present.
I think you might be onto something with the doorbell. I have the following in my logs constantly Connection to VTO failed will try to connect in 30 seconds, error: [Errno 111] Connect call failed ('192.168.1.20', 5000), Line: 121
This is the IP address of my NVR, not the doorbell. The doorbell works fine and I receive events from it without issue directly (192.168.1.21). However I receive NO events at all from the NVR for any of the events that happen.
My NVR is a DHI-NVR5208-8P-4KS2E model.
@rroller is there any logging or access I can give you to help troubleshoot this problem. More then happy to work with you to figure out what is going on.
Sorry just haven't had any free time to dig in. Hopefully soon
Not a problem. Let me know if I can provide anything to help out.
@rroller I found a line of code that is causing the issue for me at least. My NVR is a DHI-NVR5208-8P-4KS2E and this was causing it to be detected as a doorbell. Not sure what other systems start with DHI, but for me at least I was able to get it working by simply removing the DHI check as per the blow sample. This is from line 504 in init.py
def is_doorbell(self) -> bool:
""" Returns true if this is a doorbell (VTO) """
m = self.model.upper()
"""return m.startswith("VTO") or m.startswith("DHI") or self.is_amcrest_doorbell()"""
return m.startswith("VTO") or self.is_amcrest_doorbell()
@rroller I found a line of code that is causing the issue for me at least. My NVR is a DHI-NVR5208-8P-4KS2E and this was causing it to be detected as a doorbell. Not sure what other systems start with DHI, but for me at least I was able to get it working by simply removing the DHI check as per the blow sample. This is from line 504 in init.py
def is_doorbell(self) -> bool: """ Returns true if this is a doorbell (VTO) """ m = self.model.upper() """return m.startswith("VTO") or m.startswith("DHI") or self.is_amcrest_doorbell()""" return m.startswith("VTO") or self.is_amcrest_doorbell()
same problem here with dhi-nvr2108hs-i. removing dhi detection solved the problem for me too .
@dracon80 I've only just got round to trying this and confirm that it fixed my issue too. Thanks for the info as it was driving me mad and I would have never found that.
Strange that only my -I unit was affected as pretty much any branded Dahua recorder starts with DHI.
I have been troubleshooting this for weeks with no events flowing. It was working fine before for many months until maybe 1 month ago. Not sure why this turned up as an issue now when I think this lib has had no changes. But I can confirm editing out the m.startswith("DHI") restores events flowing. My cams/nvr is N85DL6Z cam, N54B3P2 NVR. I have no doorbell. The cams all appear fine in home assistant, but the events for motion (or anthing it seemed) stopped flowing maybe 1 month ago and all my automations didn't work.
This was the error that was showing up, same as above and all events stopped flowing until this fix was applied. Now this error no longer appears and events flow.
[custom_components.dahua] Connection to VTO failed will try to connect in 30 seconds, error: [Errno 111] Connect call failed ('{edit}', 5000),
My suspicion is that a recent NVR firmware and camera firmwware updates (I did both) altered the name it returned and used by this library. So maybe before it didn't start with DHI, but did now.
If anyone has both an NVR and VTO like me, then you're better off renaming it to "m.startswith("DHI-VTO") otherwise removing it completely fixes the NVR but introduces the issue on the VTO.
{Putting this comment back in but using my personal account; this comment was just before mooton85 last comment before}....Circling back on this. Recent update on this line in the init.py still has an issue for folks with no doorbell, but have certain types of NVR. Suggest striking the "m.startswith("DHI")" or making it more specific like m.startswith("DHI-VTO"). Right now the line as is with DHI will quietly have all events fail for people using this but have no doorbell. My NVR is model N54B3P. It apparently returns DHI in the name but there is no doorbell. The logs ends up with notes around VTO failed to connect and no events flow, silently.
def is_doorbell(self) -> bool: """ Returns true if this is a doorbell (VTO) """ m = self.model.upper() #return m.startswith("VTO") or m.startswith("DH-VTO") or m.startswith("DHI") or self.is_amcrest_doorbell() return m.startswith("VTO") or m.startswith("DH-VTO") or self.is_amcrest_doorbell()
I have exactly the same problem with my NVR: DHI-NVR5216-16P-4KS2E. I have 8 cameras Dahua IPC-HDW3849HP-AS-PV-28-S3 connected to it. And I have activated https.
I don't see any event in HA using the standard custom_integration. When removing the DHI check, events are working.
{Putting this comment back in but using my personal account; this comment was just before mooton85 last comment before}....Circling back on this. Recent update on this line in the init.py still has an issue for folks with no doorbell, but have certain types of NVR. Suggest striking the "m.startswith("DHI")" or making it more specific like m.startswith("DHI-VTO"). Right now the line as is with DHI will quietly have all events fail for people using this but have no doorbell. My NVR is model N54B3P. It apparently returns DHI in the name but there is no doorbell. The logs ends up with notes around VTO failed to connect and no events flow, silently.
def is_doorbell(self) -> bool: """ Returns true if this is a doorbell (VTO) """ m = self.model.upper() #return m.startswith("VTO") or m.startswith("DH-VTO") or m.startswith("DHI") or self.is_amcrest_doorbell() return m.startswith("VTO") or m.startswith("DH-VTO") or self.is_amcrest_doorbell()
Thanks, this solved it for me. I have a DHI-NVR5216-16P-4KS2E NVR.
Same issue with my DHI-NVR5208-8P-4KS2E NVR.
I changed this in __init__.py
def is_doorbell(self) -> bool:
""" Returns true if this is a doorbell (VTO) """
m = self.model.upper()
"""return m.startswith("VTO") or m.startswith("DHI") or self.is_amcrest_doorbell()"""
return m.startswith("VTO") or self.is_amcrest_doorbell()
to:
def is_doorbell(self) -> bool:
""" Returns true if this is a doorbell (VTO) """
m = self.model.upper()
"""return m.startswith("VTO") or self.is_amcrest_doorbell()"""
return m.startswith("VTO") or self.is_amcrest_doorbell()
And after a restart the NVR was no longer detected as a doorbell and stopped generating errors about connection to VTO.
Thanks dracon80 for the solution.