Nono.MA

Control Elgato Key Light (and Air) from the Command Line (CLI)

FEBRUARY 2, 2022

Corsair's Elgato Key Lights and Key Light Air models can be controlled, via Wi-Fi, from your phone or computer. Specifically, the Control Center app is available for iOS and macOS. You can either control each light individually or synchronize the state (on or off), brightness, and temperature, to control all devices simultaneously.

I had been thinking that there had to be a way to control these lights from the command line, which would be an opportunity to switch the lights on with the right settings for recording whenever I was ready to start streaming.

It turns out there are a few solutions, including a Python package, namely, PyElgato. I opted for a command-line application written in Go—endocrimes/keylightctl—which you can install by running the following command on your machine, were you to have Golang setup.

go install github.com/endocrimes/keylightctl@latest

If your .zshrc or .bashrc files export the paths of Go binary files properly, you can start running commands to describe available lights and see their settings, or switch the lights on and off adjusting their brightness and temperature at the same time. The only downside I saw is that these new values don't show on Elgato's Control Center on macOS.

# Display available devices and their settings
keylightctl describe -all
# +---+-------------+-------+------------+-------------+---------+
# | # | NAME        | POWER | BRIGHTNESS | TEMPERATURE | ADDRESS |
# +---+-------------+-------+------------+-------------+---------+
# | 0 | Key Light → |  off  |     29     |     205     | elg..23 |
# | 1 | Key Light ← |  off  |     29     |     205     | elg..23 |
# +---+-------------+-------+------------+-------------+---------+

# Switch lights off
keylightctl switch -all off

# Switch lights on
keylightctl switch -all on

# Switch lights on, adjusting their settings to 29% and 4900K
keylightctl switch -all -brightness 29 -temperature 205 on

# Switch light off by name (or part of the name)
keylightctl switch -light "→" off

Why would I want to automate this?

I've included a call to switch all lights in my &golive Typinator text expansion, which sets up a series of things and applications on my machine to start live streaming.

But you can think of dozens of uses for being able to control your lights from the command line like, for instance, scheduling a Cron job to turn your lights on or off at given times of the day.

Have a nice day!

Blog