Skip to main content


Showing posts from January, 2018

Tuning motion.conf lightswitch on raspberry pi for hue lights

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 t…

Network camera as motion sensor for lights

Here's a guide to use an old network cctv feed as a motion sensor for lights.

Here's what we need

1. URL for jpg feed from the network camera

The URL varies for different brands and models.

Example URL: http:///cgi-bin/net_jpeg.cgi?ch=0 

2. Raspberry pi with domoticz (already integrated with lights, e.g. hue) 

On the raspberry pi, download Motion

$ sudo apt-get motion

Modify the /etc/motion/motion.conf file (Refer to the motion documentation)

I removed the following from the motion.conf create a new thread file for each video source

comment out in /etc/motion/motion.conf

; videodevice /dev/video0
; target_dir /var/lib/motion ; stream_port 8081
I also changed the webcontrol_port to 8000 as 8080 conflicts with the default domoticz port.
;webcontrol_port 8080 webcontrol_port 8000

I added a thread file for each video source

thread /etc/motion/camera.conf

The following is an example of a tread file called camera.conf. You need to create a new thread file f…