kushagharahi / homebridge-dahua-alerts

Routes motion alerts for Dahua and Lorex camera streams to homebridge-camera-ffmpeg
27 stars 13 forks source link

Motion alerts stop working after NVR restarts #42

Open longzheng opened 1 year ago

longzheng commented 1 year ago

I have yet to debug this myself but just making a quick note here in case anyone else has also experienced this.

I've configured my Dahua NVR to do a daily automatic restart and I've noticed after the restart I no longer see any motion alerts coming through this plugin.

I suspect there is a bug with the disconnect/reconnect behaviour that's preventing the plugin from reconnecting to the NVR after the restart is completed and obviously no longer receives any further motion events.

Glancing at the source code quickly I do see some reconnect behaviour in the error and end events https://github.com/kushagharahi/homebridge-dahua-alerts/blob/main/src/dahua.ts#L92-L100 but none for the close event https://github.com/kushagharahi/homebridge-dahua-alerts/blob/main/src/dahua.ts#L88

I'm not 100% sure yet which event my restart would be triggering but that will be the first thing I debug when I have some time soon.