In my previous post, I provided one method of starting and stopping firmware effects using Photons Interactor. Since that post was written, delfick has added native support for effects (with theme support), so this is a quick post to demonstrate how to use these new commands.

The three new commands that have been added in Photons Interactor 0.6.3 are:

  • effects/run
  • effects/stop
  • effects/status

If you’re using the Docker image, you should run docker pull delfick/photons-interactor to get the latest version that includes this new functionality.

Before I provide some examples of how to use these new toys, here’s a quick reminder of the three currently available firmware effects:

  • MOVE: a linear movement animation that is only available for LIFX Z and Beam
  • MORPH: a perlin noise animation that assigns pixel values using a 16-color palette, only available for the LIFX Tile and Candle
  • FLAME: a flame animation only available for the LIFX Tile and Candle

There is a fourth effect called OFF available for all multizone devices that stops any other running effect. All the other effects you see in the LIFX smart phone app, like “Animate” and “Colour Cycle” are generated by the app and are not built into the devices.

Starting the Morph or Flame effects

Let’s start with the simplest use-case: starting either the Morph or Flame effect on all your Tile. The JSON for this is pretty straightforward:

1
2
3
4
5
6
7
8
9
{
    "command": "effects/run",
    "args": {
        "matcher": {
            "product_identifier": "lifx_tile"
        },
        "matrix_animation": "MORPH"
    }
}

You can replace MORPH with FLAME to start the Flame effect instead.

Starting an effect with a custom palette

The example above started the Morph effect using the default colour palette. You could provide your own set of colours to use as a theme for the effect as well, using either a list of colours or specific HSBK values, or even a combination of both:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{
    "command": "effects/run",
    "args": {
        "matcher": {
            "product_identifier": "lifx_tile"
        },
        "matrix_animation": "MORPH",
        "matrix_options": {
            "palette": [
                "red",
                {"hue": 60, "saturation": 1, "brightness": 1, "kelvin": 3500},
                {"hue": 120, "saturation": 1, "brightness": 1, "kelvin": 3500},
                {"hue": 180, "saturation": 1, "brightness": 1, "kelvin": 3500},
                "purple"
            ]
        }
    }
}

Note: there is a limit of 16 colours in a Morph palette. If you specify more than 16 colours, Photons will throw an error.

Starting a Move effect with a custom theme

The linear devices (Z and Beam) need to have a theme applied before the Move effect, which has a slightly different format:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
    "command": "effects/run",
    "args": {
        "matcher": {
            "product_identifier": "lifx_beam"
        },
        "apply_theme": true,
        "theme_options": {
            "colors": [
                "red",
                "green",
                "blue"
            ],
            "theme": "SPLOTCH"
        },
        "linear_animation": "MOVE",
        "liner_options": {
          "speed": 5
        }

    }
}

This is a far more complex example and there are a lot of things you can customise. For example, the SPLOTCH theme painter will throw the colours onto your device semi-randomly, while the HORIZONTAL_STRIPE painter will give each colour an equal amount of zones.

Stopping an effect

Stopping an effect is even easier than starting one:

1
2
3
{
    "command": "effects/stop"
}

That will target all devices on your network and stop any currently running effects. Obviously you can add a matcher argument to limit this to specific devices.

Useful things to know

The effects/status command will list the currently running effect or OFF for all multizone devices. If a device doesn’t support any firmware effects, the value will be SKIP.

As always, this is only an example of some of the possibilities. I strongly encourage you to experiment and if you discover anything nifty, please let me know!