eu-evops / homebridge-hikvision

29 stars 21 forks source link

Motion events not triggering homekit automations #33

Open mmorim opened 3 years ago

mmorim commented 3 years ago

i'm struggling with creating automation baed on the "motion detected alarm" the event is recorded in the NVR and visible in Hik-connect. i also configured the event to send a notification to the surveillance center. the user has all permissions except to format the device.

despite all of the above, the automation i created in homekit, based on the camera detecting motion - is not working. am i missing anything? :/

beezkneezdeez commented 3 years ago

Unfortunately, motion events don’t seem to work here :(

mmorim commented 3 years ago

oh, that's a bummer.... a world of automations just lost. thanks for the reply!

beezkneezdeez commented 3 years ago

I can’t quite figure out what it might be… my hikvision firmware hasn’t changed from like 2018 haha.

I still see alarms coming through VMS, the alarmXML is still active, but for some reason this isn’t triggering after the parse anymore

neilheyes commented 2 years ago

The XML from my NVR looks like:

--boundary Content-Type: application/xml; charset="UTF-8" Content-Length: 465

10.1.49.25 80 HTTP 64:db:8b:93:66:a2 0 2021-12-14T09:06:1600:00 0 videoloss inactive videoloss alarm

and fails with an error "Whitespace before first tag, so I'm presuming that it fails because of the --boundary stuff and content headers. My JS isn't good enough to figure out a fix though

neilheyes commented 2 years ago

did manage to fix this (with a hammer!)

                .map(text => text.replace(/^Content.*\n?/gm, ''))
                .map(text => text.replace(/^--bound.*\n?/gm, ''))

which removes the non tagged lines.

modul8co commented 2 years ago

I needed this fixed for my personal project, so a different version is here:

https://github.com/modul8co/homebridge-hikvision-nvr

It resolves (for me) the issue of some of the thumbnails not working too. I also added a motion re-trigger timeout setting.