Skip to content

Latest commit

 

History

History
133 lines (95 loc) · 4.08 KB

light.md

File metadata and controls

133 lines (95 loc) · 4.08 KB

LIFX Developer Home | LAN Protocol. LiFi Labs, Inc. © 2015. All rights reserved. Usage of this documentation is bound by the [LIFX Developer Terms] (http://developer.lifx.com/terms.html).

Light message types

Index

Overview

Light messages control and acquire the state of a specific type of device, such as a lightbulb. The state is comprised of the label, power level and color.

There are a duplicate set of device power related messages, Device::GetPower, Device::StatePower and Device::SetPower, which are extended for lights by adding a duration field to Light::SetPower.

The Protocol header message type field value (decimal) appears after each message name in this document. Each section below describes the payload that is appended to the message header. Some messages do not require a payload.

Message field data types

HSBK

HSBK is used to represent the color and color temperature of a light.

The color is represented as an HSB (Hue, Saturation, Brightness) value.

The color temperature is represented in K (Kelvin) and is used to adjust the warmness / coolness of a white light, which is most obvious when saturation is close zero.

  • Hue: range 0 to 65535
  • Saturation: range 0 to 65535
  • Brightness: range 0 to 65535
  • Kelvin: range 2500° (warm) to 9000° (cool)
Field Type
hue unsigned 16-bit integer
saturation unsigned 16-bit integer
brightness unsigned 16-bit integer
kelvin unsigned 16-bit integer

For user interface purposes, the hue is typically scaled to between 0° and 360°. Saturation and brightness are typically scaled to between 0% and 100%.

Light messages

Get - 101

Sent by a client to obtain the light state. No payload required. Causes the device to transmit a State message.

SetColor - 102

Sent by a client to change the light state.

Field Type
reserved unsigned 8-bit integer
color HSBK
duration unsigned 32-bit integer

The duration is the color transition time in milliseconds.

If the Frame Address res_required field is set to one (1) then the device will transmit a State message.

State - 107

Sent by a device to provide the current light state.

Field Type
color HSBK
reserved signed 16-bit integer
power unsigned 16-bit integer
label string, size: 32 bytes
reserved unsigned 64-bit integer

See color, label and power level.

GetPower - 116

Sent by a client to obtain the power level. No payload required. Causes the device to transmit a StatePower message.

SetPower - 117

Sent by a client to change the light power level.

Field Type
level unsigned 16-bit integer
duration unsigned 32-bit integer

The power level must be either 0 or 65535.

The duration is the power level transition time in milliseconds.

If the Frame Address res_required field is set to one (1) then the device will transmit a StatePower message.

StatePower - 118

Sent by a device to provide the current power level.

Field Type
level unsigned 16-bit integer