Script Pulsing Lights

Hey Guys,

I’m very new to this and not very good at scripting, though I was wanting to be able to pulse my lights between colours, eg green and red for Christmas.

Can you do this via a python script or http api call? If so, any chance someone could help me out, maybe post an example I can work off. I have 19 lights I want to play around with, :slight_smile:



Try this:

import requests

# Get token from:

headers = {
    "Authorization": "Bearer %s" % token,

data = {
    "period": 5,
    "cycles": 5,
    "color": "green",
    "from_color": "red",

response ='', data=data, headers=headers)

The is will breathe all your lights red and green, 5 times, with each cycle taking 5 seconds. Play with the values in here to get different results. I based this off the documentation for the breathe http api call.

Wow, thanks Daniel!

Now forgive the n00b question, but when I try and run it I get the below error;

Traceback (most recent call last):
File “C:\Users\Dave\Desktop\Lifx”, line 2, in
import requests
ModuleNotFoundError: No module named ‘requests’

Never mind, I did pip install requests and it’s working!!! Thanks heaps!

Actually, one question, how do you make it set 100% brightness also?

The brightness is defined as part of the color, there is a page in the api docs where we document the different options.

So just change the colors to be red brightness:1 and green brightness:1.

Legend !!! Thanks mate.

Hey Daniel,

Do you know of a way to schedule this API call, either via Lifx App, Google Home or iOS? Wanting it to run at like 6pm on certain days.