Enable lights by motion detection camera

Moderator: leecollings

Post Reply
Spanky899
Posts: 2
Joined: Wednesday 17 January 2018 4:59
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Contact:

Enable lights by motion detection camera

Post by Spanky899 »

Hi all,

What i want to do is as follow:
When my camera detects motion (foscam c1), the lights must be go on and after a time, the lights must be go off automatically.
I have added the camera and the lights in domoticz and thats working.
In domoticz the camera don't have a idx unlike the lights.
How can i make the link between the motion of the camera and the lights?

The web interface of the camera is configured when motion is detected, the images are forwarded to an ftp server.
Do i have to add a dummy switch and configure the dummy switch with an script or something?
Or is this only possible with a real motion detector?
SweetPants

Re: Enable lights by motion detection camera

Post by SweetPants »

Unless your camera is capable of sending something to domoticz, this is not going to work easely. If your camera is able to send email (and trigger an action) or something like an SNMP trap, you might be able to use the camera motion detector. Otherwise you have to use a separate PIR or other kind of motion detector. I myself use these https://www.ebay.com/itm/Motion-Sensor- ... SwAYJZhV3b , nice thing is they can 'look' through walls so you don't see them. But this requires some capabilities of hardware designing/building
lost
Posts: 660
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Enable lights by motion detection camera

Post by lost »

Spanky899 wrote: Wednesday 17 January 2018 5:20 The web interface of the camera is configured when motion is detected, the images are forwarded to an ftp server.
Do i have to add a dummy switch and configure the dummy switch with an script or something?
Or is this only possible with a real motion detector?
On my side, I've a similar setup working. But as it is not a Domoticz feature to be able to monitor a FTP directory for new images resulting from camera motion detection, I've done this through a python script executed as a Linux service that control some domoticz virtual switches (declared as PIRs) using the http API.

So this can be done, but requires some program skills.

On my side, this is linked to alarm function so a bit more complex than what would be required to just switch-on lights: False positive are not the same problem as it may not fire-up a siren at night! And for cameras, rejecting false positive is not so easy. Even with in-cam flexible sensitivity & motion zones setup to reject zones when light may vary a lot with clouds or vegetation move with wind, this may still be a challenge with neighborhood cats passing by of even birds, spiders... This requires as well to e-mail captures & as this is private data but gmail is quite reliable, to send them in password protected archives (another feature domoticz does not propose).
So the python service monitor FTP directory (a tmpfs in ram not to wear the PI SD) for each camera every 10s for new captures. If some are there, they are archived & sent through gmail + domoticz virtual PIR for the cam receives an "on for xx" seconds command through http api. Then captures are then locally erased (only copied to SD if gmail does not work at the moment, never arrived in more than a year).
alanlsmith
Posts: 132
Joined: Monday 07 August 2017 17:17
Target OS: Linux
Domoticz version: Latest β
Location: Near London (Saaarf!)
Contact:

Re: Enable lights by motion detection camera

Post by alanlsmith »

I might be worth having a look at this:

Code: Select all

https://www.domoticz.com/wiki/Camera_Setup#Using_your_camera_as_motion_sensor
and monitor changes in the camera snapshot image to trigger a switch in Domoticz.
Domoticz Latest β, RPi 4B with 110Gb SSD for Domoticz, RPi 4B with 110Gb SSD for Node-Red & a RPi 2B for logging / IP addressing. RFXCOM, PiZiGate, Z-Wave, Harmony, Hue lamps and a bit of Broadlink.
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Enable lights by motion detection camera

Post by EddyG »

That part on the Wiki works, but complicated to setup.
Besides that it takes a LOT of CPU power.
If you have a Foscam it is possible to poll the camera by cron and get motiondetection.
Something like this:

Code: Select all

    # Get data from status.txt and place text status.txt in new file named FOSCAM.txt
    curl $CURL_PARAM "http://$FOSCAM_IP_IN:$FOSCAM_PORT_IN/cgi-bin/CGIProxy.fcgi?cmd=getDevState&usr=admin&pwd=xxxx" > tmp/Foscam.txt

    # FOSCAM Status
    FOSCAMStatus=`grep -oP '(?<=<motionDetectAlarm>).*(?=<\/motionDetectAlarm>)' /tmp/Foscam.txt`
    MOTIONStatus=`curl -s -H "Accept: application/json" "http://$DomoticzIP:$DomoticzPort/json.htm?type=devices&rid=$FOSCAM_MOTION_IDX_IN" | jq r .result[]."Status"`
    echo $FOSCAMStatus
    echo $MOTIONStatus
Spanky899
Posts: 2
Joined: Wednesday 17 January 2018 4:59
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Contact:

Re: Enable lights by motion detection camera

Post by Spanky899 »

Thanks a lot for the replies. I thought it was pretty good to do.
I think i'm going to buy a motion sensor.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest