Skip to main content

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 components are identified with light:<id> in objects containing multiple component payloads.

Methods:

Light.SetConfig

PropertyTypeDescription

id

number

Id of the Light component instance

config

object

Configuration that the method takes

Find more about the config properties in config section

Light.GetConfig

Properties:

PropertyTypeDescription

id

number

Id of the Light component instance

Find the Light.GetConfig response properties in config section

Light.GetStatus

Properties:

PropertyTypeDescription

id

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:

PropertyTypeDescription

id

number

Id of the Light component instance. Required

on

boolean

True for light on, false otherwise. Optional

brightness

Brightness level Optional

toggle_after

number

Optional flip-back timer in seconds. Optional

info

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:

PropertyTypeDescription

id

number

Id of the Light component instance. Required

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:

PropertyTypeDescription

id

number

Id of the Light component instance

name

string or null

Name of the light instance

initial_state

string

Output state to set on power_on. Range of values: off, on, restore_last, match_input

auto_on

boolean

True if the "Automatic ON" function is enabled, false otherwise

auto_on_delay

number

Seconds to pass until the component is switched back on

auto_off

boolean

True if the "Automatic OFF" function is enabled, false otherwise

auto_off_delay

number

Seconds to pass until the component is switched back off

default.brightness

number

Brightness level (in percent) after power on

night_mode.enable

boolean

Enable or disable night mode

night_mode.brightness

number

Brightness level limit when night mode is active

night_mode.active_between

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:

PropertyTypeDescription

id

number

Id of the Light component instance

source

string

Source of the last command, for example: init, WS_in, http, ...

output

boolean

True if the output channel is currently on, false otherwise

brightness

number

Current brightness level (in percent)

timer_started_at

number

Unix timestamp, start time of the timer (in UTC) (shown if the timer is triggered)

timer_duration

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 from off to on
  • light.off - produced when the light changes its state from on to off

Examples

Light.SetConfig example

http://192.168.33.1/rpc/Light.SetConfig?id=0&config={"name":"Light0"}

Response

null

Light.GetConfig example

http://192.168.33.1/rpc/Light.GetConfig?id=0

Response

{
"id": 0,
"name": null,
"initial_state": "match_input",
"auto_on": true,
"auto_on_delay": 60,
"auto_off": true,
"auto_off_delay": 60,
"default": {
"brightness": 100
},
"night_mode": {
"enable": true,
"brightness": 15,
"active_between": [
"21:45",
"05:30"
]
}
}

Light.GetStatus example

http://192.168.33.1/rpc/Light.GetStatus?id=0

Response

{
"id": 0,
"source": "timer",
"output": false,
"brightness": 50,
"timer_started_at": 1626942399.36,
"timer_duration": 60
}

Light.Set example

http://192.168.33.1/rpc/Light.Set?id=0&on=true&brightness=50

Response

null

Light.Toggle example

http://192.168.33.1/rpc/Light.Toggle?id=0

Response

null