HomeGenie Forum

General Category => Troubleshooting and Support => Topic started by: joaoasilva on September 26, 2014, 08:06:36 PM

Title: Noob questions - Virtual Sensor inside Alarm System
Post by: joaoasilva on September 26, 2014, 08:06:36 PM
Hi all,

I'm trying to figure out how HG works and I already have some things working but were all modules already inside HG.
Now I'm using a raspberry pi and webcam with motion saving jpg's and with lighthttp opening the images from Ip Camera module and works perfectly. Motion have the ability to send commands if detects movement and I would like to build a python script to send an API call to HG saying that movement was detected and insert that into the Security Alarm System module. Is there a way to create a Virtual Sensor that I could say that is inside Security Alarm System module and I could just call http://HGIP/api/Camera/1/Control.On (http://HGIP/api/Camera/1/Control.On) to trigger the sensor and the Alarm System?

Thanks in advance.

Best regards,
Joao Silva
Title: Re: Noob questions - Virtual Sensor inside Alarm System
Post by: Gene on September 26, 2014, 09:33:33 PM
If you're using the generic IP camera widget then you can raise the motiondetect event on that camera with this api call:

http://<homegenie_address>/api/Media.IpCamera/<cam_number>/Camera.MotionDetected

You can then flag the camera as a Security Sensor from the module options, so it will trigger the Security Alarm System module.

Cheers,
g.
Title: Re: Noob questions - Virtual Sensor inside Alarm System
Post by: joaoasilva on September 26, 2014, 09:44:11 PM
Sorry, didn't notice the event Camera.MotionDetected :/
Can you tell me if I can graphically add more events? I noticed that we can delete them, but can we add them?
I don't have the flag to use it as Security Sensor, am I missing something? Please see attached.

Thanks!
Title: Re: Noob questions - Virtual Sensor inside Alarm System
Post by: joaoasilva on September 26, 2014, 11:59:21 PM
No worries, a factory reset fixed everything :)

Thanks for all!
Title: Re: Noob questions - Virtual Sensor inside Alarm System
Post by: joaoasilva on September 27, 2014, 12:39:33 AM
Ok, now I have the flag to select as Security Sensor but when I call /api/Media.IpCamera/1/Camera.MotionDetected/ I see the alert on the web interface but nothing happens, on the log it just changes the value of MotionDetect from 255 and then immediately to 0...

Please advise.

Thanks
Title: Re: Noob questions - Virtual Sensor inside Alarm System
Post by: Gene on September 27, 2014, 01:12:57 AM
http://www.homegenie.it/docs/alarmsystem.php (http://www.homegenie.it/docs/alarmsystem.php)

hope this helps,
g.
Title: Re: Noob questions - Virtual Sensor inside Alarm System
Post by: joaoasilva on September 27, 2014, 01:27:11 AM
Yes, it helped... that was the tutorial I followed...
The problem is that the system gets armed, I defined an email to send the alert but none is sent.
I've already tested a script with Net.SendMessage("[email protected]", "Test message", "Hello World!"); and it works perfectly...

Thanks!
Title: Re: Noob questions - Virtual Sensor inside Alarm System
Post by: Gene on September 27, 2014, 01:42:53 AM
So, if you can make a program that actually sends the email, you can also tell the security alarm system to launch that program when alarmed.
See security program configuration options.

g.
Title: Re: Noob questions - Virtual Sensor inside Alarm System
Post by: joaoasilva on September 27, 2014, 01:48:14 AM
I've inserted the email in the text box labeled "Comma separated list of recipients e-mails for alarm notifications" but when I trigger the alarm, it doesn't send...
I just made a test program to check if it was a bad configuration on the email program like smtp and ssl, etc or the alarm system. Seems to be the alarm system because the test program worked fine.

I noticed that the code is wrapped inside Program.RunAsyncTask, is there anything I need to do to run AsyncTasks? or it should just work?

Edit: Just tested and without the async task it works... the system hangs for some seconds though... :(
Title: Re: Noob questions - Virtual Sensor inside Alarm System
Post by: Bitcraze on May 21, 2015, 06:07:41 PM
Hi, all

In ALARM: "Program to run when disarmed"


What can I enter there, to use?

I have been trying to send an e-mail, by using:

Net.SendMessage("[email protected]", "Test message", "Hello World!");

No luck!
Title: Re: Noob questions - Virtual Sensor inside Alarm System
Post by: dani on May 21, 2015, 11:31:00 PM
I think you have to put the number or the name of the program to run.
Title: Re: Noob questions - Virtual Sensor inside Alarm System
Post by: kevin1 on May 22, 2015, 05:29:39 PM
If you're using the generic IP camera widget then you can raise the motiondetect event on that camera with this api call:

How does HG know that motion was detected?  Is it running a motion detection algorithm, if so are there settings for sensitivity?  Thanks, HG is so fun to learn/use  :-)