Skip to content

Webhook events not matched: parser only looks for tags in the hikvision.com ver20 namespace #32

Description

@Tommy0210-tech

parse_event_notification in notifications.py uses XML_NS = "{http://www.hikvision.com/ver20/XMLSchema}" for all find() lookups (macAddress, channelID, eventType, activeState, …).

Several of my cameras send the alert in a different namespace, so macAddress and channelID come back empty (debug: Parsed alert: event=…, channel=0):

: DS-2DE4425IW-DE (fw V5.8.13, line crossing) and DS-2CD2H87G3-LIZS2UY (fw V5.8.40, intrusion detection)
: DS-2CD2387G2P-LSU (fw V5.7.20, VMD)

Home Assistant runs in Docker (bridge network), so all webhooks arrive from 172.17.0.1 and the IP fallback can't match either. Result: Cannot find ISAPI instance for device 172.17.0.1 and the events are lost. Cameras using the hikvision.com namespace (e.g. DS-2CD2347G2-LSU) work fine.

Suggested fix: use the ElementTree namespace wildcard, XML_NS = "{*}" (Python ≥ 3.8). I applied this locally: all cameras are matched correctly and events work again.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions