Recap on using an non-recording old CCTV to create a motion sensor using raspberry to trigger hue lights with apple homekit automation. Ok, thats a long way around things. Here's a flow
1. Network Camera > 2. motion (pi) on_event > 3. virtual motion sensor (domoticz / homekit plugin) > 4. Apple home automation (motion on, no motion off)
One of the initial problems was that the light turning off will trigger the motion/light. the solution is to modify the 'lightswitch' parameter, which doesn't have a lot of references to what to set, so it's trial and error as each camera feed are always different..
Noted that I did first change the framerate to 20 prior for better quality. To tune the lightswitch setting, set yourself up around the time the motion light is supposed to come on and follow these 3 steps as a general guideline.
1) Set the event_gap to a small number for testing, e.g. 10 seconds so that you do not need to wait for a long time before testing the light changes and motion detection.
2) set some base parameters which make sense, 2 or 3 is ok for the 2 variables.
- set minimum_motion_frames 2
- set pre_capture 2
3) start playing around with the lightswitch value. to figure out how it works, set it to the max and min and see which one doesn't give a false positive. I started with 100 and 10 and played with everything inbetween until i realised that 10 worked best anyway for my hue light at the door.