Hikvision-Addons
Hikvision-Addons copied to clipboard
Detect when a unit is freezed or not responding.
Is there an existing feature request for this?
- [X] I have searched the existing issues
Add-on
Doorbell
Your feature request
My KV6113 sometimes freeze I need to reset by turning off/on the POE port of switch. Will be very nice if the Addon can trigger alert when this situation is detected.
Above the log when the device is freezes: [2023-10-07 06:57:20.149][DBG] [0]CUser::SendHeartWithExceptCB network error[10], times[1] [2023-10-07 06:57:20.149][ERR] [0]Exception changes 1 [2023-10-07 06:57:20.149][DBG] CUser::ProcessException[0] [2023-10-07 06:57:35.908][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 06:58:05.943][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 06:58:35.975][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 06:59:06.005][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 06:59:20.159][DBG] [0]CUser::SendHeartWithExceptCB network error[10], times[1] [2023-10-07 06:59:20.159][ERR] [0]Exception changes 1 [2023-10-07 06:59:20.159][DBG] CUser::ProcessException[0] [2023-10-07 06:59:36.030][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:00:11.074][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:00:36.093][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:01:06.153][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:01:20.181][DBG] [0]CUser::SendHeartWithExceptCB network error[10], times[1] [2023-10-07 07:01:20.181][ERR] [0]Exception changes 1 [2023-10-07 07:01:20.181][DBG] CUser::ProcessException[0] [2023-10-07 07:01:36.184][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:02:06.233][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:02:36.265][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:03:06.307][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:03:20.213][DBG] [0]CUser::SendHeartWithExceptCB network error[10], times[1] [2023-10-07 07:03:20.213][ERR] [0]Exception changes 1 [2023-10-07 07:03:20.213][DBG] CUser::ProcessException[0] [2023-10-07 07:03:36.346][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:04:06.388][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:04:36.429][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:05:11.480][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:05:20.235][DBG] [0]CUser::SendHeartWithExceptCB network error[10], times[1] [2023-10-07 07:05:20.235][ERR] [0]Exception changes 1 [2023-10-07 07:05:20.235][DBG] CUser::ProcessException[0] [2023-10-07 07:05:41.515][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:06:11.532][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:06:41.572][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:07:11.601][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:07:20.281][DBG] [0]CUser::SendHeartWithExceptCB network error[10], times[1] [2023-10-07 07:07:20.281][ERR] [0]Exception changes 1 [2023-10-07 07:07:20.281][DBG] CUser::ProcessException[0] [2023-10-07 07:07:41.646][DBG] Alarm chan [0] recv timeout[2]!
I hope I can reproduce the same error if I take out the UTP :-)
In my case I still can ping the device, but the device does not respond any ISAPI request.
Below the test code I use to test if the device is responding and reset it from the switch: ` import requests from requests.auth import HTTPDigestAuth import time
s = requests.Session() r = requests.Response erro = False
try: r = s.get('http://10.10.10.23/ISAPI/System/deviceInfo', auth = HTTPDigestAuth('admin', 'xxxxxxx'), timeout=5) r.raise_for_status() except requests.exceptions.HTTPError as errh: print ("Http Error:",errh) erro = True except requests.exceptions.ConnectionError as errc: print ("Error Connecting:",errc) erro = True except requests.exceptions.Timeout as errt: print ("Timeout Error:",errt) erro = True except requests.exceptions.RequestException as err: print ("OOps: Something Else",err) erro = True print(erro) if erro == True: r = s.post('http://10.10.10.3/logon.cgi', data={'username': 'admin', 'password': 'xxxxxx', 'logon': 'Login'}, timeout=5) r = s.post('http://10.10.10.3/poe_port_config.cgi', data={'aaplay': 'Apply', 'name_pstate': '1', 'sel_16': '1'}, timeout=5) time.sleep(1) r = s.post('http://10.10.10.3/poe_port_config.cgi', data={'aaplay': 'Apply', 'name_pstate': '2', 'sel_16': '1'}, timeout=5) `
In my case I still can ping the device, but the device does not respond any ISAPI request.
Below the test code I use to test if the device is responding and reset it from the switch:
import requests
from requests.auth import HTTPDigestAuth
import time
s = requests.Session()
r = requests.Response
erro = False
try:
r = s.get('http://10.10.10.23/ISAPI/System/deviceInfo', auth = HTTPDigestAuth('admin', 'xxxxxxxxxx'), timeout=5)
r.raise_for_status()
except requests.exceptions.HTTPError as errh:
print ("Http Error:",errh)
erro = True
except requests.exceptions.ConnectionError as errc:
print ("Error Connecting:",errc)
erro = True
except requests.exceptions.Timeout as errt:
print ("Timeout Error:",errt)
erro = True
except requests.exceptions.RequestException as err:
print ("OOps: Something Else",err)
erro = True
print(erro)
if erro == True:
r = s.post('http://10.10.10.3/logon.cgi', data={'username': 'admin', 'password': 'xxxxxxxx', 'logon': 'Login'}, timeout=5)
r = s.post('http://10.10.10.3/poe_port_config.cgi', data={'aaplay': 'Apply', 'name_pstate': '1', 'sel_16': '1'}, timeout=5)
time.sleep(1)
r = s.post('http://10.10.10.3/poe_port_config.cgi', data={'aaplay': 'Apply', 'name_pstate': '2', 'sel_16': '1'}, timeout=5)
You caan also just make a rest sensor in HA, no need for a script...
But anyway, I can't do that, I need to know the state from within the SDK login session, not gonna do an external poll command...
If you unplug the UTP cable, do you see the same kind of error in addon log?
Yes, I can make a sensor in HA, but will be nice if the Addon have a "Online" status for all devices.
Maybe a trigger for this exception can help, if you want I can teste it: [2023-10-07 07:01:20.181][DBG] [0]CUser::SendHeartWithExceptCB network error[10], times[1] [2023-10-07 07:01:20.181][ERR] [0]Exception changes 1 [2023-10-07 07:01:20.181][DBG] CUser::ProcessException[0] [2023-10-07 07:01:36.184][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:02:06.233][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:02:36.265][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 07:03:06.307][DBG] Alarm chan [0] recv timeout[2]!
I turned off the POE for the device (almost the same of unplug the UTP cable) and got: [2023-10-07 11:09:19.227][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 11:09:49.255][DBG] Alarm chan [0] recv timeout[2]! [2023-10-07 11:09:54.258][DBG] Alarm chan [0] recv timeout[3]! [2023-10-07 11:09:59.266][DBG] Alarm chan [0] recv timeout[4]! [2023-10-07 11:10:04.263][DBG] Alarm chan [0] recv timeout[5]! [2023-10-07 11:10:09.267][DBG] Alarm chan [0] recv timeout[6]! [2023-10-07 11:10:14.271][INF] [0] CArmingSession::TimeoutCallBack Create ReConnectThread SUCC [2023-10-07 11:10:14.271][DBG] Alarm chan [0] reconnect thread start! [2023-10-07 11:10:14.271][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:10:17.775][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=110, timeout= 3500 [2023-10-07 11:10:17.775][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:10:17.775][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:10:22.780][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:10:25.836][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:10:25.836][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:10:25.836][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:10:30.842][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:10:33.900][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:10:33.900][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:10:33.900][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:10:38.908][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:10:41.964][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:10:41.964][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:10:41.964][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:10:46.972][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:10:50.028][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:10:50.028][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:10:50.028][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:10:55.028][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:10:58.092][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:10:58.092][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:10:58.092][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:11:03.095][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:11:06.159][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:11:06.160][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:11:06.160][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:11:11.165][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:11:14.220][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:11:14.220][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:11:14.220][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:11:19.228][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:11:21.580][ERR] Private connect 10.10.10.23:8000 sock=191 this=0x3c919fdc cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:11:21.580][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:11:21.580][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:11:21.580][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x10200 sys_err=113, timeout= 5000 [2023-10-07 11:11:21.580][DBG] [0]CUser::SendHeartWithExceptCB network error[7], times[1] [2023-10-07 11:11:21.580][ERR] [0]Exception changes 1 [2023-10-07 11:11:21.580][DBG] CUser::ProcessException[0] [2023-10-07 11:11:26.588][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:11:29.644][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:11:29.644][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:11:29.644][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:11:34.647][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:11:37.708][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:11:37.708][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:11:37.708][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:11:42.717][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:11:45.774][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:11:45.774][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:11:45.774][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:11:50.782][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:11:53.836][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:11:53.836][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:11:53.836][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:11:58.842][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:12:01.900][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:12:01.900][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:12:01.900][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:12:06.906][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:12:09.964][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:12:09.964][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:12:09.964][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7] [2023-10-07 11:12:14.972][DBG] Alarm chan [0] LinkToDVR! [2023-10-07 11:12:18.028][ERR] Private connect 10.10.10.23:8000 sock=187 this=0x3c919414 cmd=0x111020 sys_err=113, timeout= 3500 [2023-10-07 11:12:18.028][ERR] [0] CArmingSession::LinkToDVR, CreateLink Failed, Cmd[1118240], Reconnect ID[-1] [2023-10-07 11:12:18.028][ERR] ReConnect Alarm chan [0] LinkToDVR failed![err:7]
Hmm, i had a look, but those logs are i believe logs saved to file, i'm not sure if i can trigger on those, i need @mion00 his help here :-)