Code Monkey home page Code Monkey logo

automate-elgato-keylight's Introduction

Elgato Key Light Air Automation on Mac OS

Automate Elgato Key Light Air to switch on automatically when you join a Google Meet or Zoom call (or any app that in-fact uses a camera stream on a Mac OS) and switches it off when the stream ends.

I've found it a hassle to remember to switch my lights on and off as I join various video calls throughout the day. This bash script (works for Mac OS Monterey 12.x) monitors the Mac OS stream log and runs a curl command to activate the lights.

###Monitoring camera stream on Mac OS 12.x (Monterey)###

log stream --predicate 'subsystem == "com.apple.UVCExtension" and composedMessage contains "Post PowerLog"'

essentially monitors the stream log on Mac OS and filters out any video capture on Mac OS 12.X (Monterey), for older versions of Mac OS, check out the good work at: https://gist.github.com/jptoto/3b2197dd652ef13bd7f3cab0f2152b19 for that.

###Turning the Engato Key Light Air On and Off###

curl --location --request PUT 'http://<light IP address>:9123/elgato/lights' --header 'Content-Type: application/json' --data-raw '{"lights":[{"brightness":40,"temperature":162,"on":1}],"numberOfLights":1}'

credit: https://vninja.net/2020/12/04/automating-elgato-key-lights-from-touch-bar/

You need to change the local IP address of the lights based on your local setup in the script. The rest of the key/value pairs to configure the light are self-expalantory.

Running the script and testing if everything works

You can run the script using Terminal, download the .sh file, edit it and run:

sh autolights.sh

and this will start to monitor your stream log. Open any app that uses your web camera, maybe Photo Booth and see if your light(s) come on. If they do not, check that you have entered the correct IP address for your light(s). Easiest way to identify the IP address is to use the Elgato Control Center utility > Key light settings > and note the IP address for each light.

Executing the shell script automatically

If (like me) you prefer to run the bash script everytime you start-up up your Mac to avoid starting it manually, you can goto Users and Groups > Login Items tab > and plus in your bash script. You can check the Hide button won't show the terminal window.

May you see the light! ๐Ÿ”ฆ ๐Ÿ˜†

Akbur Ghafoor

automate-elgato-keylight's People

Contributors

akburg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.