Changing a device
The LIFX protocol supports Set
messages which are used to change metadata or the visual appearance of a device. These messages also return State
messages like the Get
messages do when you specify res_required=1
.
Note however that if your Set
messages changes the visual appearance of the light it is likely you'll get the state of the device before your change.
Device
SetPower - Packet 21
This packet lets you set the current level of power on the device.
Will return one StatePower (22) message
level : Uint16If you specify 0 the light will turn off and if you specify 65535 the device will turn on. |
SetLabel - Packet 24
This packet lets you set the label
on the device. The label is a string you assign to the device and will be displayed as the name of the device in the LIFX mobile apps.
Will return one StateLabel (25) message
label : 32 bytes StringThe string you want to assign. |
SetReboot - Packet 38
This packet will instruct the device to perform a reboot similar to if it had been power cycled.
SetLocation - Packet 49
This packet lets you set the location
information on the device.
Will return one StateLocation (50) message
SetGroup - Packet 52
This packet lets you set the group
information on the device.
Will return one StateGroup (53) message
Light
SetColor - Packet 102
This packet lets you set the HSBK value for the light. For devices that have multiple zones, this will set all Zones on the device to this color.
Will return one LightState (107) message
SetWaveform - Packet 103
This packet lets you set the HSBK and Waveforms value for the light. For devices that have multiple zones, this will treat all the zones on the device as one.
Will return one LightState (107) message
SetLightPower - Packet 117
This is the same as SetPower (21) but allows you to specify how long it will take to transition to the new power state.
Will return one StateLightPower (118) message
SetWaveformOptional - Packet 119
This behaves like SetWaveform (103) but allows you to keep certain parts of the original HSBK values during the transition.
Will return one LightState (107) message
reserved6 : 1 Reserved bytes |
transient : BoolIntSee Waveforms |
hue : Uint16 |
saturation : Uint16 |
brightness : Uint16 |
kelvin : Uint16 |
period : Uint32See Waveforms |
cycles : FloatSee Waveforms |
skew_ratio : Int16See Waveforms |
waveform : Uint8 using Waveform EnumSee Waveforms |
set_hue : BoolIntUse the hue value in this message |
set_saturation : BoolIntUse the saturation value in this message |
set_brightness : BoolIntUse the brightness value in this message |
set_kelvin : BoolIntUse the kelvin value in this message |
SetInfrared - Packet 122
This packet lets you change the current infrared value on the device
Will return one StateInfrared (121) message
This packet requires the device has the infrared
capability. You may use GetVersion (32), GetHostFirmware (14) and the Product Registry to determine whether your device has this capability
brightness : Uint16The amount of infrared emitted by the device. 0 is no infrared and 65535 is the most infrared. |
SetHevCycle - Packet 143
This packet lets you start or stop a HEV cycle on the device.
Will return one StateHevCycle (144) message
This packet requires the device has the hev
capability. You may use GetVersion (32), GetHostFirmware (14) and the Product Registry to determine whether your device has this capability
enable : BoolIntSet this to false to turn off the cycle and true to start the cycle |
duration_s : Uint32The duration, in seconds that the cycle should last for. A value of 0 will use the default duration set by SetHevCycleConfiguration (146). |
SetHevCycleConfiguration - Packet 146
This packet lets you set default values for a HEV cycle on the device
Will return one StateHevCycleConfiguration (147) message
This packet requires the device has the hev
capability. You may use GetVersion (32), GetHostFirmware (14) and the Product Registry to determine whether your device has this capability
indication : BoolIntSet this to true to run a short flashing indication at the end of the HEV cycle |
duration_s : Uint32This is the default duration that is used when SetHevCycle (143) is given 0 for duration_s. |
MultiZone
SetColorZones - Packet 501
Set a segment of your strip to a HSBK value. If your devices supports extended multizone messages it is recommended you use those messages instead.
Will return one StateMultiZone (506) message
This packet requires the device has the Linear Zones
capability. You may use GetVersion (32), GetHostFirmware (14) and the Product Registry to determine whether your device has this capability
start_index : Uint8The first zone in the segment we are changing. |
end_index : Uint8The last zone in the segment we are changing |
hue : Uint16 |
saturation : Uint16 |
brightness : Uint16 |
kelvin : Uint16 |
duration : Uint32The amount of time it takes to transition to the new values in milliseconds. |
apply : Uint8 using MultiZoneApplicationRequest Enum |
SetMultiZoneEffect - Packet 508
Start a multizone Firmware Effect on the device.
Will return one StateMultiZoneEffect (509) message
This packet requires the device has the Linear Zones
capability. You may use GetVersion (32), GetHostFirmware (14) and the Product Registry to determine whether your device has this capability
instanceid : Uint32A unique number identifying this effect. |
type : Uint8 using MultiZoneEffectType Enum |
reserved6 : 2 Reserved bytes |
speed : Uint32The time it takes for one cycle of the effect in milliseconds. |
duration : Uint64The time the effect will run for in nanoseconds. |
reserved7 : 4 Reserved bytes |
reserved8 : 4 Reserved bytes |
parameters : 32 BytesThis field is 8 4 byte fields which change meaning based on the effect that is running. When the effect is MOVE only the second field is used and is a Uint32 representing the DIRECTION enum. This field is currently ignored for all other multizone effects. |
SetExtendedColorZones - Packet 510
This message lets you change the HSBK values for all zones on the strip in one message.
Will return one StateExtendedColorZones (512) message
This packet requires the device has the Extended Linear Zones
capability. You may use GetVersion (32), GetHostFirmware (14) and the Product Registry to determine whether your device has this capability
duration : Uint32The time it takes to transition to the new values in milliseconds. |
apply : Uint8 using MultiZoneExtendedApplicationRequest EnumWhether to make this change now |
zone_index : Uint16The first zone to apply colors from. If the light has more than 82 zones, then send multiple messages with different indices to update the whole device. |
colors_count : Uint8The number of colors in the colors field to apply to the strip |
colors : 82 Color structuresThe HSBK values to change the strip with. |
Relay
SetRPower - Packet 817
Set the power state of a relay on a switch device. Current models of the LIFX switch do not have dimming capability, so the two valid values are 0
for off
and 65535
for on
.
Will return one StateRPower (818) message
This packet requires the device has the Relays
capability. You may use GetVersion (32), GetHostFirmware (14) and the Product Registry to determine whether your device has this capability
Tile
SetUserPosition - Packet 703
Allows you to specify the position of this device in the chain relative to other device in the chain.
You can find more information about this data by looking at Tile Positions.
This message has no response packet even if you set res_required=1
.
This packet requires the device has the Matrix Zones
capability. You may use GetVersion (32), GetHostFirmware (14) and the Product Registry to determine whether your device has this capability
Set64 - Packet 715
This lets you set up to 64
HSBK values on the device.
This message has no response packet even if you set res_required=1
.
This packet requires the device has the Matrix Zones
capability. You may use GetVersion (32), GetHostFirmware (14) and the Product Registry to determine whether your device has this capability
tile_index : Uint8The device to change. This is 0 indexed and starts from the device closest to the controller. |
length : Uint8The number of devices in the chain to change starting from tile_index |
reserved6 : 1 Reserved bytes |
x : Uint8The x co-ordinate to start applying colors from. You likely want this to be 0 . |
y : Uint8The y co-ordinate to start applying colors from. You likely want this to be 0 . |
width : Uint8The width of the square you're applying colors to. This should be 8 for the LIFX Tile and 5 for the LIFX Candle. |
duration : Uint32The time it will take to transition to new state in milliseconds. |
colors : 64 Color structuresThe HSBK values to assign to each zone specified by this packet. |
SetTileEffect - Packet 719
This packet will let you start a Firmware Effect on the device.
Will return one StateTileEffect (720) message
This packet requires the device has the Matrix Zones
capability. You may use GetVersion (32), GetHostFirmware (14) and the Product Registry to determine whether your device has this capability
Note: The Sky effect is only supported on LIFX Ceiling, running firmware 4.4 or higher
reserved0 : 1 Reserved bytes |
reserved1 : 1 Reserved bytes |
instanceid : Uint32A unique number identifying this effect. |
type : Uint8 using TileEffectType Enum |
speed : Uint32The time it takes for one cycle of the effect in milliseconds. |
duration : Uint64The time the effect will run for in nanoseconds. |
reserved2 : 4 Reserved bytes |
reserved3 : 4 Reserved bytes |
skyType : TileEffectSkyType only used on SKY effect |
reserved4 : 3 Reserved bytes |
cloudSaturationMin 1 Bytes only used on SKY effect when using CLOUDS (recommended default is 50) |
reserved5 : 3 Reserved bytes |
reserved6 : 24 Reserved bytesThis field is currently ignored by all firmware effects. |
palette_count : Uint8The number of values in palette that you want to use. |
palette : 16 Color structuresThe HSBK values to be used by the effect. On the MORPH effect this is used as the palette for generating the effect. With the SKY effect, the indices specified in TileEffectSkyPalette dictate how each color will be used. |
Updated 4 months ago