Welcome to lifx-sdk’s documentation!

Getting Started

Controlling the lights with this SDK has been designed to be as easy as possible. The SDK handles discovering bulbs and assessing their reachability.

The main entrypoint to the SDK is the lifx.client.Client class. It is responsible for the discovery, reachability and querying the light bulbs. It returns lifx.device.Device objects which represent individual lights. These two classes will make up the bulk of interactions with the SDK.

A simple workflow for accessing a light is as follows:

  1. Create a lifx.client.Client class.
  2. Wait for discovery to complete
  3. Select relevent bulbs.
  4. Perform an action on the bulbs.

This is demonstrated in the following code:

import lifx
import time

# Create the client and start discovery
lights = lifx.Client()

# Wait for discovery to complete
time.sleep(1)

# Turn all bulbs off
for l in lights.get_devices():
    print 'Turning off %s' % l.label
    l.power = False

Indices and tables