A simple script to automate a HomeKit light turning on/off with a webcam's start/stop state in macOS. I use a Hue Play light bar set to a specific white color temperature, but this should work with any HomeKit light.
- Place the
key-light-automation.sh
script in a location of your choice. - Create a Shortcut named "Key Light" that toggles your HomeKit light on/off with desired settings. Example Shortcut below.
- Edit the included .plist file to point to the location of the script.
- Place the edited .plist file in
~/Library/LaunchAgents/
. - Run
launchctl load ~/Library/LaunchAgents/com.key-light-automation.plist
in your shell to load the script. It will be loaded in subsequent reboots.