rroller / dahua

Dahua Camera and Doorbell Home Assistant Integration
MIT License
398 stars 80 forks source link

Missing Events Due to index / channel offset mismatch #233

Open ashdriver-mv opened 1 year ago

ashdriver-mv commented 1 year ago

I have a Dahua DH-NVR4216-8P-4K NVR with 9 cameras. I had set up 4 of them to get VideoMotion events, but only two were actually receiving the events. After debugging I found that the index in the event notification coming from the NVR was 0 based, but the channel numbering is 1 based. So to fix the issue I needed to modify custom_components/dahua/init.py line 439 to:

        if ( index + 1 ) != self._channel:

was : if index != self._channel:

I haven't created a pull request since I guess this will need testing on other models but happy to do so if the above fix seems acceptable.