You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When activating video tampering protection on the camera, the pyhik module reports an error when tampering is detected.
From my log: hikvision.py:609: Error: Problem finding attribute: 'NoneType' object has no attribute 'text'
This is caused in function process_stream().
I traced it down a bit, and it is the first tree.find() call that fails, during the etype lookup right at the beginning in the try-except-block.
Motion detection works, the tree (dumped with ET.dump(tree)) looks like this in process_stream() (IP and MAC addresses redacted): <ns0:EventNotificationAlert xmlns:ns0="http://www.std-cgi.com/ver20/XMLSchema" version="2.0"><ns0:ipAddress>XXX</ns0:ipAddress><ns0:ipv6Address>XXX</ns0:ipv6Address><ns0:portNo>80</ns0:portNo><ns0:protocol>HTTP</ns0:protocol><ns0:macAddress>XXX</ns0:macAddress><ns0:channelID>1</ns0:channelID><ns0:dateTime>2024-05-03T11:38:24+01:00</ns0:dateTime><ns0:activePostCount>1</ns0:activePostCount><ns0:eventType>VMD</ns0:eventType><ns0:eventState>active</ns0:eventState><ns0:eventDescription>Motion alarm</ns0:eventDescription><ns0:channelName>Camera 01</ns0:channelName></ns0:EventNotificationAlert>
But Tamper detection doesn't work, leads to error... tree looks like this: <ns0:EventNotificationAlert xmlns:ns0="http://www.isapi.org/ver20/XMLSchema" version="2.0"><ns0:ipAddress>XXX</ns0:ipAddress><ns0:ipv6Address>XXX</ns0:ipv6Address><ns0:portNo>80</ns0:portNo><ns0:protocol>HTTP</ns0:protocol><ns0:macAddress>XXX</ns0:macAddress><ns0:channelID>1</ns0:channelID><ns0:dateTime>2024-05-03T11:38:28+01:00</ns0:dateTime><ns0:activePostCount>1</ns0:activePostCount><ns0:eventType>shelteralarm</ns0:eventType><ns0:eventState>active</ns0:eventState><ns0:eventDescription>shelteralarm</ns0:eventDescription><ns0:channelName>Camera 01</ns0:channelName></ns0:EventNotificationAlert>
In both cases, self.element_query('eventType', CONTEXT_ALERT) returns {http://www.std-cgi.com/ver20/XMLSchema}eventType as a namespace. So it within this namespace the code looks for entries. In the tamper protection event case, note that the namespace used by the camera is http://www.isapi.org/ver20/XMLSchema!
I've traced the problem down up to this point, but I'm not sure how to solve the core issue.
Is fetch_namespace() buggy? Or should the self.namespace entries be lists of namespaces rather than single namespace strings, and we should search all of them in case we don't find an entry in the first one we try?
The text was updated successfully, but these errors were encountered:
When activating video tampering protection on the camera, the pyhik module reports an error when tampering is detected.
From my log:
hikvision.py:609: Error: Problem finding attribute: 'NoneType' object has no attribute 'text'
This is caused in function
process_stream()
.I traced it down a bit, and it is the first
tree.find()
call that fails, during the etype lookup right at the beginning in the try-except-block.Motion detection works, the tree (dumped with
ET.dump(tree)
) looks like this inprocess_stream()
(IP and MAC addresses redacted):<ns0:EventNotificationAlert xmlns:ns0="http://www.std-cgi.com/ver20/XMLSchema" version="2.0"><ns0:ipAddress>XXX</ns0:ipAddress><ns0:ipv6Address>XXX</ns0:ipv6Address><ns0:portNo>80</ns0:portNo><ns0:protocol>HTTP</ns0:protocol><ns0:macAddress>XXX</ns0:macAddress><ns0:channelID>1</ns0:channelID><ns0:dateTime>2024-05-03T11:38:24+01:00</ns0:dateTime><ns0:activePostCount>1</ns0:activePostCount><ns0:eventType>VMD</ns0:eventType><ns0:eventState>active</ns0:eventState><ns0:eventDescription>Motion alarm</ns0:eventDescription><ns0:channelName>Camera 01</ns0:channelName></ns0:EventNotificationAlert>
But Tamper detection doesn't work, leads to error... tree looks like this:
<ns0:EventNotificationAlert xmlns:ns0="http://www.isapi.org/ver20/XMLSchema" version="2.0"><ns0:ipAddress>XXX</ns0:ipAddress><ns0:ipv6Address>XXX</ns0:ipv6Address><ns0:portNo>80</ns0:portNo><ns0:protocol>HTTP</ns0:protocol><ns0:macAddress>XXX</ns0:macAddress><ns0:channelID>1</ns0:channelID><ns0:dateTime>2024-05-03T11:38:28+01:00</ns0:dateTime><ns0:activePostCount>1</ns0:activePostCount><ns0:eventType>shelteralarm</ns0:eventType><ns0:eventState>active</ns0:eventState><ns0:eventDescription>shelteralarm</ns0:eventDescription><ns0:channelName>Camera 01</ns0:channelName></ns0:EventNotificationAlert>
In both cases,
self.element_query('eventType', CONTEXT_ALERT)
returns{http://www.std-cgi.com/ver20/XMLSchema}eventType
as a namespace. So it within this namespace the code looks for entries. In the tamper protection event case, note that the namespace used by the camera ishttp://www.isapi.org/ver20/XMLSchema
!I've traced the problem down up to this point, but I'm not sure how to solve the core issue.
Is
fetch_namespace()
buggy? Or should theself.namespace
entries be lists of namespaces rather than single namespace strings, and we should search all of them in case we don't find an entry in the first one we try?The text was updated successfully, but these errors were encountered: