My code is simple, in my raspberry with HASS i create a server for dvr cameras, when motion is detected, the cctv camera send alarm to dvr server and this server send to MQTT.
After, you can create binary sensor for log/alarm or create automations, send motion to telegram, etc.
All my cameras can work now like binary motion sensor (not PIR, but similar)
You can see info in github
https://github.com/dave-code-ruiz/dvr_server
regards.