When setting the HomeGenie Security Alarm System, I wanted it to Arm or Disarm my IP camera automatically, here is how you can do it:
Trigger Code C#
return Modules.WithName("Security Alarm System").Get().Parameter("Status.Level").Value == "1";
Program Code C#
var LivingRoomCam = "http://192.168.X.X/set_alarm.cgi?motion_armed=1&motion_sensitivity=4&user=username&pwd=password&input_armed=0&iolinkage=0&mail=0&upload_interval=2&schedule_enable=&schedule_sun_0=&schedule_sun_1=&schedule_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=&schedule_fri_0=&schedule_fri_1=&schedule_fri_2=&schedule_sat_0=&schedule_sat_1=&schedule_sat_2=0";
try
{
Net.WebService(LivingRoomCam).GetData();
Program.Notify("Camera", "LivingRoom cam armed");
}
catch (Exception e)
{
Program.Notify("Camera", "LivingRoom cam ERROR");
Net.SendMessage("[email protected]", "LivingRoom camera ARM ERROR", "LivingRoom cam arm ERROR, error: " + e.Message);
}
The most important variables are:
- motion_armed: 1 to Arm, 0 to Disarm
- motion_sensitivity: Sensitivity (From 1 to 10 if I recall correctly)
- user: username
- pwd: password
All the other variables I basically ignore, but if I leave them out the camera gives an error.
Attachment is the Foscam API document.