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 state
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 | Optional flip-back timer in seconds. Optional |
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 |
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, 0..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, 0..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, default brightness level 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 | 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 | Brightness level (in percent) after power on |
| number | Brightness level (in percent) applied when there is a toggle and current brightness is 0. |
| boolean | Enable or disable night mode |
| number | Brightness level limit when night mode is active |
| 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 |
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) |
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,
"default": {
"brightness": 100
},
"min_brightness_on_toggle": 3,
"night_mode": {
"enable": true,
"brightness": 15,
"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,
"default": {
"brightness": 100
},
"min_brightness_on_toggle": 3,
"night_mode": {
"enable": true,
"brightness": 15,
"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,
"default": {
"brightness": 100
},
"min_brightness_on_toggle": 3,
"night_mode": {
"enable": true,
"brightness": 15,
"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
}
{
"id": 1,
"src": "shellypluswdus-30839809eac0",
"params": {
"id": 0,
"source": "timer",
"output": false,
"brightness": 50,
"timer_started_at": 1626942399.36,
"timer_duration": 60
}
}
{
"id": 0,
"source": "timer",
"output": false,
"brightness": 50,
"timer_started_at": 1626942399.36,
"timer_duration": 60
}
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
curl -X POST -d '{"id":1,"method":"Light.Set","params":{"id":0,"on":true,"brightness":50}}' http://${SHELLY}/rpc
mos --port ${PORT} call Light.Set '{"id":0,"on":true,"brightness":50}'
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
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"
}