Skip to content
Jenna edited this page Apr 23, 2017 · 3 revisions

The config file format is annoyingly difficult. Here are the specifications for writing it and some examples:

Specification

Config files can have three types of sections:

  • Button
  • Action
  • State

Each section should have its title prefixed with BUTTON, ACTION, or STATE so I can determine what you're defining. To get your button addresses (needed for defining buttons), run the client in config mode with ./start.sh -c. Running in config mode will also print out light data from your account such as scene IDs, light info, group info, etc.

Actions

An action defines a type of action that is applied to a group of lights. An action should at a minimum have a type. Certain types require more information. See action types below:

Set state

  • Must have a selector
  • Must reference a State section

Set states

  • Must reference two or more State sections
  • Can optionally define a default state to apply to all listed states. Any settings defined in the default state will override any of the same settings in the listed states.

Toggle

  • Must have selector
  • May optionally have duration specified for which the power on/off will be applied over. Duration is in seconds.

Breathe

  • Must have selector
  • TODO .. coming soon

Pulse

  • Must have selector
  • TODO .. coming soon

Cycle

  • Must have selector
  • TODO .. coming soon

Activate scene

  • Must reference a scene ID
  • May optionally have a duration specified for which the scene will be applied over. Duration is in seconds.

Selectors

Please see https://api.developer.lifx.com/docs/selectors for selectors you can use.
E.g.

  • all
  • label:[value]

States

States have five attributes:

  • selector : [selector string]
  • power : [on/off]
  • color : [string specifying color] (please see https://api.developer.lifx.com/docs/colors for color string formats)
  • brightness : [0.0 - 1.0]
  • duration : [0.0 - 3155760000.0] (how long in seconds you want the power action to take)

Buttons

Each button section should have 3 keys - one for each click type

  • SingleClick
  • DoubleClick
  • Hold

Each click type should reference one action which are also defined in the config file. TODO: support for multiple actions.

You don't need to define actions for any or all buttons and click types. You can define just what you need.

Examples

Below I give example sections for the config file.

[BUTTON 80:e4:da:71:e0:48]
SingleClick: Toggle Main Bedroom Lights Fast
DoubleClick: Activate Scene Slow
Hold: Set States

[ACTION Toggle Main Bedroom Lights Slow]
Toggle: group:Jenna's Room
Duration: 5.0

[ACTION Toggle Main Bedroom Lights Fast]
Toggle: group:Jenna's Room

[ACTION Activate Scene]
Activate Scene: b93f98d6-d175-419a-befa-f8d8c3ed0c5a

[ACTION Activate Scene Slow]
Activate Scene: b93f98d6-d175-419a-befa-f8d8c3ed0c5a
Duration: 5.0

[ACTION Set My Cool State]
Set state: My Cool State
Selector: group:Jenna's Room

[ACTION Set States]
Set states: My Cool State Red, My Cool State Green
Default: My Cool State

[STATE My Cool State]
power: on
color: red
brightness: 1.0
duration: 5.0

[STATE My Cool State Red]
power: on
color: red
brightness: 1.0
duration: 1.0
selector: id:d073d512c4cc

[STATE My Cool State Green]
power: on
color: green
brightness: 1.0
selector: id:d073d512c6d4

[BUTTON 80:e4:da:71:e0:93]
SingleClick:Turn On Lounge Single
DoubleClick: Turn On Lounge Double
Hold: Turn On Lounge Hold

[ACTION Turn On Lounge Single]
Set state: My Cool Single State
Selector: Group:Main Bedroom

[ACTION Turn On Lounge Double]
Set state: My Cool Hold State
Selector: Group:Main Bedroom

[ACTION Turn On Lounge Hold]
Set state: My Cool Double State
Selector: Group:Main Bedroom

Clone this wiki locally