RGB
The RGB component handles an output with possibility to change color and brightness of RGB LED load. Component has additional on/off control. It has night mode capability that can reduce brightness in selected period of time. It uses RGB
as RPC namespace and provides the methods:
RGB.GetConfig
to obtain the component's configurationRGB.SetConfig
to update the component's configurationRGB.GetStatus
to obtain the component's statusRGB.Set
to control the output state, color, transition and brightness levelRGB.Toggle
to toggle the output stateRGB.DimUp
to dim upRGB.DimDown
to dim downRGB.DimStop
to stop dimming
RGB components are identified with rgb:<id>
in objects containing multiple component payloads.
Methods:
RGB.SetConfig
Property | Type | Description |
---|---|---|
| number | Id of the RGB component instance |
| object | Configuration that the method takes |
Find more about the config properties in config section
RGB.GetConfig
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the RGB component instance |
Find the RGB.GetConfig response properties in config section
RGB.GetStatus
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the RGB component instance |
Find more about the status response properties in status section
RGB.Set
This method sets the output, color, transition and brightness level of the RGB 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 RGB component instance. Required |
| boolean | True for output on, false otherwise. Optional |
| number | Brightness level 1%-100% Optional |
| array of type number | Red, Green, Blue [r,g,b] - each value represents level between 0..255 Optional |
| number | Transition time in seconds - time between change from current brightness level and color to desired brightness level and color in request Optional |
| number | 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.
RGB.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 RGB component instance. Required |
RGB.DimUp
This method dims up the brightness level. Dimming stops with RGB.DimStop.
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Id of the RGB component instance. Required |
| number | Fade rate of the brightness level dimming. Range |
RGB.DimDown
This method dims down the brightness level. Dimming stops with RGB.DimStop.
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Id of the RGB component instance. Required |
| number | Fade rate of the brightness level dimming. Range |
RGB.DimStop
This method stops the dimming of the brightness level.
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Id of the RGB component instance. Required |
HTTP Endpoint: /color/id
Through this endpoint a light can be turned on/off with or without a timer, brightness and color 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 | Intensity of the color red, 0..255 |
| number | Intensity of the color green, 0..255 |
| number | Intensity of the color blue, 0..255 |
| 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 | Intensity of the color red, 0..255 |
| number | Intensity of the color green, 0..255 |
| number | Intensity of the color blue, 0..255 |
| 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 RGB component contains information about night mode settings, the timers of the chosen light instance. To Get/Set the configuration of the RGB component its id
must be specified.
Properties:
Property | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Id of the RGB component instance | |||||||||||||||
| string or null | Name of the RGB instance | |||||||||||||||
| string | Mode of the associated input. Range of values: | |||||||||||||||
| 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 or RGB levels | |||||||||||||||
| number | Brightness level (in percent) applied when there is a toggle and current brightness is lower than | |||||||||||||||
| boolean | Enable or disable night mode | |||||||||||||||
| number or null | Brightness level limit (in percent) when night mode is active. | |||||||||||||||
| array of type number or null | Color level when night mode is active. Red, Green, Blue [r,g,b] - each value represents level between 0..255. | |||||||||||||||
| array of type string | 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
| |||||||||||||||
| number | Limit (in Amperes) over which overcurrent condition occurs (shown if applicable). For specific devices applies for color channels, not RGB component | |||||||||||||||
| number | Limit (in Watts) over which overpower condition occurs (shown if applicable) | |||||||||||||||
| number | Limit (in Volts) over which overvoltage condition occurs (shown if applicable) |
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%.follow
andflip
are available fortype
:switch
.activate
available fortype
:switch
andtype
:button
dim
available fortype
:button
Status
The status of the RGB component contains information about the brightness level and output state of the light instance. To obtain the status of the RGB component its id
must be specified.
Properties:
Property | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Id of the RGB component instance | ||||||||||||||||||
| string | Source of the last command, for example: | ||||||||||||||||||
| boolean | True if the output channel is currently on, false otherwise | ||||||||||||||||||
| array of type number | Current Red, Green, Blue [r,g,b] level 0..255 | ||||||||||||||||||
| 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 (shown 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) | ||||||||||||||||||
| array of type string | Error conditions occurred. May contain |
Webhook Events
Currently, there are two events related to the RGB component that can trigger webhooks:
rgb.on
- produced when the output changes its state fromoff
toon
rgb.off
- produced when the output changes its state fromon
tooff
Examples
RGB.SetConfig example
- RGB.SetConfig HTTP GET Request
- RGB.SetConfig Curl Request
- RGB.SetConfig Mos Request
http://192.168.33.1/rpc/RGB.SetConfig?id=0&config={"name":"RGB0"}
curl -X POST -d '{"id":1,"method":"RGB.SetConfig","params":{"id":0,"config":{"name":"RGB0"}}}' http://${SHELLY}/rpc
mos --port ${PORT} call RGB.SetConfig '{"id":0,"config":{"name":"RGB0"}}'
Response
- RGB.SetConfig HTTP GET Response
- RGB.SetConfig Curl Response
- RGB.SetConfig Mos Response
null
{
"id": 1,
"src": "shellyplusrgbwpm-b48a0a123db4",
"params": null
}
null
RGB.GetConfig example
- RGB.GetConfig HTTP GET Request
- RGB.GetConfig Curl Request
- RGB.GetConfig Mos Request
http://192.168.33.1/rpc/RGB.GetConfig?id=0
curl -X POST -d '{"id":1,"method":"RGB.GetConfig","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call RGB.GetConfig '{"id":0}'
Response
- RGB.GetConfig HTTP GET Response
- RGB.GetConfig Curl Response
- RGB.GetConfig Mos Response
{
"id": 0,
"name": null,
"in_mode": "dim",
"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,
"rgb": [
255,
255,
255
]
}
},
"night_mode": {
"enable": true,
"brightness": 50,
"rgb": [
255,
255,
255
],
"active_between": [
"21:45",
"05:30"
]
},
"button_fade_rate": 3
}
{
"id": 1,
"src": "shellyplusrgbwpm-b48a0a123db4",
"params": {
"id": 0,
"name": null,
"in_mode": "dim",
"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,
"rgb": [
255,
255,
255
]
}
},
"night_mode": {
"enable": true,
"brightness": 50,
"rgb": [
255,
255,
255
],
"active_between": [
"21:45",
"05:30"
]
},
"button_fade_rate": 3
}
}
{
"id": 0,
"name": null,
"in_mode": "dim",
"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,
"rgb": [
255,
255,
255
]
}
},
"night_mode": {
"enable": true,
"brightness": 50,
"rgb": [
255,
255,
255
],
"active_between": [
"21:45",
"05:30"
]
},
"button_fade_rate": 3
}
RGB.GetStatus example
- RGB.GetStatus HTTP GET Request
- RGB.GetStatus Curl Request
- RGB.GetStatus Mos Request
http://192.168.33.1/rpc/RGB.GetStatus?id=0
curl -X POST -d '{"id":1,"method":"RGB.GetStatus","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call RGB.GetStatus '{"id":0}'
Response
- RGB.GetStatus HTTP GET Response
- RGB.GetStatus Curl Response
- RGB.GetStatus Mos Response
{
"id": 0,
"source": "timer",
"output": true,
"rgb": [
0,
0,
127
],
"brightness": 50,
"timer_started_at": 1626942399.36,
"timer_duration": 60,
"transition": {
"target": {
"output": true,
"brightness": 50,
"rgb": [
20,
30,
40
]
},
"started_at": 1626942399.36,
"duration": 20
},
"temperature": {
"tC": 53.1,
"tF": 127.6
},
"aenergy": {
"total": 0.55
},
"apower": 2,
"current": 0.165,
"voltage": 12.1
}
{
"id": 1,
"src": "shellyplusrgbwpm-b48a0a123db4",
"params": {
"id": 0,
"source": "timer",
"output": true,
"rgb": [
0,
0,
127
],
"brightness": 50,
"timer_started_at": 1626942399.36,
"timer_duration": 60,
"transition": {
"target": {
"output": true,
"brightness": 50,
"rgb": [
20,
30,
40
]
},
"started_at": 1626942399.36,
"duration": 20
},
"temperature": {
"tC": 53.1,
"tF": 127.6
},
"aenergy": {
"total": 0.55
},
"apower": 2,
"current": 0.165,
"voltage": 12.1
}
}
{
"id": 0,
"source": "timer",
"output": true,
"rgb": [
0,
0,
127
],
"brightness": 50,
"timer_started_at": 1626942399.36,
"timer_duration": 60,
"transition": {
"target": {
"output": true,
"brightness": 50,
"rgb": [
20,
30,
40
]
},
"started_at": 1626942399.36,
"duration": 20
},
"temperature": {
"tC": 53.1,
"tF": 127.6
},
"aenergy": {
"total": 0.55
},
"apower": 2,
"current": 0.165,
"voltage": 12.1
}
RGB.Set example
- RGB.Set HTTP GET Request
- RGB.Set Curl Request
- RGB.Set Mos Request
http://192.168.33.1/rpc/RGB.Set?id=0&on=true&brightness=50&rgb=[20,30,40]&transition_duration=20
curl -X POST -d '{"id":1,"method":"RGB.Set","params":{"id":0,"on":true,"brightness":50,"rgb":[20,30,40],"transition_duration":20}}' http://${SHELLY}/rpc
mos --port ${PORT} call RGB.Set '{"id":0,"on":true,"brightness":50,"rgb":[20,30,40],"transition_duration":20}'
Response
- RGB.Set HTTP GET Response
- RGB.Set Curl Response
- RGB.Set Mos Response
null
{
"id": 1,
"src": "shellyplusrgbwpm-b48a0a123db4",
"params": null
}
null
RGB.Toggle example
- RGB.Toggle HTTP GET Request
- RGB.Toggle Curl Request
- RGB.Toggle Mos Request
http://192.168.33.1/rpc/RGB.Toggle?id=0
curl -X POST -d '{"id":1,"method":"RGB.Toggle","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call RGB.Toggle '{"id":0}'
Response
- RGB.Toggle HTTP GET Response
- RGB.Toggle Curl Response
- RGB.Toggle Mos Response
null
{
"id": 1,
"src": "shellyplusrgbwpm-b48a0a123db4",
"params": null
}
null
RGB.DimUp example
- RGB.DimUp HTTP GET Request
- RGB.DimUp Curl Request
- RGB.DimUp Mos Request
http://192.168.33.1/rpc/RGB.DimUp?id=0&fade_rate=3
curl -X POST -d '{"id":1,"method":"RGB.DimUp","params":{"id":0,"fade_rate":3}}' http://${SHELLY}/rpc
mos --port ${PORT} call RGB.DimUp '{"id":0,"fade_rate":3}'
Response
- RGB.DimUp HTTP GET Response
- RGB.DimUp Curl Response
- RGB.DimUp Mos Response
null
{
"id": 1,
"src": "shellyplusrgbwpm-b48a0a123db4",
"params": null
}
null
RGB.DimDown example
- RGB.DimDown HTTP GET Request
- RGB.DimDown Curl Request
- RGB.DimDown Mos Request
http://192.168.33.1/rpc/RGB.DimDown?id=0&fade_rate=3
curl -X POST -d '{"id":1,"method":"RGB.DimDown","params":{"id":0,"fade_rate":3}}' http://${SHELLY}/rpc
mos --port ${PORT} call RGB.DimDown '{"id":0,"fade_rate":3}'
Response
- RGB.DimDown HTTP GET Response
- RGB.DimDown Curl Response
- RGB.DimDown Mos Response
null
{
"id": 1,
"src": "shellyplusrgbwpm-b48a0a123db4",
"params": null
}
null
RGB.DimStop example
- RGB.DimStop HTTP GET Request
- RGB.DimStop Curl Request
- RGB.DimStop Mos Request
http://192.168.33.1/rpc/RGB.DimStop?id=0
curl -X POST -d '{"id":1,"method":"RGB.DimStop","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call RGB.DimStop '{"id":0}'
Response
- RGB.DimStop HTTP GET Response
- RGB.DimStop Curl Response
- RGB.DimStop Mos Response
null
{
"id": 1,
"src": "shellyplusrgbwpm-b48a0a123db4",
"params": null
}
null
HTTP Endpoint example
Example:
curl http://${SHELLY}/color/0?turn=on
Example:
{
"ison": true,
"brightness": 100,
"red": 127,
"green": 0,
"blue": 0,
"transition": 10,
"has_timer": true,
"timer_started_at": 258,
"timer_duration": 10,
"timer_remaining": 1.98,
"source": "http"
}