Today i got all my IP camera’s to act as motion detectors/sensors.
What I did:
- installed the APP ‘Virtual Motion Sensor’ and created new sensors, for each camera i want to use/add
- configured motion detection on the camera (sensitivity etc), if this is not possible you cannot use this tip!
I have found 2 different types of camera’s with motion detection. Camera’s with an option to call an http event and camera’s with (only) FTP option.
- camera’s with a option to call a http(event), it is very easy, just entered the following url to call on motion, the app works immidiatly
http://VERAIP:3480/data_request?id=action&DeviceNum=DEVICEID&serviceId=urn:dcineco-com:serviceId:VMotion1&action=SetTripped&OnTime=30 (Where VERAIP the ipaddress is of your vera unit and DEVICEID the id of the sensor created by the app)
For camera’s with NO direct http call but with motion detect buildin and an option to FTP it is possible but is more of a challenge, i solved this the following way
- you need a (linux) server or nas with FTP enabled, this server must be always ON, if possible in your local LAN, can be outside but be sure you setup your firewall and port forwarding correct.
- create a user and folder on the server and configure the camera to FTP a screenshot on motion into that folder, be sure each camera uses an other (unique) filename. If possible let the camera overwrite eachtime the screenshot with the same name, if this is not possible then create a sub folder which is specific for this camera and upload the files into that folder. Test if the camera uploads a screenshot to this folder on motion.
My setup:
- 3x d-link camera’s, 1x HD foscam camera, 3x axis camera
- vera LITE unit with APP ‘Virtual Motion Sensor’ installed
- synology NAS
- all axis camera have http call event option, this was easy, so no further setup for this camera’s
- d-link and the foscam HD have only mail and ftp option on motion, for these i used the NAS
- on my NAS i created a user called ‘vera’ and a screenshot folder, local path on a synology nas: /volume1/homes/vera/screenshots
- all camera’s correctly FTP and upload the screenshots files into this folder.
- d-link have a single file option, so the files are called: /volume1/homes/vera/screenshots/hall.jpg /volume1/homes/vera/screenshots/kitchen.jpg etc
- foscam creates a new folder with an extra sub folder and uploads its files in to that subfolder, it also creates names from timestamp, for example /volume1/homes/vera/screenshots/foscam_9818101/shot/living_1605101501.jpg /volume1/homes/vera/screenshots/foscam_9818101/shot/living_1605101502.jpg
Now the camera part is correctly setup, they all upload screenshots to the NAS.
I then used a php script to read the ‘/volume1/homes/vera/screenshots’ folder
In this script I defined each cameras unique filename or the unique folder name (foscam).
If a defined file or folder name is present i then call using curl the api url to the vera unit with the correct ID and then DELETE the file I detected.
The last thing to do was to be sure this script runs constantly, i therefore created a little bash script where i used a while to loop it constantly for running the php script. To make sure it keeps running i placed this script into the /etc/init so the server(nas) will run it on boot and restarts it when it crashes.
The result is now when i walk by each camera in my house the corresponded motion sensor reports motion within 1 second!
All my camera’s in my network are now also acting als motion detectors, i now can be more precise to create scenes when someone is present without to have to buy extra PIR sensors.
I hope this bring people to idea’s to make apps or use there camera’s as detectors even if they have no direct support for it!