Create an on-air indicator with LIFX and Microsoft Power Automate

Never let a good crisis go to waste

Featured image

With COVID-19 forcing us all to adjust to remote working, it can be difficult to avoid constant interruptions. When everyone is at home and the kids are being home schooled, it can be near impossible to get some quality focus time. There’s also the ever looming risk of spontaneous embarrassment when your partner draws the attention of everyone on that important video call.

The best tool in your arsenal to combat this problem is to set clear expectations and boundaries with those that occupy your home. It’ll require discussion and commitment from all involved, but if you can, try and work out a system that let’s you get some “Do Not Disturb” time where you can focus or attend a meeting.

A few suggestions are:

For me, I take advantage of the MyAnalytics Focus Plan feature of Microsoft365. It automatically blocks out a few hours each day in my calendar with an event called “Focus Time”.

Here’s the system I created in my home using LIFX smart lights, and Microsoft Power Automate (a. k. a Microsoft Flow).

How it works

The setup is pretty simple. It consists three main components.

  1. The hardware (lights)
  2. The LIFX API
  3. Microsoft Power Automate

All I am doing is using Microsoft Power Automate to look at my Outlook calendar, and hit the API to control my lights whenever I have an event scheduled.


My “on-air” indicator will have three coloured states:

  1. Green: it’s okay to come in and interrupt
  2. Red: in a meeting - do not disturb.
  3. Blue: trying to focus. It’s okay to interrupt, but please try to avoid it.


The first thing you’re going to need is a light to control. You can pick any brand of smart light that tickles your pickle, but for this post I’ll be demonstrating LIFX.

In my home, just outside the door to my office I have a LIFX down light which I’ll be configuring as my on-air indicator.

If you don’t want the hassle of switching out light bulbs, you can pick yourself up a LIFX Z LED Strip and throw together a pretty sweet alternative.

Door frame LEDs


Create a personal access token

In order to control the lights programmatically via the API, we first need to create a Personal Access Token (PAT). The PAT is used to authenticate against the API and grant access to all of your cloud synched lights.

Once the token has been generated, make sure to copy it somewhere as this will be the only time it is displayed. If you lose it, you’ll need to generate a new one.

Your Personal Access Token is a secret and should be kept private. Anyone with this token can control your lights!

Test the API

To confirm that we have everything we need, lets just do a simple test and list all the available lights. After taking a look at the API documentation, I find that the endpoint needed looks like this.

When exploring new APIs, I like to do that visually with Postman (as opposed to using curl or python ) as it allows me to alter parameters and try new things quickly.

  1. Set the request method to GET
  2. Enter the API endpoint ( )
  3. Click the Authorization tab
  4. Set the authentication type to Bearer Token
  5. Enter the Personal Access Token you created earlier
  6. Hit Send and view the results

List all lights

The response should show a JSON representation of the details about all the cloud connected lights.

Next locate the light that you want to configure as your on-air indicator. For me, it’s my hallway light.

  "id": "d073d527b2d2",
  "uuid": "REDACTED",
  "label": "Hallway",
  "connected": true,
  "power": "off",
  "color": {
    "hue": 120,
    "saturation": 1,
    "kelvin": 3500
  "brightness": 0.9998168917372396,
  "effect": "OFF",
  "group": {
    "id": "ee98ca25f2ee12b10a0d9afb21aeff9d",
    "name": "Hallway"
  "location": {
    "id": "547d70edba21aa99b2fc6e17d392db6a",
    "name": "My Home"
  "product": {
    "name": "LIFX Downlight",
    "identifier": "lifx_downlight",
    "company": "LIFX",
    "capabilities": {
      "has_color": true,
      "has_variable_color_temp": true,
      "has_ir": false,
      "has_chain": false,
      "has_matrix": false,
      "has_multizone": false,
      "min_kelvin": 2500,
      "max_kelvin": 9000
  "last_seen": "2020-04-16T08:21:45Z",
  "seconds_since_seen": 0

Make note of the id value. This is how we reference the light that we want to control. As you can see from above, the id for my hallway light is d073d527b2d2 .

Finally, lets confirm that we can control the light by turning it on and setting the color to purple.

To do that, we need to issue a PUT request to state endpoint and reference the light by using the id selector.

In the body of the request, we tell the API that we want the light to turn on, set the brightness to 100%, and set the color to purple.

  "power": "on",
  "color": "purple",
  "brightness": 1

Turn a light on

Check out the LIFX API documentation to see what you can do with the API.

Microsoft Power Automate

Now that we can control the lights, lets look at turning them on whenever we have an event in our calendar. Here’s how it works.

Trigger: Schedule

Create the flow

Login to Microsoft Power Automate and create a new scheduled flow

Create new scheduled flow

Give it a name and click Create. (Leave other settings as default. We’ll change them later)

Expand the Recurrence step and show the Advanced Options.

Recurrence schedule

By default, Outlook's calendar works off of 15 minute increments, so I've got my Flow's schedule to run at each of these intervals. However, this will only be able to tell when an event in my calendar has started. To figure out when an event has ended, I simply run the flow on the minute either side of the 15 minute mark.

Add a new step of type Initialize variable. We’ll use this variable to store our LIFX API token.

Initialize variable

Add another Initialize variable step to use for the Id of the light to control.

Get calendar events

Add a new step of type Get calendar view of events (V3). Set the Start Time and End Time fields to the expression utcNow() .

Get calendar events

Add a new step of type Condition. Set the condition to:


This expression will retrieve the number of objects returned from the Get calendar view of events (v3) step.

At this stage, we’ve got a branch in the logic flow. “If yes” represents that an event is scheduled for right now, and “If no” means exactly what you think it does.

Let’s take care of the easy bit first. In the If no branch, add a HTTP action and click Show advanced options.

    "power": "on",
    "color": "green"

Green light

Next we’ll move on to the “If yes” branch. The first thing I want to check if the subject is “Focus time”, and if it is, set the light to blue.

Add a new Condition and select Subject from the dynamic content list to represent the value.

After selecting the subject for the value, it will automatically be wrapped in an *Apply for each* block. This happens because the *Get calendar events* step may return more than one event.

Subject is equal to Focus time .

The comparison field is case sensitive!

Subject condition

Now we just need to replicate the HTTP post we created earlier, but substituting the color for the appropriate value. In this example, if the subject is “Focus time” I want the light to turn blue, or if it’s not (i. e. anything else) it’ll turn red.

Blue/Red light


And there you have it! A rather cost effective and simple way to keep yourself focused amidst the distractions of a busy home.

Outside looking in Inside looking out
img1 img2

If you like this idea and want to take it a bit further, here’s a few other things I’ve configured:

  1. Flash the lights in my office to remind me to take a break
  2. Turn off all notifications (to maximize focus) and flash the lights when I get a high priority email, an email from my boss or an @mention in a Teams chat.
  3. Set lights to orange when a Azure DevOps build is in progress, then flash green/red on success/failure

Good luck!