Automating Elgato Key Lights From macOS Touch Bar

Published by Christian Mohn · Read in about 3 min (447 words)

Since I recently got an Elgato Key Light Air for the Home Office of Isolation™, I’ve been playing around with how to automate it. I’ve seen a lot of people using Elgato Stream Decks for automating these lights, but I don’t really have the need for a dedicated device for this. At least not yet.

As it turns out, it’s actually pretty easy to automate these lights via other means. The light itself runs a http server on port 9123, and via /elgato/lights it’s possible to connect to it’s internal API for remote control.

There is even a Postman Collection available, which makes it very easy to get started with connecting and changing settings around.

Since Postman also allows you to export your API calls as a curl command, building the query in Postman is very handy

Once I had two working commands, one for turning the light on with my preferred settings, and one for turning it off, I saved those as two different shell scripts:

elgato-on.sh #

This script turns the light on, sets the brightness to 10 and the temperature to 162. Pretty straight forward.

elgato-off.sh #

This script is even simpler, it just turns the light off.

Info

If you decide to use these, be sure to replace <your lights ip> with your Elgato lights actual IP-address in your own network

All this is well and fine, and running these scripts does the job nicely. By using iCanHazShortcut, and have added keyboard shortcuts for triggering them:

But then it dawned on me, my MacBook has this pretty Touch Bar that seldom gets any love, or usage for that matter. There had to be a way of creating something for this there as well, right? Turns out, there is, and it’s actually pretty simple to add your own actions to the macOS Touch Bar.

Adding Custom Quick Actions to the macOS Touch Bar #

  1. First off, open System Preferences -> Keyboard -> Customize Control Strip and drag the Quick Actions button to your Touch Bar

  1. Create Quick Action in Automator

  1. Find Run Shell Script and double click it.

  1. Set Workflow receives to no input and put in the details for your script in the Run Shell Script window.

  1. Set the color you want to have for your Touch Bar button and save the Quick Action with your preferred name, I used Key Light On and Key Light Off for mine.

  2. Repeat steps 1-5 for the second script. Once saved, they should appear under the Quick Actions button on the Touch Bar (added in step 1)

Now I can control turning the light on and off, both from my Touch Bar and via keyboard shortcuts!

Post last updated on January 2, 2024: Add author

About

vNinja.net is the digital home of Christian Mohn and Stine Elise Larsen.

The primary focus is on IT architecture and data center technologies like virtualization and related topics, but other content also pops up from time to time.

Sponsors