more G-Labs products

Author Topic: How do I setup IpCamera 1 to detect motion and trigger the Alarm system  (Read 1571 times)

January 05, 2016, 12:18:25 PM
Read 1571 times

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
I've finally managed to get my RPI running MotionPie up and running in HG.What I want to do now is have working as a motion sensor/Motion detect in the Alarm System so it will trigger an alarm and send me an email notification with an image attached.

I've assigned the MotionPie RPI to the IpCamera 1 widget. The widget is configured as follows:

Name:...........................Motion Pie Camera
select type:.................. Sensor
Features/Options:.......Generic IP Camera
Camera image API URL (see your camera docs)............ :http://192.168.1.6/picture/1/current
username:....................admin

I saved all this and added the widget to the Dashboard. Everything is working fine and I can now see the image from the MotionPie widget on the Dashboard.

What I need to know now is what else do I need to configure to have the motion detection from the MotionPie RPI send me an email notification with an image attached via HG when the Alarm System is triggered.

January 05, 2016, 03:58:55 PM
Reply #1

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
MotionPi will need to call HG webapi to notify HG of the motion detected.  I have Win7 program called yawcam call this I think:  http://192.168.1.100/api/Media.IpCamera/1/Camera.MotionDetected

Testing in browser should give this result: { 'ResponseValue' : 'OK' }

This successfully triggers the HG security alarm and identifies as motion from camera.  The HG security alarm can already send you email/text.  You can tweak it to attach an image from camera and attach it to email from HG:

Code: [Select]
byte[] img = Net.WebService("http://cdn.abclocal.go.com/three/wls/webcam/Loopscape.jpg").GetBytes();
Net.AddAttachment( "", img )
   .SendMessage(  "[email protected]", "", "HG: Motion Detected" );

January 05, 2016, 04:37:43 PM
Reply #2

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
Thanks Kevin.

I'm using HG on one RPI and MotionPie on another. MotionPie is streaming fine to HG so I have that sorted out. You are saying that I have to do the configuring in MotionPie to send a message to HG that there is motion detected and at that point HG triggers the Alarm system and HG sends the alarm notification email. Obviously MotionPie sends a motion detected email along with an image. I was just trying to get HG to do the same.


January 05, 2016, 05:02:51 PM
Reply #3

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
MotionPi will need to call HG webapi to notify HG of the motion detected.  I have Win7 program called yawcam call this I think:  http://192.168.1.100/api/Media.IpCamera/1/Camera.MotionDetected

Testing in browser should give this result: { 'ResponseValue' : 'OK' }

This successfully triggers the HG security alarm and identifies as motion from camera.  The HG security alarm can already send you email/text.  You can tweak it to attach an image from camera and attach it to email from HG



Code: [Select]
byte[] img = Net.WebService("http://cdn.abclocal.go.com/three/wls/webcam/Loopscape.jpg").GetBytes();
Net.AddAttachment( "", img )
   .SendMessage(  "[email protected]", "", "HG: Motion Detected" );


Thanks Kevin1.

I got the  { 'ResponseValue' : 'OK' } in the web browser as suggested. Is the rest of your code particular to you or can I use for my purposes

January 05, 2016, 05:16:02 PM
Reply #4

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Yawcam is a windows application.  I successfully use it with webcam for motion sensor. 

The attachment example I have just been experimenting with.  I am working on something new and have a problem/question posted here: http://www.homegenie.it/forum/index.php?topic=1345.msg8589#msg8589  Once/if I get through that, I may post it as a customizable alternative to the existing HG Security Alarm email notification. 

Otherwise you can do as I have so far, just modify the existing HG Security program so it sends the attachment or other info you want.  I just lose my tweaks every time I update HG and it replaces my security alarm program with the default.

January 05, 2016, 06:02:25 PM
Reply #5

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
Could you post your Alarm System tweaks. I can't get past the { 'ResponseValue' : 'OK' } part of your post.

I wonder if it would be possible to get MotionPie to send HG a message directly when a motion was detected which in turn could activate the HG Alarm System and forward that message to my email. I'm drowning a little here. I thought it be easier to achieve what I was trying to achieve when I started out configuring the IP camera

January 05, 2016, 06:36:13 PM
Reply #6

kevin1

  • *****
  • Information
  • Hero Member
  • Posts: 330
Do you have email configured?  Does security system email you when you trigger alarm by another mechanism?

The example above is basically what I was experimenting with.  If you have the email & security email  working then try this:

-on your ipcamera widget, click the gear, under feature options find and select "use as security sensor", click update
-back to dashboard, arm the alarm system
-in another browser tab go to  http://192.168.1.100/api/Media.IpCamera/1/Camera.MotionDetected

That should cause the alarm to trigger and then send you email.

January 05, 2016, 06:56:58 PM
Reply #7

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
Yes I have HG sending me an email notification when my MS13 movement sensor triggers movement. I'll try what you suggest and report back with the results.

Thanks for all your help.

January 05, 2016, 08:25:44 PM
Reply #8

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
Do you have email configured?  Does security system email you when you trigger alarm by another mechanism?

The example above is basically what I was experimenting with.  If you have the email & security email  working then try this:

-on your ipcamera widget, click the gear, under feature options find and select "use as security sensor", click update
-back to dashboard, arm the alarm system
-in another browser tab go to  http://192.168.1.100/api/Media.IpCamera/1/Camera.MotionDetected

That should cause the alarm to trigger and then send you email.


I went to the IpCamera widget under Features/Options selected Security Alarm System, ticked Use as a Security Sensor. I saved the changes but it keeps defaulting back to Generic IP Camera. Any ideas what is happening here.

January 05, 2016, 09:56:04 PM
Reply #9

petediscrete

  • ****
  • Information
  • Sr. Member
  • Posts: 220
Tried everything you suggested and a bit more Kevin1. No luck and the system became unstable so I uninstalled it, reinstalled it and restored it from the last known working configuration.Thats the good thing about HG.Again thanks for all your help.

As stated previously, I can get HG to send an alarm notification email to me as a result of an alarm activation from the MS13 movement sensor so I can't understand why I can't set it up using IpCamera as a sensor for alarm activation.