Comments (22)
Have you done any firmware updates on your NVR's recently? If you force an event shortly after starting up the component does it show up? Having the watchdog trigger on both streams at the same time may be a network error on the HASS side of things since it's extremely unlikely for both streams to drop at the same time.
from pyhik.
I'm afraid both NVRs have actually been updated recently to newer firmware.I will try to test if events are coming through after restart once I manage to get back home. I will also try to debug eventStream to see what exactly is coming through.
from pyhik.
I have also started seeing following in the logs after reboot:
2019-11-15 12:06:13 DEBUG (Thread-6) [pyhik.hikvision] Stream Thread Started: Saturn NVR, 48373635-3035-3033-3638-186
8cb846fbf
2019-11-15 12:06:13 DEBUG (Thread-7) [pyhik.hikvision] Stream Thread Started: Neptune NVR, 48373635-3035-3034-3032-18
68cb846fe1
2019-11-15 12:06:13 DEBUG (Thread-6) [pyhik.hikvision] Saturn NVR Connection Successful.
2019-11-15 12:06:13 DEBUG (Thread-7) [pyhik.hikvision] Neptune NVR Connection Successful.
Exception in thread Thread-6:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.7/site-packages/pyhik/hikvision.py", line 497, in alert_stream
self.process_stream(tree)
File "/usr/local/lib/python3.7/site-packages/pyhik/hikvision.py", line 552, in process_stream
echid = int(echid.text)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Exception in thread Thread-7:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.7/site-packages/pyhik/hikvision.py", line 497, in alert_stream
self.process_stream(tree)
File "/usr/local/lib/python3.7/site-packages/pyhik/hikvision.py", line 552, in process_stream
echid = int(echid.text)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
This looks like #44 mentioned few days ago.
from pyhik.
self.watchdog = Watchdog(300.0, self.watchdog_handler)
Watchdog appears to be expiring exactly 5 mins because process_stream
never gets to self.watchdog.pet()
if I understand correctly.
from pyhik.
Alright, it looks like a recent firmware change may have altered the behavior on reporting the channel ID's in the event stream. If you're getting the TypeError every time the watchdog expiration and lack of events makes sense.
Just to be thorough, please try curling the event stream for one of the NVR's to make sure it's still sending out events.
from pyhik.
It does look plausable indeed. I did leave terminal open for about 30 mins and I'm getting a steady flow of events, mostly videoloss
type:
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 531
<?xml version="1.0" encoding="utf-8"?>
<EventNotificationAlert version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<ipAddress>192.168.1.200</ipAddress>
<portNo>80</portNo>
<protocolType>HTTP</protocolType>
<macAddress>18:68:cb:84:6f:bf</macAddress>
<channelID/>
<dynChannelID/>
<dateTime>2019-11-15T14:18:0600:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
<channelName/>
</EventNotificationAlert>
from pyhik.
I've merged in a fix for the blank channel ID field and released a new version. A PR is pending to update the repository in HASS but you can manually specify 0.2.5 to check it now if you'd like.
from pyhik.
Thank you. Now I'm getting following error:
Exception in thread Thread-7:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.7/site-packages/pyhik/hikvision.py", line 497, in alert_stream
self.process_stream(tree)
File "/usr/local/lib/python3.7/site-packages/pyhik/hikvision.py", line 570, in process_stream
state = self.fetch_attributes(etype, echid)
File "/usr/local/lib/python3.7/site-packages/pyhik/hikvision.py", line 618, in fetch_attributes
if sensor[1] == int(channel):
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Exception in thread Thread-6:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.7/site-packages/pyhik/hikvision.py", line 497, in alert_stream
self.process_stream(tree)
File "/usr/local/lib/python3.7/site-packages/pyhik/hikvision.py", line 570, in process_stream
state = self.fetch_attributes(etype, echid)
File "/usr/local/lib/python3.7/site-packages/pyhik/hikvision.py", line 618, in fetch_attributes
if sensor[1] == int(channel):
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
from pyhik.
Ok, I'm going to need samples from the alert stream from a couple different types of events. If the IDs are missing from everything it's not as straight forward to fix.
from pyhik.
Thank you for taking time to look into this. I can see that line crossing has channelID
and channelName
:
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 792
<?xml version="1.0" encoding="utf-8"?>
<EventNotificationAlert version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<ipAddress>192.168.1.200</ipAddress>
<portNo>80</portNo>
<protocolType>HTTP</protocolType>
<macAddress>18:68:cb:84:6f:bf</macAddress>
<channelID>5</channelID>
<dynChannelID>5</dynChannelID>
<dateTime>2019-11-17T17:53:4200:00</dateTime>
<activePostCount>4</activePostCount>
<eventType>linedetection</eventType>
<eventState>active</eventState>
<eventDescription>linedetection alarm</eventDescription>
<channelName>Side Passage</channelName>
<DetectionRegionList>
<DetectionRegionEntry>
<regionID>0</regionID>
<sensitivityLevel>0</sensitivityLevel>
<RegionCoordinatesList>
</RegionCoordinatesList>
</DetectionRegionEntry>
</DetectionRegionList>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 531
<?xml version="1.0" encoding="utf-8"?>
<EventNotificationAlert version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<ipAddress>192.168.1.200</ipAddress>
<portNo>80</portNo>
<protocolType>HTTP</protocolType>
<macAddress>18:68:cb:84:6f:bf</macAddress>
<channelID/>
<dynChannelID/>
<dateTime>2019-11-17T17:53:5100:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
<channelName/>
</EventNotificationAlert>
from pyhik.
Here is the list of my event triggers:
<?xml version="1.0" encoding="UTF-8" ?>
<EventTriggerList version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<EventTrigger>
<id>IO-1</id>
<eventType>IO</eventType>
<inputIOPortID>1</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>IO-2</id>
<eventType>IO</eventType>
<inputIOPortID>2</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>IO-3</id>
<eventType>IO</eventType>
<inputIOPortID>3</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>IO-4</id>
<eventType>IO</eventType>
<inputIOPortID>4</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>softIO-1</id>
<eventType>softIO</eventType>
<inputIOPortID>1</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>softIO-2</id>
<eventType>softIO</eventType>
<inputIOPortID>2</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>softIO-3</id>
<eventType>softIO</eventType>
<inputIOPortID>3</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>softIO-4</id>
<eventType>softIO</eventType>
<inputIOPortID>4</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>softIO-5</id>
<eventType>softIO</eventType>
<inputIOPortID>5</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>softIO-6</id>
<eventType>softIO</eventType>
<inputIOPortID>6</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>softIO-7</id>
<eventType>softIO</eventType>
<inputIOPortID>7</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>softIO-8</id>
<eventType>softIO</eventType>
<inputIOPortID>8</inputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>IO-101</id>
<eventType>IO</eventType>
<dynInputIOPortID>101</dynInputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>IO-201</id>
<eventType>IO</eventType>
<dynInputIOPortID>201</dynInputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>IO-301</id>
<eventType>IO</eventType>
<dynInputIOPortID>301</dynInputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>IO-401</id>
<eventType>IO</eventType>
<dynInputIOPortID>401</dynInputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>IO-501</id>
<eventType>IO</eventType>
<dynInputIOPortID>501</dynInputIOPortID>
<EventTriggerNotificationList>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>VMD-1</id>
<eventType>VMD</eventType>
<dynVideoInputChannelID>1</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-1</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>1</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>VMD-2</id>
<eventType>VMD</eventType>
<dynVideoInputChannelID>2</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-2</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>2</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>VMD-3</id>
<eventType>VMD</eventType>
<dynVideoInputChannelID>3</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-3</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>3</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>VMD-4</id>
<eventType>VMD</eventType>
<dynVideoInputChannelID>4</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-4</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>4</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>VMD-5</id>
<eventType>VMD</eventType>
<dynVideoInputChannelID>5</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-5</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>5</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>tamper-1</id>
<eventType>tamperdetection</eventType>
<dynVideoInputChannelID>1</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>tamper-2</id>
<eventType>tamperdetection</eventType>
<dynVideoInputChannelID>2</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>tamper-3</id>
<eventType>tamperdetection</eventType>
<dynVideoInputChannelID>3</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>tamper-4</id>
<eventType>tamperdetection</eventType>
<dynVideoInputChannelID>4</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>tamper-5</id>
<eventType>tamperdetection</eventType>
<dynVideoInputChannelID>5</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>videoloss-1</id>
<eventType>videoloss</eventType>
<dynVideoInputChannelID>1</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>videoloss-2</id>
<eventType>videoloss</eventType>
<dynVideoInputChannelID>2</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>videoloss-3</id>
<eventType>videoloss</eventType>
<dynVideoInputChannelID>3</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>videoloss-4</id>
<eventType>videoloss</eventType>
<dynVideoInputChannelID>4</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>videoloss-5</id>
<eventType>videoloss</eventType>
<dynVideoInputChannelID>5</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>fielddetection-1</id>
<eventType>fielddetection</eventType>
<dynVideoInputChannelID>1</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-1</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>1</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>fielddetection-2</id>
<eventType>fielddetection</eventType>
<dynVideoInputChannelID>2</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-2</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>2</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>fielddetection-3</id>
<eventType>fielddetection</eventType>
<dynVideoInputChannelID>3</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-3</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>3</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>fielddetection-4</id>
<eventType>fielddetection</eventType>
<dynVideoInputChannelID>4</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-4</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>4</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>fielddetection-5</id>
<eventType>fielddetection</eventType>
<dynVideoInputChannelID>5</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-5</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>5</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>linedetection-1</id>
<eventType>linedetection</eventType>
<dynVideoInputChannelID>1</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-1</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>1</dynVideoInputID>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>linedetection-2</id>
<eventType>linedetection</eventType>
<dynVideoInputChannelID>2</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-2</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>2</dynVideoInputID>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>linedetection-3</id>
<eventType>linedetection</eventType>
<dynVideoInputChannelID>3</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-3</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>3</dynVideoInputID>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>linedetection-4</id>
<eventType>linedetection</eventType>
<dynVideoInputChannelID>4</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-4</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>4</dynVideoInputID>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>linedetection-5</id>
<eventType>linedetection</eventType>
<dynVideoInputChannelID>5</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-5</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>5</dynVideoInputID>
</EventTriggerNotification>
<EventTriggerNotification>
<id>monitorAlarm</id>
<notificationMethod>monitorAlarm</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>facedetection-1</id>
<eventType>facedetection</eventType>
<dynVideoInputChannelID>1</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-1</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>1</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>facedetection-2</id>
<eventType>facedetection</eventType>
<dynVideoInputChannelID>2</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-2</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>2</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>facedetection-3</id>
<eventType>facedetection</eventType>
<dynVideoInputChannelID>3</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-3</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>3</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>facedetection-4</id>
<eventType>facedetection</eventType>
<dynVideoInputChannelID>4</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-4</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>4</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>facedetection-5</id>
<eventType>facedetection</eventType>
<dynVideoInputChannelID>5</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-5</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>5</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>faceSnap-1</id>
<eventType>faceSnap</eventType>
<dynVideoInputChannelID>1</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-1</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>1</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>faceSnap-2</id>
<eventType>faceSnap</eventType>
<dynVideoInputChannelID>2</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-2</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>2</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>faceSnap-3</id>
<eventType>faceSnap</eventType>
<dynVideoInputChannelID>3</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-3</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>3</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>faceSnap-4</id>
<eventType>faceSnap</eventType>
<dynVideoInputChannelID>4</dynVideoInputChannelID>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>record-4</id>
<notificationMethod>record</notificationMethod>
<dynVideoInputID>4</dynVideoInputID>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>diskfull</id>
<eventType>diskfull</eventType>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>diskerror</id>
<eventType>diskerror</eventType>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>nicbroken</id>
<eventType>nicbroken</eventType>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>ipconflict</id>
<eventType>ipconflict</eventType>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>illaccess</id>
<eventType>illaccess</eventType>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
<EventTrigger>
<id>recordingfailure</id>
<eventType>recordingfailure</eventType>
<EventTriggerNotificationList>
<EventTriggerNotification>
<id>email</id>
<notificationMethod>email</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>beep</id>
<notificationMethod>beep</notificationMethod>
</EventTriggerNotification>
<EventTriggerNotification>
<id>center</id>
<notificationMethod>center</notificationMethod>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
</EventTriggerList>
from pyhik.
Perhaps disable the video devices which aren't connected or turn off video loss reporting to stop video loss flooding the alert stream, then post a few different events from the alert stream.
from pyhik.
I don't have any. devices which aren't connected, those are five Hikvision cameras. Sadly there is no way to disable video loss, as it just keeps coming. My understanding is that it is used to keep connection alive and without it, it would simply timeout.
from pyhik.
Strange, I don't see that on my NVR and don't have timeout issues.
from pyhik.
Funny thing is that disabling "Notify Surveillance Center" for Video Loss actually solved the problem. I fail to understand why because curling still shows them:
curl --anyauth --user XXX:YYY http://192.168.1.200/ISAPI/Event/notification/alertStream
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 531
<?xml version="1.0" encoding="utf-8"?>
<EventNotificationAlert version="2.0" xmlns="http://www.isapi.org/ver20/XMLSchema">
<ipAddress>192.168.1.200</ipAddress>
<portNo>80</portNo>
<protocolType>HTTP</protocolType>
<macAddress>18:68:cb:84:6f:bf</macAddress>
<channelID/>
<dynChannelID/>
<dateTime>2019-11-17T21:21:0900:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
<channelName/>
</EventNotificationAlert>
from pyhik.
Ok so what is probably happening and what I saw myself with my NVR is that when things are in alarm they send through dozen of messages a second, and you can only really handle a couple of devices doing this before things start going funky, did you turn it off on the camera and the stuff under exceptions?
from pyhik.
Yes. I've disabled it for all cameras. It is still supposed to keep pushing it for keep alive:
Line 564 in b0c60a0
The reason it does not cause an error is because pyHik is ignoring these types of events since we are not "subscribed" to them. The reason is does fail with Video Loss enabled is probably because execution of process_stream
is not interrupted on line 566 but is allowed to continue and it obviously fails on line 570 while trying to call fetch_attributes
.
from pyhik.
For whatever reason videoloss events are always published in the stream no matter what settings you have turned on. I don't know why they decided to do it that way, but it makes for a nice keep-alive indicator to know that the stream is active.
The problem in this case is a monitored event being published without an ID. The way the individual events are tracked within pyHik is a combination of the name and the ID. If there is no ID available you get the TypeError since the field ends up being blank.
I'm going to consider this as something that needs further exploration for now. If videoloss events are the only culprit I may just consider removing them from the monitoring list.
from pyhik.
I think that whenever a real (active) videoloss event would occur, it would have an ID of the channel. We could have a branch in code specifically checking if this is inactive videoloss and has no ID and consider it as heartbeat.
from pyhik.
Seems like this still might be a thing? I've recently upgrade my DS-7608NI-I2 to V4.22.000 build 201208 and now i'm getting
2021-05-22 10:33:12 ERROR (Thread-3) [root] Uncaught thread exception Traceback (most recent call last): File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/usr/local/lib/python3.8/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.8/site-packages/pyhik/hikvision.py", line 528, in alert_stream self.process_stream(tree) File "/usr/local/lib/python3.8/site-packages/pyhik/hikvision.py", line 604, in process_stream state = self.fetch_attributes(etype, echid) File "/usr/local/lib/python3.8/site-packages/pyhik/hikvision.py", line 652, in fetch_attributes if sensor[1] == int(channel): TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Homeassistant core-2021.5.5
from pyhik.
@necromn Are you notifying the surveillance center for videoloss events?
from pyhik.
Yeah I read up the page and saw that so i thought i went and turned them all off but i'll double check
Edit: My bad - I disabled video loss but I did not uncheck the notify surveillance center. Without that ticked it all comes back to life, so confirmed test case for enabling video loss to notify breaks the stream.
from pyhik.
Related Issues (20)
- There was a problem: 'NoneType' object has no attribute 'text' HOT 6
- Track events not shown in triggers XML endpoint HOT 7
- hikvision.py reference api document HOT 2
- Control PTZ
- Accessing Alarm trigger of camera in python code HOT 1
- /ISAPI/Event/triggers returning device error HOT 1
- Multiple detection stopped working in HA
- HomeAssistant 'Problem finding attribute: 'duration'' in logging HOT 3
- Request: Features for video Intercom HOT 1
- faceSnap sensor support HOT 11
- TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' HOT 20
- Delay is receiving Events HOT 2
- Only usable with `admin` username HOT 1
- What about streaming through the NVR HOT 1
- Home Assistant 2022.12.0B0 HOT 16
- Trigger Light strobe / Alarm. Is it possible? HOT 1
- ANPR DS-2CD4A26FWD-IZS HOT 10
- binary sensor not created HOT 2
- etchannel_num = int(etchannel.text) - TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' HOT 21
- Video Tampering Detection event not properly detected because of XML namespace problem
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyhik.