API

adafruit_lifx

A CircuitPython/Python library for communicating with the LIFX HTTP Remote API.

  • Author(s): Brent Rubell for Adafruit Industries

Implementation Notes

Software and Dependencies:

or:

class adafruit_lifx.LIFX(wifi_manager: HTTPProtocol, lifx_token: str)

HTTP Interface for interacting with the LIFX API

Parameters:
effects_off(selector: str, power_off: bool = False) str

Turns off any running effects on the selected device.

Parameters:
  • selector (str) – Selector to control which lights are requested.

  • power_off (bool) – If true, the devices will also be turned off.

list_lights() Dict[str, Any]

Enumerates all the lights associated with the LIFX Cloud Account

move_effect(selector: str, move_direction: str, period: float, power_on: bool) str

Performs a linear move effect on a light, or lights.

Parameters:
  • selector (str) – Selector to control which lights are requested.

  • move_direction (str) – Move direction, forward or backward.

  • period (float) – Time in second per effect cycle.

  • power_on (bool) – Turn on a light before performing the move.

set_brightness(selector: str, brightness: float) str

Sets the state of the lights within the selector.

Parameters:
  • selector (str) – Selector to control which lights are requested.

  • brightness (float) – Brightness level of the light, from 0.0 to 1.0.

set_color(selector: str, **kwargs) str

Sets the state of the light’s color within the selector. Valid keyword arguments: https://api.developer.lifx.com/docs/set-state

Parameters:

selector (str) – Selector to control which lights are requested.

toggle_light(selector: str, all_lights: bool = False, duration: float = 0) str

Toggles current state of LIFX light(s).

Parameters:
  • selector (str) – Selector to control which lights are requested.

  • all (bool) – Toggle all lights at once. Defaults to false.

  • duration (float) – Time (in seconds) to spend performing a toggle. Defaults to 0.