When working from home I have my desk and webcam pointing towards my door which means sometimes someone might enter my office just to find themself to be captured on camera unwittingly. To deal with this I added a light above the outside of my door. This light switches on when my webcam is on and off when it is off. This way people know if they are on camera or not.

This is how I did it:
I installed OverSight which is a great security-minded open source tool that will send you a notification when your webcam or mic is on.
Open the Shortcuts app on your mac and create two short cuts for both events: enabling and disabling the camera.

Then I wrote a small shell script to run either of these shortcuts:
#!/bin/bash
EVENT=""
while [[ $# -gt 0 ]]; do
case "$1" in
-event)
if [[ -n "$2" ]]; then
EVENT="$2"
shift 2
else
echo "Error: '-event' requires an argument [on|off]."
exit 1
fi
;;
*)
# Ignore other flags
shift
;;
esac
done
if [[ "$EVENT" == "on" ]]; then
shortcuts run "Turn OnAir Light On"
elif [[ "$EVENT" == "off" ]]; then
shortcuts run "Turn OnAir Light Off"
else
echo "Usage: $0 [other options] -event [on|off]"
exit 1
fi
I placed this content into a file called ~/onair.sh
and made it executable:
λ chmod +x ~/onair.sh

Done
Now whenever my webcam is enabled the light goes on outside my office and people know if they're on camera or not.