I got two Elgato Key Light Airs for better lighting when I am on video calls. After setting them up, I wondered: How do I turn them on automatically for video calls?
I wanted to open a Google Meet link and have the lights turn on instantly, like my webcam.
I started Googling. I found this blog post by Evan Travers, and built off of that. Evan used Hammerspoon, a desktop automation tool for macOS that uses Lua and ships with a ton of APIs. I used four APIs:
- The Bonjour API to find all the Key Lights on my network
- The HTTP API to turn the lights on or off
- The USB API to check if my MacBook is docked: I didn’t want the lights turning on if I was taking a call away from my desk!
- The AppleScript API to check if Google Meet is open in Chrome
My usage of the first three APIs is almost a copy/paste of Evan’s code, with two main exceptions:
- Evan’s spoon was designed to find only one Key Light. I modified it to find all the Key Lights on the network and expose an on/off that controls them as one.
- I made the HTTP calls async so that I could send a request to each Key Light in short succession and not have much delay between each light turning on.
The last part, checking if Google Meet was open, took me a bit of time. At first I was using the JXA integration, but I switched when I noticed a memory leak, which is documented here.
I’ve been using my solution for over a month now and it works great! It’s on GitHub in my hammerspoon-config repo.
At the time of writing, it’s organized in two chunks (permalinks below):
- ElgatoKeys.spoon: This is where you’ll find my custom “spoon” that controls multiple Key Lights as one. You could copy/paste this and use it without modifications, unless you didn’t want to control all the lights on the network.
- init.lua: This is where you’ll find my integration. Essentially I have a timer that checks, every second, whether my Mac is docked, and whether Meet is open. If both are true, the lights go on. It also automatically turns the lights off after the Meet tab is closed.
Hope this helps someone else. Happy hacking!
Update: I’ve since switched to using the camera API to turn my lights on when my camera is in use.