I have the following typical configuration:
binary_sensor:
- platform: hikvision
host: 192.168.86.94
port: 80
ssl: false
username: xxxx
password: xxx
All the cameras that have motion detection enabled are correctly created as sensors via this integration. Camera settings on Hikvision iDS-7216HUHI-M2/S(C) are: Enable Motion Detection, Notify Surveillance Center. Auth is set to digest/basic, ONVIF is disabled, ISAPI is enabled. I have tried with both admin user and a newly created ‘operator’ user with all rights selected.
The curl command on /ISAPI/Event/notification/alertStream creates this output:
<EventNotificationAlert version="1.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.86.94</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>ac:b9:2f:17:8f:99</macAddress>
<dynChannelID>33</dynChannelID>
<dateTime>2023-01-03T13:47:52+02:00</dateTime>
<activePostCount>22</activePostCount>
<eventType>VMD</eventType>
<eventState>active</eventState>
<eventDescription>Motion alarm</eventDescription>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 466
<EventNotificationAlert version="1.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.86.94</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>ac:b9:2f:17:8f:99</macAddress>
<dynChannelID>34</dynChannelID>
<dateTime>2023-01-03T13:47:52+02:00</dateTime>
<activePostCount>23</activePostCount>
<eventType>VMD</eventType>
<eventState>active</eventState>
<eventDescription>Motion alarm</eventDescription>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 466
<EventNotificationAlert version="1.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<ipAddress>192.168.86.94</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>ac:b9:2f:17:8f:99</macAddress>
<dynChannelID>36</dynChannelID>
<dateTime>2023-01-03T13:47:52+02:00</dateTime>
<activePostCount>24</activePostCount>
<eventType>VMD</eventType>
<eventState>active</eventState>
<eventDescription>Motion alarm</eventDescription>
</EventNotificationAlert>
--boundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 459
The home assistant logs are:
2023-01-03 14:15:46.904 INFO (MainThread) [hass_nabucasa.iot] Connected
2023-01-03 14:15:46.909 INFO (SyncWorker_2) [homeassistant.loader] Loaded hikvision from homeassistant.components.hikvision
2023-01-03 14:15:46.919 INFO (MainThread) [homeassistant.setup] Setting up binary_sensor
2023-01-03 14:15:46.922 INFO (MainThread) [homeassistant.setup] Setup of domain binary_sensor took 0.0 seconds
2023-01-03 14:15:46.923 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.hikvision
2023-01-03 14:15:46.925 DEBUG (SyncWorker_4) [pyhik.hikvision] pyHik 0.3.1 initializing new hikvision device at: http://192.168.86.94
2023-01-03 14:15:46.934 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.cloud
2023-01-03 14:15:46.953 INFO (SyncWorker_6) [homeassistant.loader] Loaded stt from homeassistant.components.stt
2023-01-03 14:15:46.963 DEBUG (SyncWorker_4) [pyhik.hikvision] Device info namespace: http://www.hikvision.com/ver20/XMLSchema
2023-01-03 14:15:46.966 INFO (MainThread) [homeassistant.setup] Setting up stt
2023-01-03 14:15:46.967 INFO (MainThread) [homeassistant.setup] Setup of domain stt took 0.0 seconds
2023-01-03 14:15:47.003 DEBUG (SyncWorker_4) [pyhik.hikvision] Device triggers namespace: http://www.isapi.org/ver20/XMLSchema
2023-01-03 14:15:47.004 DEBUG (SyncWorker_4) [pyhik.hikvision] Processed 48473739-3132-3337-3832-acb92f178f99 as NVR Device.
2023-01-03 14:15:47.004 DEBUG (SyncWorker_4) [pyhik.hikvision] Found events: {'VMD': [1, 2, 3, 4, 5, 6, 9, 10, 11, 15]}
2023-01-03 14:15:47.004 DEBUG (SyncWorker_4) [pyhik.hikvision] Initialized Dictionary: {'Motion': [[False, 1, 0, datetime.datetime(2023, 1, 3, 14, 15, 47, 4577)], [False, 2, 0, datetime.datetime(2023, 1, 3, 14, 15, 47, 4583)], [False, 3, 0, datetime.datetime(2023, 1, 3, 14, 15, 47, 4584)], [False, 4, 0, datetime.datetime(2023, 1, 3, 14, 15, 47, 4585)], [False, 5, 0, datetime.datetime(2023, 1, 3, 14, 15, 47, 4586)], [False, 6, 0, datetime.datetime(2023, 1, 3, 14, 15, 47, 4587)], [False, 9, 0, datetime.datetime(2023, 1, 3, 14, 15, 47, 4588)], [False, 10, 0, datetime.datetime(2023, 1, 3, 14, 15, 47, 4589)], [False, 11, 0, datetime.datetime(2023, 1, 3, 14, 15, 47, 4590)], [False, 15, 0, datetime.datetime(2023, 1, 3, 14, 15, 47, 4591)]]}
2023-01-03 14:15:47.009 INFO (SyncWorker_0) [homeassistant.loader] Loaded google_translate from homeassistant.components.google_translate
2023-01-03 14:15:47.015 DEBUG (SyncWorker_4) [pyhik.hikvision] Device motion namespace: http://www.isapi.org/ver20/XMLSchema
2023-01-03 14:15:47.027 INFO (MainThread) [homeassistant.setup] Setting up tts
2023-01-03 14:15:47.030 DEBUG (SyncWorker_4) [pyhik.hikvision] Added update callback to <bound method HikvisionBinarySensor._update_callback of <Entity Embedded Net DVR Motion 1: off>> on 48473739-3132-3337-3832-acb92f178f99.Motion.1
2023-01-03 14:15:47.031 DEBUG (SyncWorker_4) [pyhik.hikvision] Added update callback to <bound method HikvisionBinarySensor._update_callback of <Entity Embedded Net DVR Motion 2: off>> on 48473739-3132-3337-3832-acb92f178f99.Motion.2
2023-01-03 14:15:47.031 DEBUG (SyncWorker_4) [pyhik.hikvision] Added update callback to <bound method HikvisionBinarySensor._update_callback of <Entity Embedded Net DVR Motion 3: off>> on 48473739-3132-3337-3832-acb92f178f99.Motion.3
2023-01-03 14:15:47.031 DEBUG (SyncWorker_4) [pyhik.hikvision] Added update callback to <bound method HikvisionBinarySensor._update_callback of <Entity Embedded Net DVR Motion 4: off>> on 48473739-3132-3337-3832-acb92f178f99.Motion.4
2023-01-03 14:15:47.031 DEBUG (SyncWorker_4) [pyhik.hikvision] Added update callback to <bound method HikvisionBinarySensor._update_callback of <Entity Embedded Net DVR Motion 5: off>> on 48473739-3132-3337-3832-acb92f178f99.Motion.5
2023-01-03 14:15:47.031 DEBUG (SyncWorker_4) [pyhik.hikvision] Added update callback to <bound method HikvisionBinarySensor._update_callback of <Entity Embedded Net DVR Motion 6: off>> on 48473739-3132-3337-3832-acb92f178f99.Motion.6
2023-01-03 14:15:47.031 DEBUG (SyncWorker_4) [pyhik.hikvision] Added update callback to <bound method HikvisionBinarySensor._update_callback of <Entity Embedded Net DVR Motion 9: off>> on 48473739-3132-3337-3832-acb92f178f99.Motion.9
2023-01-03 14:15:47.031 DEBUG (SyncWorker_4) [pyhik.hikvision] Added update callback to <bound method HikvisionBinarySensor._update_callback of <Entity Embedded Net DVR Motion 10: off>> on 48473739-3132-3337-3832-acb92f178f99.Motion.10
2023-01-03 14:15:47.031 DEBUG (SyncWorker_4) [pyhik.hikvision] Added update callback to <bound method HikvisionBinarySensor._update_callback of <Entity Embedded Net DVR Motion 11: off>> on 48473739-3132-3337-3832-acb92f178f99.Motion.11
2023-01-03 14:15:47.031 DEBUG (SyncWorker_4) [pyhik.hikvision] Added update callback to <bound method HikvisionBinarySensor._update_callback of <Entity Embedded Net DVR Motion 15: off>> on 48473739-3132-3337-3832-acb92f178f99.Motion.15
No matter which camera is triggered, it’s always the “Embedded Net DVR Motion 3” sensor on HA that is triggered. From the above logs, the 3 appears on all motion events.
Any ideas?