I know a bunch of HomeKit enthusiasts that use Homebridge even with LIFX’s native HomeKit support in their newer bulbs. After the LIFX team implemented firmware effect calls in the HTTP API, I knew it would be possible to create a HomeKit switch that would turn an effect on and off and here it is.

Requirements

  1. Have a working Homebridge system connected to HomeKit.
  2. Install the homebridge-http-switch plugin.
  3. Get a LIFX Cloud Personal Access API token from https://cloud.lifx.com/settings.

Before you begin

  1. Replace :selector in the configuration with the actual selector of the multizone bulb(s) you want to target with each switch. Creative use of selectors can target multiple bulbs in a single switch.
  2. Replace <api_token> with your Personal Access Token API

If you want to trigger the Flame effect (LIFX Tile/Candle only):

  1. Change morph to flame for each url string.
  2. Change MORPH to FLAME in the statusPattern string.

If you want to trigger the Move effect (LIFX Z and Beam only):

  1. Change morph to move for each url string.
  2. Change MORPH to MOVE in the statusPattern string.

Known Issues

  1. This uses the LIFX HTTP API and as such requires an active Internet connection as well as LIFX bulbs that are connected to the LIFX Cloud.
  2. Status is checked every second so there may be a noticeable delay in certain cases with the status not reflecting reality (particluarly when the effect is started or stopped externally from HomeKit).
  3. If your linear multizone bulb (i.e. Z or Beam) is a single colour, you may not notice the Move effect at all. There’s no simple solution to this yet, unfortunately.

Configuration

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
  "accessory": "HTTP-SWITCH",
  "name": "Tile Morph Switch",

  "switchType": "stateful",

  "onUrl": {
    "url": "https://api.lifx.com/v1/lights/:selector/effects/morph",
    "method": "POST",
    "strictSSL": true,
    "body": "{\"power_on\": true}",
    "headers": {
      "Authorization": "Bearer <api_token>",
      "Content-Type": "application/json"
    }

  },

  "offUrl": {
    "url": "https://api.lifx.com/v1/lights/:selector/effects/off",
    "method": "POST",
    "strictSSL": true,
    "body": "{\"power_off\": true}",
    "headers": {
      "Authorization": "Bearer <api_token>",
      "Content-Type": "application/json"
    }
  },
  "statusUrl": {
    "url": "https://api.lifx.com/v1/lights/:selector",
    "method": "GET",
    "strictSSL": true,
    "headers": {
      "Authorization": "Bearer <api_token>"
    }


  },
  "statusPattern": "\"effect\": \"MORPH\"",
  "debug": true

}

Enjoy!