Automating the Elgato Key Light
As video conference calls are now part of my daily life, I decided to investigate how I can look better in front of my webcam. After some research, I bought an Elgato Key Light Air to help illuminate my face better.
So far, I’m delighted with the purchase. The key light has definitely improved how I look on video calls. But having to turn it on every time I have a video call and then turn it off when the call ends is a pain.
I considered leaving the light on throughout the work day, but the light can be quite searing to my eyes when it’s shining at me for an extended period of time.
I then put on my software engineering hat and wondered, “Can I automate this inconvenience away?”. As it turns out, I can.
Elgato Key Light REST API
The Elgato Key Light and Key Light Air devices actually have a web server (listening on port 9123) built in. The web server exposes a REST API:
GET /elgato/lights
This endpoint returns the status of the key light.
Sample Response
{
"numberOfLights": 1,
"lights": [
{
"on": 1,
"brightness": 9,
"temperature": 262
}
]
}
For updating the key light, there’s a PUT action endpoint:
PUT /elgato/lights
Content-Type: 'application/json'
--data-raw '{
"Lights": [
{
"Temperature": 344,
"Brightness": 100,
"On": 1
}
]
}'
This endpoint allows you to set the attributes of the key light. You can set the brightness and temperature, including turning it on or off.
This means that I can turn the Elgato Key Light off and on by interfacing with its REST API endpoints.
A Node.js script
I created a Node.js script that toggles on and off the Elgato Key Light. I then bound the execution of the script to a keyboard macro. So now, I can tap a key to turn the Key Light on and off. :D
Conclusion
It is relatively easy for one to interface with an Elgato Key Light or Key Light Air using its built-in REST API. You can even integrate it into your smart home via something like Homebridge.