Table of Contents
Foscam HD Cameras
Newer HD capable cameras from Foscam use this api. The camera I have supports only a subset of these commands and no PTZ functions at all so those are not tested as of this first release.
In AppleScript all commands below are sent inside of a tell block to talk to the specific interface instance that you wish to control like:
tell xInterface “name of your camera plugin instance” to setBrightness( 75)
or if you have multiple commands to send together use a standard multi line block like:
tell xInterface “name of your camera plugin instance” setBrightness( 75) setContrast( 40) end tell
Motion and Sound Detection:
Motion and Sound detection are enabled by default. A unit for Video Motion and Sound detection will be created when this plugin is first started up. If your camera does not support them or if you do not wish to do the scanning you can disable them by using the enable motion and enable sound commands below.
Enable Motion Detection:
Pass True or False to enable or disable motion detection in the plugin. This command does not change the settings in the camera and the camera must have motion detection turned on in order for this to receive anything.
tell xInterface “FoscamCam” to enableMotionDetection( True)
Enable Sound Detection:
Pass True or False to enable or disable motion detection in the plugin. This command does not change the settings in the camera and the camera must have sound detection turned on in order for this to receive anything.
tell xInterface “FoscamCam” to enableSoundDetection( True)
Set Motion Armed:
Pass True or False to enable motion detection in the camera. This does not change the plugin scanning settings which must also be on in order for the plugin to receive any events from the camera. See the Enable Motion Detection command above.
tell xInterface “FoscamCam” to setMotionArmed( True)
Set Motion Sensitivity:
Pass either a number from 0 through 4 or the text representation of the motion sensitivity you would like to set in the camera.
- 0 or “lowest“
- 1 or “lower”
- 2 or “low“
- 3 or “normal”
- 4 or “high“
tell xInterface “Foscam” to setMotionSensitivity( “high”)
Set Sound Armed:
This turns on or off sound detection in the camera. The plugin itself must also have sound scanning enabled via the enableSoundDetection command above.
Pass True or False to enable or disable sound detection in the camera.
tell xInterface “Foscam” to setSoundArmed( True)
Set Sound Sensitivity:
Pass either a number 0 through 2 or one of the labels below to adjust the cameras sound sensitivity.
- 0 or “low”
- 1 or “normal“
- 2 or “high”
tell xInterface “Foscam” to setSoundSensitivity( “high”)
Unless otherwise noted all picture adjustments take an integer from 0 to 100.
tell xInterface “Foscam” to setBrightness( 50)
tell xInterface “Foscam” to setContrast( 50)
tell xInterface “Foscam” to setHue( 50)
tell xInterface “Foscam” to setSaturation( 50)
tell xInterface “Foscam” to setSharpness( 50)
Resets all the above image settings to their default values. Takes no parameters.
tell xInterface “Foscam” to resetImage()
Pass True to flip the image vertically or False if the camera is right side up.
tell xInterface “Foscam” to setFlip( True)
Pass True to mirror the image left to right or False to stop mirroring.
tell xInterface “Foscam” to setMirror( False)
This appears to be some lens or angle correction setting and has 3 valid settings:
tell xInterface “Foscam” to setRatio( “normal”)
Set Picture Quality:
This affects the jpeg encoding quality of the snapshot. Useful if you are saving snapshots and need more quality after dark as opposed to during the day due to noise or something similar. Also if you are recording from the camera a slow frame rate via the Jpeg Refresh plugin this would be able to adjust the quality and therefore the bandwidth required by the stream.
tell xInterface “Foscam” to setPictureQuality( “high”)
On Screen Display Settings:
Turn on and off the timestamp display overlayed on the camera image:
tell xInterface “Foscam” to showTimestamp( True)
Show Camera Name:
Turns on and off the Camera Name display overlayed on the camera image:
tell xInterface “Foscam” to showCameraName( True)
Enable Overlay Mask:
Pass True or False to turn on or off the privacy mask areas in the video.
tell xInterface “Foscam” to enableOverlayMask( False)
Set Camera Name:
Pass a short string to use in the Camera Name display that you can turn on and off above. This is useful for more than just the camera name. You might add a temperature reading to the end of the camera name or a message for a time telling why the camera was recording something like “Kitchen: Motion Front Hall” and then in a few seconds switch it back to just “Kitchen”
tell xInterface “Foscam” to setCameraName( “Kitchen: “ & (value of “Temperature Kitchen”) & “°F”)
Log Video Settings:
Writes the current video settings to the log so that you can create commands more easily to set things up as they are now.
tell xInterface “Foscam” to logVideoSettings()
Pan Tilt Zoom Control:
PTZ Control in these cameras is very much designed for a simple user interface. There is generally a command to start moving in a particular direction that is sent when you would click on an interface button and another command to stop the motion when you release the button. This can be done in scripting as well but as a convienience for simpler control you can pass an optional value for how long you want the camera to move in that direction. These commands will automatically send the stop command after that amount of time. The value is a floating point number and each whole number is half a second of movement in the selected direction. If no time value is passed then the camera will keep moving until you run the stop command.
Stops any motion that is not timed but ongling. If you issue any of the movement commands without a time limit they will keep running until you issue this command. This command takes no parameters.
tell xInterface “Foscam” to ptzStop()
All PTZ commands can be sent without a parameter to start movement in that direction, but you then must issue the stop command to stop the camera moving. If you add a parameter the camera will move that many half seconds before the plugin issues the stop event for you. The commands are queued and executed one at a time so it would be fine to send several timed commands all at once.
Movement Commands are:
- ptzUp( 4)
- ptzDown( 4)
- ptzLeft( 4)
- ptzRight( 0.7)
- ptzUpLeft( 1)
- ptzUpRight( 2)
- ptzDownLeft( 1)
- ptzDownRight( 4)
Same parameters as the other PTZ commands, zooms in the number of half seconds passed.
tell xInterface “Foscam” to zoomIn( 4)
tell xInterface “Foscam” to zoomOut( 2)
If you start a zoom without a time frame the camera will continue to zoom until you issue this stop command.
tell xInterface “Foscam” to zoomStop()
Set Zoom Speed:
pass the name of the speed you wish to set for zoom speed.
tell xInterface “Foscam” to setZoomSpeed( “normal”)
Takes no parameters, resets the PTZ system to test the endpoints in order to recenter the movement.
tell xInterface “Foscam” to ptzReset()
Sets the PTZ speed. Valid values are:
tell xInterface “Foscam” to ptzSpeed( “slowest”)
PTZ Goto Preset:
Sends the camera to the named preset. In these cameras it appears that presets are not numbered but are given a name and that name needs to be passed to this command.
tell xInterface “Foscam” to ptzGotoPreset( “driveway end”)
PTZ Set Preset:
Sets the current location as a preset with the passed name. Cameras have a limited number of presets that they will support see also the delete preset command below.
tell xInterface “Foscam” to ptzSetPreset( “default”)
PTZ Delete Preset:
Deletes a named preset from the preset table in the camera freeing space for new presets.
tell xInterface “Foscam” to ptzDeletePreset( “preset no longer needed”)
PTZ Log Preset Names:
Queries the camera for a list of currently available preset names and writes them to the log. This is useful for programming as you can see what is actually in the camera and their proper spellings and such.
tell xInterface “Foscam” to ptzLogPresetNames()
PTZ Start Cruise:
These cameras may support named “cruise” maps which can be confiured to pan between various preset points. To start a named cruise map pass it’s name to this command.
tell xInterface “Foscam” to ptzStartCruise( “night patrol”)
PTZ Stop Cruise:
Takes no parameters, stops any currently running cruise program.
tell xInterface “Foscam” to ptzStopCruise()
PTZ Log Cruise Names:
Queries the camera for the names of all currently configured cruise programs and writes them to the log. Just to help with programming the camera.
tell xInterface “Foscam” to ptzLogCruiseMapNames()
IR Illuminator Control:
IR Light On:
tell xInterface “Foscam” to IROn()
IR Light Off:
tell xInterface “Foscam” to IROff()
Set IR Auto:
Sets the IR light to auto mode where it will come on when the camera thinks it is needed.
tell xInterface “Foscam” to setIRAuto()
Set IR Manual:
The IR light will wait for your specific commands to turn on or off.
tell xInterface “Foscam” to setIRManual()
tell xInterface “Foscam” to Reboot()
Set Auto Reboot:
If you are turning the auto reboot off just pass False. If you are turning it on then pass true and a second integer parameter that is the number of days between auto reboots. 7 for once a week, 30 for once a month, or any other reasonable number that you wish.
tell xInterface “Foscam” to setAutoReboot( True, 7)
Set Audio Volume:
This is the volume of volume output from the camera if you are playing a file or using the talk through feature. Valid values are from 0 to 100.
tell xInterface “Foscam” to setAudioVolume( 56)