Light control
Light control API
The VAPIX® Light control API makes it possible to control the behavior and functionality of IR and White light LEDs in the Axis devices. This is done through JSON commands, and the API also have support for the On-screen controls API in order to control the lights directly, something that was not possible with the older Light control service API.
Overview
The API is built around the lightcontrol.cgi
, which makes it possible to query for one or several light devices and their status, controlling their light intensity and focus, and turning them on/off.
The CGI consists of the following methods:
Method | Description |
---|---|
getSupportedVersions | Lists the API versions that are supported by the CGI. |
getServiceCapabilities | Lists the capabilities of the light control. |
getLightInformation | Lists the light control information. |
activateLight | Activates the light. |
deactivateLight | Deactivates the light. |
enableLight | Enables the light functionality on the device. |
disableLight | Disables the light functionality on the device. |
getLightStatus | Retrieves the light status from a given Light ID. |
setAutomaticIntensityMode | Enables the automatic light intensity control. |
getValidIntensity | Lists the valid light intensity values. |
setManualIntensity | Manually sets the intensity. |
getManualIntensity | Retrieves the intensity from the setManualIntensity request. |
setIndividualIntensity | Manually sets the intensity for an individual LED. |
getIndividualIntensity | Retrieves the intensity from the setIndividualIntensity request. |
getCurrentIntensity | Retrieves the current intensity. |
setAutomaticAngleOfIlluminationMode | Automatically controls the angle of illumination. Using this mode means that the angle of illumination is the same as the camera’s angle of view. |
getValidAngleOfIllumination | Lists the valid angle of illumination values. |
setManualAngleOfIllumination | Sets the manual angle of illumination. This is useful when the angle of illumination needs to be different from the camera’s view angle. |
getManualAngleOfIllumination | Retrieves the angle of illumination from the setManualAngleOfIllumination request. |
getCurrentAngleOfIllumination | Retrieves the current angle of illumination. |
setLightSynchronizeDayNightMode | Enables automatic synchronization with the day/night mode. |
getLightSynchronizeDayNightMode | Checks if the automatic synchronization is enabled with the day/night mode. |
getValidIRWavelengths | Lists the valid IR wavelengths. |
setIRWavelength | Sets the IR wavelength. |
getIRWavelength | Retrieves the currently set IR wavelength |
Identification
- Property:
Properties.API.HTTP.Version=3
- Property:
Properties.LightControl.LightControl2=yes
- Firmware:
7.40 and later
- API Discovery:
id=light-control
Obsoletes
A successful response from the getServiceCapabilities
method will list supported capabilities of the light controller service. This is followed by an array that contains the supported capabilities for each LEDgroup
. It is recommended to use this array, as the global capabilities have been deprecated.
Common examples
Get supported versions
Use this example to get a list of API versions that are supported on the device.
- Send a request to receive a list of the supported API versions:
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"context": "my context",
"method": "getSupportedVersions"
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "2.1",
"context": "my context",
"method": "getSupportedVersions",
"data": {
"apiVersions": [
"1.0",
"2.1",
]
}
}
b) Failed response example:
{
"apiVersion": "2.1",
"context": "my context",
"method": "getSupportedVersions",
"error": {
"code": 8000,
"message": "Internal error, could not complete request."
}
}
See getSupportedVersions for further instructions.
Get service capabilities
Use this example to list the capabilities of the light controller that is supported on the device.
Please note that the global capabilities have been deprecated and the capabilities
array should be used instead.
- Send a request to receive a list showing the light service capabilities.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "getServiceCapabilities"
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getServiceCapabilities",
"data": {
"automaticIntensitySupport": true,
"manualIntensitySupport": true,
"individualIntensitySupport": false,
"getCurrentIntensitySupport": true,
"manualAngleOfIlluminationSupport": false,
"automaticAngleOfIlluminationSupport": false,
"dayNightSynchronizeSupport": true,
"multiIRWaveLengthSupport": true,
"capabilities": [
{
"lightID": id,
"automaticIntensitySupport": true,
"manualIntensitySupport": true,
"individualIntensitySupport": false,
"getCurrentIntensitySupport": true,
"manualAngleOfIlluminationSupport": false,
"automaticAngleOfIlluminationSupport": false,
"dayNightSynchronizeSupport": true,
"multiIRWaveLengthSupport": true
},
{
"lightID": id,
"automaticIntensitySupport": true,
"manualIntensitySupport": true,
"individualIntensitySupport": false,
"getCurrentIntensitySupport": true,
"manualAngleOfIlluminationSupport": false,
"automaticAngleOfIlluminationSupport": false,
"dayNightSynchronizeSupport": true,
"multiIRWaveLengthSupport": true
}
]
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getServiceCapabilities",
"error": {
"code": 7000,
"message": "The requested API version is not supported by this implementation."
}
}
See getServiceCapabilities for further instructions.
Get light information
Use this example to list the light control information on the device.
- Send a request to receive a list of lights and their configuration and status.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "getLightInformation",
"params": {
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getLightInformation",
"data": {
"items": [
{
"lightID": "led0",
"lightType": "IR",
"enabled": true,
"synchronizeDayNightMode": true,
"lightState": false,
"automaticIntensityMode": false,
"automaticAngleOfIlluminationMode": false,
"nrOfLEDs": 1,
"error": false,
"errorInfo": ""
},
{
"lightID": "led1",
"lightType": "IR",
"enabled": true,
"synchronizeDayNightMode": false,
"lightState": false,
"automaticIntensityMode": false,
"automaticAngleOfIlluminationMode": false,
"nrOfLEDs": 2,
"error": false,
"errorInfo": ""
}
]
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getLightInformation",
"error": {
"code": 2000,
"message": "Failed to allocate memory for request."
}
}
See getLightInformation for further instructions.
Activate light
Use this example to turn on the light of a specific Light ID.
- Send a request to activate the lights of a given Light ID. Please note that a single Light ID can still contain several LEDs and/or lamps.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "activateLight",
"params": {
"lightID": "led0"
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "activateLight",
"data": {
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "activateLight",
"error": {
"code": 1002,
"message": "Provided lightID parameter is not valid for the device."
}
}
See activateLight for further instructions.
Deactivate light
Use this example to turn off the lights of a specific Light ID.
- Send a request to deactivate the lights of a given Light ID.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "deactivateLight",
"params": {
"lightID": "led0",
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "deactivateLight",
"data": {
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "deactivateLight",
"error": {
"code": 1002,
"message": "Provided lightID parameter is not valid for the device."
}
}
See deactivateLight for further instructions.
Enable light
Use this example to enable the lights of a specific Light ID. Note that a disabled light can not be turned on.
- Send a request to enable the lights of a given Light ID.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "enableLight",
"params": {
"lightID": "led0",
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "enableLight",
"data": {
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "enableLight",
"error": {
"code": 1005,
"message": "Hardware failure, could not complete request."
}
}
See enableLight for further instructions.
Disable light
Use this example to disable the light of a specific Light ID. Note that a disabled light can not be turned on.
- Send a request to disable the lights of a given Light ID.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "disableLight",
"params": {
"lightID": "led0",
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "disableLight",
"data": {
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "disableLight",
"error": {
"code": 1005,
"message": "Hardware failure, could not complete request."
}
}
See disableLight for further instructions.
Get light status
Use this example to get the status of a specified Light ID.
- Send a request to receive the status of the lights of a given Light ID.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "getLightStatus",
"params": {
"lightID": "led0"
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getLightStatus",
"data": {
"status": true
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getLightStatus",
"error": {
"code": 1002,
"message": "Provided lightID parameter is not valid for the device."
}
}
See getLightStatus for further instructions.
Set automatic intensity mode
Use this example to enable the automatic light intensity controller.
- Send a request to change the setting of the automatic intensity mode.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "setAutomaticIntensityMode",
"params": {
"lightID": "led0",
"enabled": true
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setAutomaticIntensityMode",
"data": {
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setAutomaticIntensityMode",
"error": {
"code": 1005,
"message": "Hardware failure, could not complete request."
}
}
See setAutomaticIntensityMode for further instructions.
Get valid intensity
Use this example to get a list of valid light intensity ranges. Values within this range can be used to change the intensity of the light when using the setManualIntensity
method.
- Send a request to receive a list of supported intensity ranges.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "getValidIntensity",
"params": {
"lightID": "led0",
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getValidIntensity",
"data": {
"ranges": [
{
"low": 0,
"high": 50
}
]
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getValidIntensity",
"error": {
"code": 1002,
"message": "Provided lightID parameter is not valid for the device."
}
}
See getValidIntensity for further instructions.
Set manual intensity
Use this example to set the manual intensity of a light.
- Send a request to receive the manual intensity level of a light.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "setManualIntensity",
"params": {
"lightID": "led0",
"intensity": 50
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setManualIntensity",
"data": {
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setManualIntensity",
"error": {
"code": 1002,
"message": "Provided lightID parameter is not valid for the device."
}
}
See setManualIntensity for further instructions.
Get manual intensity
Use this example to get the manually configured intensity from the previous example.
- Send a request to receive a response with the currently configured manual intensity level of a light.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "getManualIntensity",
"params": {
"lightID": "led0"
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getManualIntensity",
"data": {
"intensity": 50
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getManualIntensity",
"error": {
"code": 1002,
"message": "Provided lightID parameter is not valid for the device."
}
}
See getManualIntensity for further instructions.
Set individual intensity
Use this example to manually change the intensity of an individual LED light.
- Send a request to receive a manual intensity level for either a single or group of LED lights.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "setIndividualIntensity",
"params": {
"lightID": "led0",
"LEDID": 1,
"intensity": 100
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setIndividualIntensity",
"data": {
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setIndividualIntensity",
"error": {
"code": 1002,
"message": "Provided lightID parameter is not valid for the device."
}
}
See setIndividualIntensity for further instructions.
Get individual intensity
Use this example to get the manually configured intensity of an individual LED light.
- Send a request to receive the current intensity level for either a single or a group of LED lights.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "getIndividualIntensity",
"params": {
"lightID": "led0",
"LEDID": 2
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getIndividualIntensity",
"data": {
"intensity": 100
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getIndividualIntensity",
"error": {
"code": 1002,
"message": "Provided lightID parameter is not valid for the device."
}
}
See getIndividualIntensity for further instructions.
Get current intensity
Use this example to get the current intensity of a light.
- Send a request to receive the current intensity of a light.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "getCurrentIntensity",
"params": {
"lightID": "led0"
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getCurrentIntensity",
"data": {
"intesity": 100
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getCurrentIntensity",
"error": {
"code": 1005,
"message": "Hardware failure, could not complete request."
}
}
See getCurrentIntensity for further instructions.
Set automatic angle of illumination mode
Use this example to automatically control the angle of illumination.
- Send a request to receive a change of the automatic angle of illumination mode for a light.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "setAutomaticAngleOfIlluminationMode",
"params": {
"lightID": "led0",
"enabled": true
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setAutomaticAngleOfIlluminationMode",
"data": {
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setAutomaticAngleOfIlluminationMode",
"error": {
"code": 1001,
"message": "Method call not supported by the device."
}
}
See setAutomaticAngleOfIlluminationMode for further instructions.
Get valid angle of illumination
Use this example to get a list of supported angle of illumination ranges for a light.
- Send a request to receive a list of valid ranges for angle of illumination for a light.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "getValidAngleOfIllumination",
"params": {
"lightID": "led0"
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getValidAngleOfIllumination",
"data": {
"ranges": [
{
"low": 10,
"high": 30
},
{
"low": 20,
"high": 50
}
]
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getValidAngleOfIllumination",
"error": {
"code": 1001,
"message": "Method call not supported by the device."
}
}
See getValidAngleOfIllumination for further instructions.
Set manual angle of illumination
Use this example to manually control the angle of illumination.
- Send a request to make a change of the manual angle of illumination for a light.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "setManualAngleOfIllumination",
"params": {
"lightID": "led0",
"angleOfIllumination": 30
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setManualAngleOfIllumination",
"data": {
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setManualAngleOfIllumination",
"error": {
"code": 1002,
"message": "Provided lightID parameter is not valid for the device."
}
}
See setManualAngleOfIllumination for further instructions.
Get manual angle of illumination
Use this example to get the current configured manual angle of illumination.
- Send a request to receive the current configured manual angle of illumination mode for a light.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "getManualAngleOfIllumination",
"params": {
"lightID": "led0"
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getManualAngleOfIllumination",
"data": {
"angleOfIllumination": 30
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getManualAngleOfIllumination",
"error": {
"code": 1005,
"message": "Hardware failure, could not complete request."
}
}
See getManualAngleOfIllumination for further instructions.
Get current angle of illumination
Use this example to get the current angle of illumination.
- Send a request to receive the current angle of illumination for a light.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "getCurrentAngleOfIllumination",
"params": {
"lightID": "led0"
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getCurrentAngleOfIllumination",
"data": {
"angleOfIllumination": 20
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getCurrentAngleOfIllumination",
"error": {
"code": 1001,
"message": "Method call not supported by the device."
}
}
See getCurrentAngleOfIllumination for further instructions.
Set light synchronize day night mode
Use this example to turn on automatic day/night synchronization mode.
- Send a request to make a change to the automatic synchronization and day/night mode for a light.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "setLightSynchronizationDayNightMode",
"params": {
"lightID": "led0",
"enabled": false
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setLightSynchronizeDayNightMode",
"data": {
}
}
b) Failed response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "setLightSynchronizeDayNightMode",
"error": {
"code": 1001,
"message": "Method call not supported by the device."
}
}
See setLightSynchronizeDayNightMode for further instructions.
Get light synchronize day night mode
Use this example to check if the automatic synchronization for the day/night mode is enabled.
- Send a request to make a change to the automatic synchronization and day/night mode for a light.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.0",
"context": "my context",
"method": "getLightSynchronizeDayNightMode",
"params": {
"lightID": "led0"
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getLightSynchronizeDayNightMode",
"data": {
"enabled": false
}
}
b) Failed response exampled:
{
"apiVersion": "1.0",
"context": "my context",
"method": "getLightSynchronizeDayNightMode",
"error": {
"code": 1001,
"message": "Method call not supported by the device."
}
}
See getLightSynchronizeDayNightMode for further instructions.
Get valid infrared wavelengths
Use this example to retrieve a list of valid infrared wavelengths. The wavelengths themselves can be changed with the setIRWavelength
method.
- Request a list of supported infrared wavelengths.
http://myserver/axis-cgi/lightcontrol.cgi
JSON input parameters
{
"apiVersion": "1.2",
"context": "my context",
"method": "getValidIRWavelengths",
"params": {
"lightID": "led0"
}
}
- Parse the JSON response.
a) Successful response example:
{
"apiVersion": "1.2",
"context": "my context",
"method": "getValidIRWavelengths",
"data": {
"wavelength": [
"850nm",
"940nm"
]
}
}
b) Failed response example:
{
"apiVersion": "1.2",
"context": "my context",
"method": "getValidIRWavelengths",
"error": {
"code": 1002,
"message": "Provided lightID parameter is not valid for the device."
}
}
See getValidIRWavelengths for further instructions.