more G-Labs products

Author Topic: Setting up Alarm System using Camera as a sensor and send email notification  (Read 2994 times)

July 27, 2015, 11:26:57 PM
Read 2994 times

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
I am trying to set up the Alarm system using the camera as a sensor which will send an email alert when motion is detected.Do i have to write a script/program from scratch or is there a script/program/module/widget already available to do this. Even if someone could point me in the right direction it woul be a great help.

July 28, 2015, 12:05:57 PM
Reply #1

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
I've set the camera up as a sensor in the camera output widget, configured the Security Alarm widget and configured the email settings but I'm trying to figure out the concept of how to enable motion detection as a trigger. I've set the Alarm System as armed but don't see any notification when there is movement on the camera.

Where can I access the Wizard scripting in HG in the menu section.

July 28, 2015, 12:22:31 PM
Reply #2

MJCfromCT

  • *
  • Information
  • Newbie
  • Posts: 22
I'm hoping there is another way, but I thought you would need an actual motion sensor in your setup in order to do what you are asking. I have not found a way to use the camera snapshots themselves to "sense" motion. Once you have a motion sensor is a simple program you'll need to write. I currently have one that takes a camera snapshot when a door sensor trips open.

July 28, 2015, 04:10:31 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I don't believe HG has a motion detect algorithm for cameras.  If you have a program that can do the detection or the camera itself has an alarm output, you could probably get that incorporated into HG pretty easily.  Cameras are a near term (hopefully) project for me but I have not figured out the logistics yet.

July 28, 2015, 05:15:25 PM
Reply #4

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
Yes I was basing my requirement on a very polished piece of software called MortionPie  operating on a Raspberry. I suggest that any PI owners try this software if they haven't already done so. It's a simple and straightforward alarm system based on motion detection that will automatically send you an email complete with pictures attached should motion be detected.

I was hoping that this could be achieved in HG but I'm not seeing how to easily without writing in C# which is way beyond my scope. Perhaps this concept would be incorporated into HG at some stage as looking at the process it's a classic IPO procedure.

July 28, 2015, 05:39:42 PM
Reply #5

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
A few notes...
(1) Can MotionPie run at same time as HG on Pi?  I don't know the details but it appears to have some custom notifications in addition to email according to this screenshot:
https://github.com/ccrisan/motionpie/wiki/Screenshots

Under the run a command option, call this webapi to notify HG of the motion:
Code: [Select]
curl http://<hg_address>/api/Media.IpCamera/<program_address>/Camera.MotionDetected
(2) There is an android 'IP Webcam' app you can experiment with if you have an old android device laying around.  It has motion detection and Tasker (another app) support.   Someday I am planning to test this out so the app would initiate Tasker task which would call HomeGenie MotionDetect webapi

(3) You can look into iSpyConnect software on PC to help with this, there is some discussion here...
http://www.homegenie.it/forum/index.php?topic=978.msg5970#msg5970

July 28, 2015, 06:13:38 PM
Reply #6

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Pasting this in browser seems gives good response for my Android IPWebcam:
http://<IP>/api/Media.IpCamera/1/Camera.MotionDetected
{ 'ResponseValue' : 'OK' }

But it didn't trigger my alarm.

Added this in ipcamera trigger and now it works:
Code: [Select]
Program.AddFeature("Media.IpCamera", "HomeGenie.SecuritySensor", "Use as Security Sensor");
So configure MotionPi to call http://<IP>/api/Media.IpCamera/1/Camera.MotionDetected
« Last Edit: July 28, 2015, 06:31:23 PM by kevin1 »

July 28, 2015, 08:21:42 PM
Reply #7

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
That's certainly looks interesting. My HA is mainly x10 devices and that's why I'm experimenting with it. The script wizard has me a little stumped though.i love the idea of an SD card image running on a low powered unit like a Raspberry PI with everything fully integrated. Looks like that's where HG could go and if it did the uptake would be huge IMHO.

July 28, 2015, 11:26:07 PM
Reply #8

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I looked at iSpyConnect and MotionPie last week and they both looked really interesting.  But, I wasn't sure how many cameras could be realistically be processed by a RPi.  I assumed that the power requirements would make running the cameras on the same system as HG would be problematic.  I figured it would be better to just buy another Pi for the cameras, but then if the camera image processing takes up a whole RPi per camera, I'd probably look another way.

As far as triggering actions, I was thinking about either using MQTT to send an alarm notice for HG to pick up or just using the API calls.  Since my MQTT broker is on the HG RPi, there should be no issue with losing messages beyond what would already be seen with the API route.

July 28, 2015, 11:54:20 PM
Reply #9

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
Not sure what this implies but from what I can gather the Raspberry PI2 has 1gb of GPU memory and this coupled with a powered USB hub I would imagine this would help with both power and memory requirements of any additional cameras on the system. Again this is just an uneducated observation.

July 29, 2015, 04:58:54 PM
Reply #10

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I don't think the limitation most people (or at least I) would be worried about is the power to run a camera.  What I think the primary issue is relates to on the fly video processing which can be very CPU intensive.  I tried Blue Iris a while back on a desktop PC with a single USB camera and it worked ok.  I saw reports at that time that there were limitations on the number of feeds it could handle based on hardware (CPU) limitations.  I have not looked into motion detection on cameras since, but it's something I'm becoming more interested in again.

If the motion detection were done on the IP camera itself and a motion detect alarm were sent to the RPi, then that would make a big difference in required hardware specs.  But, that's less flexible in that each camera would have to include required sensing capabilities and each would have to be set up individually rather than a single monitoring system processing each camera's feed.