neilenns / node-deepstackai-trigger

Detects motion using Deepstack AI and calls registered triggers based on trigger rules.
MIT License
165 stars 28 forks source link

Add NACK trigger options #422

Closed linuxkidd closed 3 years ago

linuxkidd commented 3 years ago

Is your feature request related to a problem? Please describe. Currently, to use this ai-trigger, one must set up two independent cameras in BI. This causes a significantly higher resource utilization on the BI box compared to using a single camera with Main and Sub feeds.

Describe the solution you'd like It would be great to have a NACK ( Negative Ack ) URL / MQTT trigger option such that if an image is submitted, but no interested matches found, the NACK trigger will be fired.

In BI, you can call the URL or admin MQTT feed with camera=$cam&flag=0 to cancel an active alert. Or, you can use trigger&camera=$cam&flag=1&memo=$summary for a camera trigger event to flag the alert with the match details in the $summary variable.

For more details on this method, see: https://familytechexec.com/blog/ai-motion-detection-for-blue-iris-new-method-and-free/

Describe alternatives you've considered Currently, only the VorlonCD/bi-aidetection version of AITool appears to support the NACK triggers ( called Cancel URL / Cancel Topic+Payload in the 'Actions' config per camera )

Additional context The down-side of using the VorlonCD/bi-aidetection tool is that it does not provide json formatted output, nor does it provide a delayed 'clear' notification. Thus, it requires extra glue code to make it HomeAssistant friendly. It also must run on the WIndows box, where I'd prefer only BI to be running and keep all image processing on my much more powerful linux docker environment.

neilenns commented 3 years ago

Thanks for the suggestion! Thinking about it for a bit it would be quite a bit of change to add so I'm not likely to get to it anytime soon.

For what it's worth I'm running five 4k cameras on a PC and have no issues with resource utilization. I have substreams and direct to disk recording set up for the SD and HD cameras.

linuxkidd commented 3 years ago

While this would still be a good addition -- I've experienced oddity with how BI handles the flag feature.

Ultimately, I've gone back to the original method. In my initial setup, I had missed adding the sub-stream to the high quality camera. I don't personally have issue with the resources on my installation, but a buddy did (higher cam count, lower powered BI box). I've upgraded his BI server and things are running much better :)

FWIW, I did put together a draft of this change, but not being intimate with typescript, it didn't work exactly right. I can post the code to my fork of your repo if you'd like to see how it could be further revised (to actually work).

neilenns commented 3 years ago

Glad to hear you got it working with the substream on the HD camera. It's amazing how effective that feature is in BI!