Author Topic: How to Create Scene to enable/disable Foscam mail notification?  (Read 13802 times)

Offline billg

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
I looked around and did not see anything that would allow MCV to send an image captured from Foscam to email or phone. Seems you can have the Foscam send email upon motion detection or log into Vera and look thru the image archive when a trigger notification is sent out.

Would it be possible to create a scene to arm the vera motion module and also send a Luup string to the camera and enable the email option. You would have everything already setup in Foscam and the only parameter that would be toggled thru vera would be email on or off.

I was able to do this from the address bar in explorer, while log into the camera using the code below (I found on the web). All of the other parameters where already set in my Foscam, all I was doing was toggling the send mail on and off

HTTP:/192.168.0.200/set_alarm.cgi?mail=1
HTTP:/192.168.0.200/set_alarm.cgi?mail=0

Any help always appreciated?.

set_alarm.cgi
Description: Set the device alarm option
Authorization:manager

Grammar:
/set_alarm.cgi?motion_armed=&motion_sensitivity=&input_armed=&iolinkage=&mail
=&upload_interval=&schedule_enable=&schedule_sun_0=&schedule_sun_1=&sche
dule_sun_2=&schedule_mon_0=&schedule_mon_1=&schedule_mon_2=&schedule
_tue_0=&schedule_tue_1=&schedule_tue_2=&schedule_wed_0=&schedule_wed_1
=&schedule_wed_2=&schedule_thu_0=&schedule_thu_1=&schedule_thu_2=&sche
dule_fri_0=&schedule_fri_1=&schedule_fri_2=&schedule_sat_0=&schedule_sat_1=
&schedule_sat_2=[&ioin_level=&ioout_level=&user=&pwd=&next_url=]

Parameter:
motion_armed 0: Mobile detection disarm; 1: deployment
motion_sensitivity 0-9:High - low
input_armed 0: Input test disarm; 1: deployment
ioin_level io enter the alarm trigger level, 0: low, 1: High
iolinkage 0: alarm linkage against io; 1: allow
ioout_level linkage output level, 0: low, 1: High
mail 0: Alarm mail notification when the ban; 1: allow
upload_interval Interval (second) of upload picture when alarm,0:
forbidden,0-65535
schedule_enable Whether adopt the deployment plan
schedule_sun_0
schedule_sun_1
schedule_sun_2
Sunday deployment plan by 24 hours a day and 15
minutes,divided into 96 deployment periods.
bit0-95: 0: The time is not deployed; 1: The
deployment time
schedule_mon_0
schedule_mon_1
schedule_mon_2
schedule_tue_0
schedule_tue_1
schedule_tue_2
schedule_wed_0
schedule_wed_1
schedule_wed_2
schedule_thu_0
schedule_thu_1
schedule_thu_2
schedule_fri_0
schedule_fri_1
schedule_fri_2
schedule_sat_0
schedule_sat_1
schedule_sat_2

Offline Crismaison

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +2/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #1 on: June 25, 2013, 01:06:36 am »
What i did is create a scene which enables the Foscam schedule. This activates the Foscam and will as of then send pictures when there is motion. A simila scene is made to switch the schedule of again
Vera lite - Everspring smoke & flood detectors - Fibaro doorsensors - 2 Foscams - Greenwave 6 node smartplug - Several Switches -Netatmo - PLEG - Twilio - DropBoxuploader - FindmyIphone user

Offline billg

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #2 on: June 25, 2013, 01:15:38 pm »
Thanks for the reply. Can you expand on the settings a little. I looked in the scene creator and did not see a foscam scheduler toggle?

Maybe not looking in the right place.

Thanks again Bill

Offline Crismaison

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +2/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #3 on: June 25, 2013, 02:16:02 pm »
To switch the scheduler on:

  Luup.inet.wget( 'http://ipaddres/set_alarm.cgi?motion_armed=1&user=vera&pwd=vera')

Ipaddress is your ip, user and password example is vera
Vera lite - Everspring smoke & flood detectors - Fibaro doorsensors - 2 Foscams - Greenwave 6 node smartplug - Several Switches -Netatmo - PLEG - Twilio - DropBoxuploader - FindmyIphone user

Offline billg

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #4 on: June 26, 2013, 09:50:39 am »
Hi Screamhouse,

I tried it with my info, saved it all, when MCV reloaded, the progress window said error. Did I complete the string correctly below?...

 Luup.inet.wget( 'http://192.168.0.200/set_alarm.cgi?motion_armed=1&yard=vera&pwd=green')

Offline mikee123

  • Hero Member
  • *****
  • Posts: 1521
  • Karma: +18/-11
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #5 on: June 26, 2013, 10:07:51 am »
What i did is create a scene which enables the Foscam schedule. This activates the Foscam and will as of then send pictures when there is motion. A simila scene is made to switch the schedule of again

I would love to do this too as i have 2 Foscam cameras (the HD one not working yet properly). What does this Foscam schedule do ? I do not understand how that would send an email with a picture.
It would be great if you could post some more details for beginners please
I appreciate its probably a bit of work to post it all
but i am sure i would not be the only one who would find this very helpful and really appreciate your work

Offline Crismaison

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +2/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #6 on: June 26, 2013, 02:13:46 pm »
I really hope this is what you want.

Please understand the Foscam is basically doing all the work and sending the emails. To be able to have the motion sensor on the Vera working, in the Foscam Device management -> alarm service settings -> Motion detection Armed needs to be checked. You will now see the possibility to check the Scheduler. Here I have set the scheduler to be always on. Every day, every hour. This means for every motion detection the Foscam sends me an email.

On vera side I set whatever I want (in my case a Prowl/SMS notification) in case the sensor is tripped. Note once more, the sensor is ONLY tripped when the Motion detecion in the Foscam is active.

The ONLY thing I now did, is create a scene which either checks the Motion detection Armed checkbox or unchecks it. So I run this at 0:00 and it arms the Foscam and at 6:00 I disarm it. Of course when I leave the house I can arm it easily via the scene manually.

[IP] = your Foscam IP
[username] = Foscam username
[password] = Foscam password

To switch it on:

luup.inet.wget( 'http://[IP]/set_alarm.cgi?motion_armed=1&user=[username]&pwd=[password]')

To Switch it off:
luup.inet.wget( 'http://[IP]/set_alarm.cgi?motion_armed=0&user=[username]&pwd=[password]')

Let me know if this is what you mean
Vera lite - Everspring smoke & flood detectors - Fibaro doorsensors - 2 Foscams - Greenwave 6 node smartplug - Several Switches -Netatmo - PLEG - Twilio - DropBoxuploader - FindmyIphone user

Offline Crismaison

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +2/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #7 on: June 26, 2013, 02:27:31 pm »
Hi Screamhouse,

I tried it with my info, saved it all, when MCV reloaded, the progress window said error. Did I complete the string correctly below?...

 Luup.inet.wget( 'http://192.168.0.200/set_alarm.cgi?motion_armed=1&yard=vera&pwd=green')

You mixed up username, should be user=yard

Vera lite - Everspring smoke & flood detectors - Fibaro doorsensors - 2 Foscams - Greenwave 6 node smartplug - Several Switches -Netatmo - PLEG - Twilio - DropBoxuploader - FindmyIphone user

Offline mikee123

  • Hero Member
  • *****
  • Posts: 1521
  • Karma: +18/-11
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #8 on: June 26, 2013, 02:58:52 pm »
Yes that explains the Foscam side, pretty sure i understand. I dont know how to set up prowl though. But i guess i might find something on the forum here which deals with that side, will have a dig over the weekend. Many thanks

Offline beachboync

  • Full Member
  • ***
  • Posts: 197
  • Karma: +4/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #9 on: July 25, 2013, 01:57:11 pm »
Hi guys. I think I am missing something pretty dumb, but this successfully turns on the motion detect in the Foscam every time

   luup.inet.wget('http://192.168.1.202:8000/set_alarm.cgi?motion_armed=1&user=x&pwd=x') (user and pwd changed to protect the guilty)

but changing "motion_armed=0" does NOT turn if off. I have run it many times, checked the CGI document to make sure that 0 is unarmed, made sure to hit Refresh in the cam display, etc.

Ideas?

EDIT: While playing around some more, now I see that ON is not working 100% reliably either. Sometimes it works, sometimes it doesn't - with no change in the lua. ?????

EDIT 2: I looked in the Foscam log, and it looks like the command is not getting to the Foscam. Sometimes it does, sometimes it doesn't. Obviously when it works, there is a valid log entry, if not nothing. So it seems like Vera is not sending it to the cam at all. Why?

Thanks, Bob
« Last Edit: July 25, 2013, 02:16:29 pm by beachboync »
Bob (beachboync)

Offline Crismaison

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +2/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #10 on: July 25, 2013, 05:03:23 pm »
Ocassionaly it doesnot switch my foscam on or off. No idea why....
Vera lite - Everspring smoke & flood detectors - Fibaro doorsensors - 2 Foscams - Greenwave 6 node smartplug - Several Switches -Netatmo - PLEG - Twilio - DropBoxuploader - FindmyIphone user

Offline beachboync

  • Full Member
  • ***
  • Posts: 197
  • Karma: +4/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #11 on: July 25, 2013, 07:41:08 pm »
Turns out, my problem seems to have nothing to do with the Foscam. The problem is that I was testing my scenes by clicking Run in the Automation screen. For some reason (or, I guess I still don't understand U15) it was apparently NOT running the scene after all. Only when I would try to Run and THEN click Devices to check the status of a virtual switch would it run OK.

The scenes run correctly always from remote software such as VeraMobile.

The scenes in question just do two things - it turns on (or off) a virtual switch that I can use to see if my Secure mode is set, and then it sends the command to the Foscam to enable (or disable) motion detect.

So why is a scene not running from the U15 Automation screen when I click Run on a scene?
Bob (beachboync)

Offline RoyR

  • Sr. Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #12 on: November 19, 2013, 10:48:23 pm »
I really hope this is what you want.

Please understand the Foscam is basically doing all the work and sending the emails. To be able to have the motion sensor on the Vera working, in the Foscam Device management -> alarm service settings -> Motion detection Armed needs to be checked. You will now see the possibility to check the Scheduler. Here I have set the scheduler to be always on. Every day, every hour. This means for every motion detection the Foscam sends me an email.

On vera side I set whatever I want (in my case a Prowl/SMS notification) in case the sensor is tripped. Note once more, the sensor is ONLY tripped when the Motion detecion in the Foscam is active.

The ONLY thing I now did, is create a scene which either checks the Motion detection Armed checkbox or unchecks it. So I run this at 0:00 and it arms the Foscam and at 6:00 I disarm it. Of course when I leave the house I can arm it easily via the scene manually.

[IP] = your Foscam IP
[username] = Foscam username
[password] = Foscam password

To switch it on:

luup.inet.wget( 'http://[IP]/set_alarm.cgi?motion_armed=1&user=[username]&pwd=[password]')

To Switch it off:
luup.inet.wget( 'http://[IP]/set_alarm.cgi?motion_armed=0&user=[username]&pwd=[password]')

Let me know if this is what you mean

Thank you for this post, works well....just had to add the [IP:port]

Offline wilsonb

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #13 on: August 24, 2014, 09:01:14 pm »
Sorry for being a noob, however.. I don't get it. For starters, for the set_alarm.cgi file, could I just copy the text posted and create the cgi file? I assume this is for linux.
So Im at a terminal on Raspberry Pi running linux.
When I put the created set_alarm file in same place im at in terminal and run the command line with my credentials, I get an error
-bash: syntax error near unexpected token `'http://[ .....

Do I need to do something to cgi file?




I really hope this is what you want.

Please understand the Foscam is basically doing all the work and sending the emails. To be able to have the motion sensor on the Vera working, in the Foscam Device management -> alarm service settings -> Motion detection Armed needs to be checked. You will now see the possibility to check the Scheduler. Here I have set the scheduler to be always on. Every day, every hour. This means for every motion detection the Foscam sends me an email.

On vera side I set whatever I want (in my case a Prowl/SMS notification) in case the sensor is tripped. Note once more, the sensor is ONLY tripped when the Motion detecion in the Foscam is active.

The ONLY thing I now did, is create a scene which either checks the Motion detection Armed checkbox or unchecks it. So I run this at 0:00 and it arms the Foscam and at 6:00 I disarm it. Of course when I leave the house I can arm it easily via the scene manually.

[IP] = your Foscam IP
[username] = Foscam username
[password] = Foscam password

To switch it on:

luup.inet.wget( 'http://[IP]/set_alarm.cgi?motion_armed=1&user=[username]&pwd=[password]')

To Switch it off:
luup.inet.wget( 'http://[IP]/set_alarm.cgi?motion_armed=0&user=[username]&pwd=[password]')

Let me know if this is what you mean

Offline homeuser

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +2/-0
Re: How to Create Scene to enable/disable Foscam mail notification?
« Reply #14 on: March 16, 2016, 12:02:47 am »
Sorry for resurrecting an old thread but I hope it helps someone. All the posts I found were pertaining to the Foscam sending http post triggers to Vera and not How to get Vera send http commands to Foscam.  This thread put me on the right track.


I have a newer H.264 Foscam that I wanted Vera to toggle the motion detection on and off automatically when changing to home, away or vacation modes. I'm using my Foscam independent of Vera (I never could get it to integrate with Vera, maybe because it's a h.264 version?) and it does what I need without Vera except enable motion detection when I leave the house.

I used the http://code.mios.com/trac/mios_house_modes_plugin house modes plugin to create scenes with the code below that will automatically toggle the cameras motion settings using an http post from Vera


To enable motion I used
Code: [Select]
luup.inet.wget( 'Http://xxx.xxx.xx.xxx:xx/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=1&usr=Xxxxx&pwd=Xxxxx')
To disable motion I used
Code: [Select]
luup.inet.wget( 'Http://xxx.xxx.xx.xxx:xx/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=0&usr=Xxxxx&pwd=Xxxxx')
« Last Edit: March 16, 2016, 12:15:55 am by homeuser »