Light
The Light component handles a dimmable light output with additional on/off control. It has night mode capability that can reduce brightness in selected period of time. It uses Light
as RPC namespace and provides the methods:
Light.GetConfig
to obtain the component's configurationLight.SetConfig
to update the component's configurationLight.GetStatus
to obtain the component's statusLight.Set
to control the output state and brightness levelLight.Toggle
to toggle the output stateLight.DimUp
to dim upLight.DimDown
to dim downLight.DimStop
to stop dimmingLight.SetAll
(if applicable)Light.Calibrate
(if applicable)Light.ResetCounters
to reset component's energy counters (if applicable)
Light components are identified with light:<id>
in objects containing multiple component payloads.
Methods:
Light.SetConfig
Property | Type | Description |
---|---|---|
| number | Id of the Light component instance |
| object | Configuration that the method takes |
Find more about the config properties in config section
Light.GetConfig
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the Light component instance |
Find the Light.GetConfig response properties in config section
Light.GetStatus
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the Light component instance |
Find more about the status response properties in status section
Light.Set
This method sets the output and brightness level of the Light component. It can be used to trigger webhooks. More information about the events triggering webhooks available for this component can be found below.
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Id of the Light component instance. Required |
| boolean | True for light on, false otherwise. Optional |
| number | Brightness level Optional |
| number | Transition time in seconds - time between change from current brightness level to desired brightness level in request Optional |
| number | Optional flip-back timer in seconds. Optional |
| number | Set current brightness level with applied offset. Can not be used together with |
At least one of the on
and brightness
parameters is required.
Light.Toggle
This method toggles the output state. It can be used to trigger webhooks. More information about the events triggering webhooks available for this component can be found below.
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Id of the Light component instance. Required |
Light.DimUp
This method dims up the brightness level. Dimming stops with Light.DimStop.
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Id of the Light component instance. Required |
| number | Fade rate of the brightness level dimming. Range |
Light.DimDown
This method dims down the brightness level. Dimming stops with Light.DimStop.
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Id of the Light component instance. Required |
| number | Fade rate of the brightness level dimming. Range |
Light.DimStop
This method stops the dimming of the brightness level.
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Id of the Light component instance. Required |
Light.SetAll
This method (if applicalbe) sets the output and brightness level of all Light
components in the device. It can be used to trigger webhooks. More information about the events triggering webhooks available for this component can be found below.
Request
Parameters:
Property | Type | Description |
---|---|---|
| boolean | True for light on, false otherwise. Optional |
| number | Brightness level Optional |
| number | Transition time in seconds - time between change from current brightness level to desired brightness level in request Optional |
| number | Optional flip-back timer in seconds. Optional |
| number | Set current brightness level with applied offset. Can not be used together with |
At least one of the on
and brightness
parameters is required.
Light.Calibrate
This method (if applicalbe) starts calibration of device's outputs.
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Id of the Light component instance* |
- In PlusRGBWPM all
light
instances are calibrated with one call toLight.Calibrate
and theid
parameter is ignored.
Response
The result from this method is null
when calibration is started succesfully.
If invoked while calibration is already in progress, an error is returned:
{
"code": -114,
"message": "Callibration is in progress"
}
Light.ResetCounters
This method resets associated counters (if applicable).
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Id of the Light component instance. Required |
| array of strings | Array of strings, selects which counter to reset Optional |
If no 'type' is provided, the method will reset all available counters.
Response
Attributes in the result:
Property | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
| object | Information about the active energy counter prior to reset
|
HTTP Endpoint: /light/id
Through this endpoint a light can be turned on/off with or without a timer, brightness can be changed also. This can be used to trigger webhooks. More information about the events triggering webhooks available for this component can be found below.
Request
Parameters:
Property | Type | Description |
---|---|---|
| string | Action to be executed. Range of values: |
| number | A one-shot flip-back timer in seconds. |
| number | Brightness, 0..100 % |
| number | One-shot transition, 500..10800000 [ms] |
Response
Received attributes:
Property | Type | Description |
---|---|---|
| boolean | True if the light is turned on, false otherwise |
| number | Brightness, 0..100 % |
| number | One-shot transition, 500..10800000 [ms] |
| boolean | True if the light is turned on, false otherwise |
| number | Unix timestamp, start time of the timer (in UTC) |
| number | Duration of the timer in seconds |
| number | Time remaining (in seconds) until the request is executed |
| string | Source of the last command, for example: |
Configuration
The configuration of the Light component contains information about night mode settings, button presets and the timers of the chosen light instance. To Get/Set the configuration of the Light component its id
must be specified.
Properties:
Property | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Id of the Light component instance | ||||||||||||
| string or null | Name of the light instance | ||||||||||||
| string | Mode of the associated input. Range of values: | ||||||||||||
| number | Operational mode (if applicable), which is device-specific. See the table below. | ||||||||||||
| string | Output state to set on power_on. Range of values: | ||||||||||||
| boolean | True if the "Automatic ON" function is enabled, false otherwise | ||||||||||||
| number | Seconds to pass until the component is switched back on | ||||||||||||
| boolean | True if the "Automatic OFF" function is enabled, false otherwise | ||||||||||||
| number | Seconds to pass until the component is switched back off | ||||||||||||
| number | Transition time (in seconds) - time to change from 0% to 100% of brightness (if applicable) | ||||||||||||
| number | Brightness level (in percent) applied when there is a toggle and current brightness is lower than | ||||||||||||
| boolean | Enable or disable night mode | ||||||||||||
| number | Brightness level limit when night mode is active. Default value | ||||||||||||
| array | Containing 2 elements of type string, the first element indicates the start of the period during which the night mode will be active, the second indicates the end of that period. Both start and end are strings in the format HH:MM, where HH and MM are hours and minutes with optinal leading zeros | ||||||||||||
| number | Controls how quickly the output level changes while a button is held down for dimming (if applicable). Default value | ||||||||||||
| object | Button presets config
| ||||||||||||
| array or null | Remaps output 0%-100% range to values in array (if applicable). First value in array is | ||||||||||||
| number | Limit (in Watts) over which overpower condition occurs (shown if applicable) | ||||||||||||
| number | Limit (in Volts) over which overvoltage condition occurs (shown if applicable) | ||||||||||||
| number | Limit (in Volts) under which undervoltage condition occurs (shown if applicable) | ||||||||||||
| number | Limit (in Amperes) over which overcurrent condition occurs (shown if applicable). For PlusRGBWPM shown if device is calibrated. | ||||||||||||
| number | Limit (in Watts) over which overpower condition occurs (shown if applicable) | ||||||||||||
| number | Limit (in Volts) over which overvoltage condition occurs (shown if applicable) |
Valid op_mode
values depend on the device.
op_mode | 0 | 1 |
---|---|---|
Dimmer0/1-10V PM Gen3 | 0-10VDC (default) | 1-10VDC |
follow
: the state of the output is the same as the state of the input (e.g. when the input is off => the output is off). Fortype
:analog
sets to output current%
of input.flip
: change of the state of the input causes change of the state of the output (e.g. when input is toggled the output is also toggled)activate
: when input state ison
sets output toon
(and activatesauto_off
if enabled), input stateoff
does nothing.detached
: the state of the input doesn't affect the state of the output.dim
: short press toggles output, long press starts dimming with alternating directions. If output is currently off, holding the button will turn on and start dimming from 0%. Stops when reached 100% or 1%.dual_dim
: short press toggles output, long press starts dimming up/down depending on which button is pressed. Stops when reached 100% or 1%.follow
andflip
are available fortype
:switch
.activate
available fortype
:switch
andtype
:button
dim
available fortype
:button
dual_dim
available fortype
:button
Status
The status of the Light component contains information about the brightness level and output state of the light instance. To obtain the status of the Light component its id
must be specified.
Properties:
Property | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Id of the Light component instance | |||||||||||||||
| string | Source of the last command, for example: | |||||||||||||||
| boolean | True if the output channel is currently on, false otherwise | |||||||||||||||
| number | Current brightness level (in percent) | |||||||||||||||
| number | Unix timestamp, start time of the timer (in UTC) (shown if the timer is triggered) | |||||||||||||||
| number | Duration of the timer in seconds (shown if the timer is triggered) | |||||||||||||||
| object | Information about the transition (shown if transition is triggered)
| |||||||||||||||
| object | Information about the temperature (if applicable)
| |||||||||||||||
| object | Information about the active energy counter (shown if applicable)
| |||||||||||||||
| number | Last measured instantaneous active power (in Watts) delivered to the attached load (shown if applicable) | |||||||||||||||
| number | Last measured voltage in Volts (shown if applicable) | |||||||||||||||
| number | Last measured current in Amperes (shown if applicable) | |||||||||||||||
| object | Information about the calibration process, only present when calibration is running (shown if applicable).
| |||||||||||||||
| array of type string | Error conditions occurred, shown if at least one error is present. Depending on component capabilities may contain: | |||||||||||||||
| array of type string | Communicates present conditions, shown if at least one flag is set. Depending on component capabilites may contain: |
If applicable, calibration is performed by
Light.Calibrate
. The calibration procedure measures consumption for each channel and should be run when there is change in loads. Consumed power of the load should be >= 3.5W.The following errors can occur during the calibration procedure:
Errors:
cal_abort:interrupted
: input or output are triggeredcal_abort:power_read
: there is an error in reading the powermetercal_abort:no_load
: there is no load attachedcal_abort:non_dimmable
: attached load is not dimmablecal_abort:overpower
: load power exceeds max limitcal_abort:unsupported_load
: load can not be calibrated
Webhook Events
Currently, there are two events related to the Light component that can trigger webhooks:
light.on
- produced when the light changes its state fromoff
toon
light.off
- produced when the light changes its state fromon
tooff
Examples
Light.SetConfig example
- Light.SetConfig HTTP GET Request
- Light.SetConfig Curl Request
- Light.SetConfig Mos Request
http://192.168.33.1/rpc/Light.SetConfig?id=0&config={"name":"Light0"}
curl -X POST -d '{"id":1,"method":"Light.SetConfig","params":{"id":0,"config":{"name":"Light0"}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.SetConfig '{"id":0,"config":{"name":"Light0"}}'
Response
- Light.SetConfig HTTP GET Response
- Light.SetConfig Curl Response
- Light.SetConfig Mos Response
null
{
"id": 1,
"src": "shellypluswdus-30839809eac0",
"params": null
}
null
Light.GetConfig example
- Light.GetConfig HTTP GET Request
- Light.GetConfig Curl Request
- Light.GetConfig Mos Request
http://192.168.33.1/rpc/Light.GetConfig?id=0
curl -X POST -d '{"id":1,"method":"Light.GetConfig","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.GetConfig '{"id":0}'
Response
- Light.GetConfig HTTP GET Response
- Light.GetConfig Curl Response
- Light.GetConfig Mos Response
{
"id": 0,
"name": null,
"initial_state": "restore_last",
"auto_on": true,
"auto_on_delay": 60,
"auto_off": true,
"auto_off_delay": 60,
"transition_duration": 3,
"min_brightness_on_toggle": 3,
"button_presets": {
"button_doublepush": {
"brightness": 100
}
},
"night_mode": {
"enable": true,
"brightness": 50,
"active_between": [
"21:45",
"05:30"
]
}
}
{
"id": 1,
"src": "shellypluswdus-30839809eac0",
"params": {
"id": 0,
"name": null,
"initial_state": "restore_last",
"auto_on": true,
"auto_on_delay": 60,
"auto_off": true,
"auto_off_delay": 60,
"transition_duration": 3,
"min_brightness_on_toggle": 3,
"button_presets": {
"button_doublepush": {
"brightness": 100
}
},
"night_mode": {
"enable": true,
"brightness": 50,
"active_between": [
"21:45",
"05:30"
]
}
}
}
{
"id": 0,
"name": null,
"initial_state": "restore_last",
"auto_on": true,
"auto_on_delay": 60,
"auto_off": true,
"auto_off_delay": 60,
"transition_duration": 3,
"min_brightness_on_toggle": 3,
"button_presets": {
"button_doublepush": {
"brightness": 100
}
},
"night_mode": {
"enable": true,
"brightness": 50,
"active_between": [
"21:45",
"05:30"
]
}
}
Light.GetStatus example
- Light.GetStatus HTTP GET Request
- Light.GetStatus Curl Request
- Light.GetStatus Mos Request
http://192.168.33.1/rpc/Light.GetStatus?id=0
curl -X POST -d '{"id":1,"method":"Light.GetStatus","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.GetStatus '{"id":0}'
Response
- Light.GetStatus HTTP GET Response
- Light.GetStatus Curl Response
- Light.GetStatus Mos Response
{
"id": 0,
"source": "timer",
"output": false,
"brightness": 50,
"timer_started_at": 1626942399.36,
"timer_duration": 60,
"transition": {
"target": {
"output": true,
"brightness": 100
},
"started_at": 1626942399.36,
"duration": 20
}
}
{
"id": 1,
"src": "shellypluswdus-30839809eac0",
"params": {
"id": 0,
"source": "timer",
"output": false,
"brightness": 50,
"timer_started_at": 1626942399.36,
"timer_duration": 60,
"transition": {
"target": {
"output": true,
"brightness": 100
},
"started_at": 1626942399.36,
"duration": 20
}
}
}
{
"id": 0,
"source": "timer",
"output": false,
"brightness": 50,
"timer_started_at": 1626942399.36,
"timer_duration": 60,
"transition": {
"target": {
"output": true,
"brightness": 100
},
"started_at": 1626942399.36,
"duration": 20
}
}
Light.Set example
- Light.Set HTTP GET Request
- Light.Set Curl Request
- Light.Set Mos Request
http://192.168.33.1/rpc/Light.Set?id=0&on=true&brightness=50&transition_duration=20
curl -X POST -d '{"id":1,"method":"Light.Set","params":{"id":0,"on":true,"brightness":50,"transition_duration":20}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.Set '{"id":0,"on":true,"brightness":50,"transition_duration":20}'
Response
- Light.Set HTTP GET Response
- Light.Set Curl Response
- Light.Set Mos Response
null
{
"id": 1,
"src": "shellypluswdus-30839809eac0",
"params": null
}
null
Light.Toggle example
- Light.Toggle HTTP GET Request
- Light.Toggle Curl Request
- Light.Toggle Mos Request
http://192.168.33.1/rpc/Light.Toggle?id=0
curl -X POST -d '{"id":1,"method":"Light.Toggle","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.Toggle '{"id":0}'
Response
- Light.Toggle HTTP GET Response
- Light.Toggle Curl Response
- Light.Toggle Mos Response
null
{
"id": 1,
"src": "shellypluswdus-30839809eac0",
"params": null
}
null
Light.DimUp example
- Light.DimUp HTTP GET Request
- Light.DimUp Curl Request
- Light.DimUp Mos Request
http://192.168.33.1/rpc/Light.DimUp?id=0&fade_rate=3
curl -X POST -d '{"id":1,"method":"Light.DimUp","params":{"id":0,"fade_rate":3}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.DimUp '{"id":0,"fade_rate":3}'
Response
- Light.DimUp HTTP GET Response
- Light.DimUp Curl Response
- Light.DimUp Mos Response
null
{
"id": 1,
"src": "shellypluswdus-30839809eac0",
"params": null
}
null
Light.DimDown example
- Light.DimDown HTTP GET Request
- Light.DimDown Curl Request
- Light.DimDown Mos Request
http://192.168.33.1/rpc/Light.DimDown?id=0&fade_rate=3
curl -X POST -d '{"id":1,"method":"Light.DimDown","params":{"id":0,"fade_rate":3}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.DimDown '{"id":0,"fade_rate":3}'
Response
- Light.DimDown HTTP GET Response
- Light.DimDown Curl Response
- Light.DimDown Mos Response
null
{
"id": 1,
"src": "shellypluswdus-30839809eac0",
"params": null
}
null
Light.DimStop example
- Light.DimStop HTTP GET Request
- Light.DimStop Curl Request
- Light.DimStop Mos Request
http://192.168.33.1/rpc/Light.DimStop?id=0
curl -X POST -d '{"id":1,"method":"Light.DimStop","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.DimStop '{"id":0}'
Response
- Light.DimStop HTTP GET Response
- Light.DimStop Curl Response
- Light.DimStop Mos Response
null
{
"id": 1,
"src": "shellypluswdus-30839809eac0",
"params": null
}
null
Light.SetAll example
- Light.SetAll HTTP GET Request
- Light.SetAll Curl Request
- Light.SetAll Mos Request
http://192.168.33.1/rpc/Light.SetAll?on=true&brightness=50&transition_duration=20
curl -X POST -d '{"id":1,"method":"Light.SetAll","params":{"on":true,"brightness":50,"transition_duration":20}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.SetAll '{"on":true,"brightness":50,"transition_duration":20}'
Response
- Light.SetAll HTTP GET Response
- Light.SetAll Curl Response
- Light.SetAll Mos Response
null
{
"id": 1,
"src": "shellypluswdus-30839809eac0",
"params": null
}
null
Light.Calibrate example
- Light.Calibrate HTTP GET Request
- Light.Calibrate Curl Request
- Light.Calibrate Mos Request
http://192.168.33.1/rpc/Light.Calibrate?id=0
curl -X POST -d '{"id":1,"method":"Light.Calibrate","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.Calibrate '{"id":0}'
Response
- Light.Calibrate HTTP GET Response
- Light.Calibrate Curl Response
- Light.Calibrate Mos Response
null
{
"id": 1,
"src": "shellyprodm1pm-30839809eac0",
"params": null
}
null
Light.ResetCounters example
- Light.ResetCounters HTTP GET Request
- Light.ResetCounters Curl Request
- Light.ResetCounters Mos Request
http://192.168.33.1/rpc/Light.ResetCounters?id=0&type=["aenergy"]
curl -X POST -d '{"id":1,"method":"Light.ResetCounters","params":{"id":0,"type":["aenergy"]}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.ResetCounters '{"id":0,"type":["aenergy"]}'
Response
- Light.ResetCounters HTTP GET Response
- Light.ResetCounters Curl Response
- Light.ResetCounters Mos Response
{
"aenergy": {
"total": 11.679
}
}
{
"id": 1,
"src": "shellyprodm1pm-441793ce3f08",
"params": {
"aenergy": {
"total": 11.679
}
}
}
{
"aenergy": {
"total": 11.679
}
}
HTTP Endpoint example
Example:
curl http://${SHELLY}/light/0?turn=on
Example:
{
"ison": true,
"brightness": 100,
"transition": 10,
"has_timer": true,
"timer_started_at": 258,
"timer_duration": 10,
"timer_remaining": 1.98,
"source": "http"
}