I could not find any good Android apps that made it simple to arm and disarm my camera (only real option was "Remote4cam"). I wanted a location based approach as I really didn't want to do it manually as that would be a pain and I'm forgetful :-)
So I have created a Tasker profile which will disarm my camera when I'm at home and arm it when I leave. It will display its current state in a permanent Android notification. I can override the automation with arm and disarm widgets on a homescreen (see picture at top right). It will detect errors in the process and the notification will in that case have a red "X" icon and contain the reason code (http status).
I have a Foscam FI8904W camera but the script will probably work without too many changes for any IP camera. It is written to handle a single camera but you could modify it for more (and decide how you want to handle errors etc).
I have replaced all personal information (passwords, gps coord, port number etc) in the Tasker profile file so you should change any string that looks like "{REPLACE:something}" with the correct value for the something and then import the corrected profile. The GPS coordinates of the profile are easiest fixed after importing the profile into Tasker.
I recommend setting up a specific camera userid for the use of Tasker and it may be wise to change it's password occasionally if you are paranoid :-)
To import the profile press and hold the "Profiles" tab and select import from the menu that popped up. The widgets you can create yourself, select the "Task" widget and select the correct task.
Note that you will need to have set up appropriate port forwarding on any routers etc to get to your camera, please verify that you can remotely access your camera via a browser, this will also mean you will know the correct value for the port number etc.
Disarm means untick "Motion Detect Armed" in "Alarm Service Settings" and arm means tick it and set up values for the other options. Note that the "api" of this camera has the sensitivity reversed so if you have a sensitivity of "4" via the web page you will need to set "6" (10-4) via this Tasker script. In any case you want to review the options and verify them after disarming and re-arming.
The following is a summary of the configuration (as generated by Tasker) (you can download a profile you can import by clicking here):
Profile: ArmDisarmCameras (13)Priority: 5 CoolDown: 300Location: -37.839915 / 145.191906 / 300.0mEnter: Disarm_IpCamera (38)Abort Existing TaskA1: Flash [ Text:Disarming Camera.. Long:Off ]A2: Set Widget Label [ Name:Disarm_IpCamera Label:Disarm ]A3: Notify Cancel [ Title:Camera Disarmed Warn Not Exist:Off ]A4: Notify Cancel [ Title:Camera Armed Warn Not Exist:Off ]A5: HTTP Get [ Server:Port:{REPLACE:YourCameraDnsNameOrIpAddress}:{REPLACE:PortNumber} Path:set_alarm.cgi Attributes:motion_armed=0user={REPLACE:UserId}pwd={REPLACE:UserPassword} Timeout:10 Mime Type: Output File:$tmp/DrivewayCamera-DISARM.htm Continue Task After Error:On ]A6: If [ %HTTPR ~ 200 ]A7: Notify [ Title:Camera Disarmed Text:Disarmed at %TIME on %DATE Icon:Number:0 Permanent:On ] A8: ElseA9: Vibrate [ Time:100 ]A10: Notify [ Title:Camera Disarmed Text:[%HTTPR] Disarming failed at %TIME on %DATE Icon:Number:0 Permanent:On ] A11: End IfExit: Arm_IpCamera (36)Abort Existing TaskA1: Flash [ Text:Arming Camera.. Long:Off ]A2: Set Widget Label [ Name:Arm_IpCamera Label:Arm ]A3: Notify Cancel [ Title:Camera Disarmed Warn Not Exist:Off ]A4: Notify Cancel [ Title:Camera Armed Warn Not Exist:Off ]A5: HTTP Get [ Server:Port:{REPLACE:YourCameraDnsNameOrIpAddress}:{REPLACE:PortNumber} Path:set_alarm.cgI Attributes:motion_armed=1motion_sensitivity=6iolinkage=1mail=1upload_interval=1schedule_enable=0user={REPLACE:UserId}pwd={REPLACE:UserPassword} Timeout:10 Mime Type: Output File:$tmp/DrivewayCamera-ARM.htm Continue Task After Error:On ]A6: If [ %HTTPR ~ 200 ]A7: Notify [ Title:Camera Armed Text:Armed at %TIME on %DATE Icon:Number:0 Permanent:On ] A8: ElseA9: Vibrate Pattern [ Pattern:0,50,100,50,500,50,100,50 ]A10: Notify [ Title:Camera Armed Text:[%HTTPR] Arming failed at %TIME on %DATE Icon:Number:0 Permanent:On ] A11: End If
Let me know of any issues as I haven't actually "round tripped" the exported profile.
3 comments:
Thanks for the script, just customized itfor my purposes today, better late than never ;-)
I have a Foscam clone camera and the HTTP get is bit different. Here is the format that is needed for my camera: http://pastebin.com/beTnf6Re
The URL in Pastebin link need to be modified for the Tasker. Replace &-marks with line break so that all options are on their own line. There is also small writing mistage on the original code. The Path: set_alarm.cgl should be set_alarm.cgi on the Arm Camera task. Disarm camera task is correct.
Post a Comment