Ubiquiti offers a product that will do that out of the box
- You need to host a controller for it. It needs the Protect platform to interface with. You can host that for free.
- The hardware is fine.
- The included app is marginal
- it supports onifv and can be added to blue-iris or frigate.