I had an old android phone on which i installed IP webcam. This alowed me to use it as a webcam to watch my frontdoor. Since we have Domoticz running on a Raspberry PI i thought that it would be nice to integrate this camera in Domoticz. The result is a nice working motion sensor that can trigger various actions.
How can we do this:
Basicly the next steps are involved:
* install IP CAM app on the phone.
* install "motion" and register your netcam.
* register the camera in domoticz
* setup a virtual motion sensor switch in domotics
* setup motion for motion detection and define an "on_event_start" that switches the virtual sensor on/off
So what can we do with it? A few examples:
When motion is triggered we can domoticz make send us a snaphot via e-mail, put a light on for a certain time, send a notification to NMA, put a sirene on, and more.
First install IP WEBCAM on the phone and make sure it runs. Choose a portnumber different than 8080 as this is used by domoticz.
Now prepare domoticz: Go to the menu 'cameras' and register your camera. Configure a virtual sensor for the motion detection. Check 'devices' and make a note of the IDX nr. of this device. Click in the arrow to move the device to the switches menu. In the menu 'cameras' you can attach this switch to the camera, you can now see the the camera through this switch in dasboard. Also, you'l get e-mails with a snaphot when the status of this switch is "on" or "off". Next you can start with the setup of e-mail.
see the pictures and follow these steps, or go to domoticz.com/wiki/Application_Settings#Email_Setup
Next install motion and edit /etc/motion.conf
-comment out "videodevice /dev/video0"
-Set the portnumbers for stream_port to p.e. 8085 and the webcontrol_port to 8086. Again avoid port 8080
-on_event_start curl -s "http://user:passwd@domoticz:port/json.htm? type=command&param=switchlight&idx=your_ID&switchcmd=On" (this is one line no spaces)
First test the curl command directly from the commandline to check if it is working.
restart the motion service. Now when motion is triggered, motion sends this curl command that switches the virtual switch in domoticz to "On".
In domotics you can define what should happen when the virtual sensor is switched. Use the menu "events" and configure a programm with blockly.
Test by moving in front of the cam and Check the domoticz logfile to see if your actions have been taken.
To see screenshots click here
For questions you can mail to firstname.lastname@example.org