by neilk » Tue May 18, 2021 1:07 pm
I finally got around to refining this to support both Zoom and Teams calls and to turn the wall lights outside my office to red when I am on a video call.
- IMG_1634.jpeg (499.02 KiB) Viewed 3476 times
The script is pretty crude, but sets a series of variables for a zoom call, teams call or a video call and a virtual device takes care of the lights and the colour adjustment
- Code: Select all
#!/bin/bash
LOGFILE="${HOME}/Library/Application Support/Microsoft/Teams/logs.txt"
indigo_user="username"
indigo_pass="password"
while true
do
video_call=false
last_event=$(tail -r "${LOGFILE}" | grep -oh "eventData: s::;m::1;a::[0-9]" | head -n1)
if [[ "${last_event}" =~ 1$ ]]
then
echo "☎️ In a Teams call"
curl -u "${indigo_user}":"${indigo_pass}" --digest -X PUT -d value=true http://192.168.1.151:8176/variables/teamscall
video_call=true
echo "Teams call in progress"
else
curl -u "${indigo_user}":"${indigo_pass}" --digest -X PUT -d value=false http://192.168.1.151:8176/variables/teamscall
echo "No teams call in progress"
fi
zoom_call=$(lsof -i 4UDP | grep zoom | wc -l)
echo $zoom_call
if (( $zoom_call < 1 ))
then
curl -u "${indigo_user}":"${indigo_pass}" --digest -X PUT -d value=false http://192.168.1.151:8176/variables/zoomcall
echo "No Zoom call in progress"
else
curl -u "${indigo_user}":"${indigo_pass}" --digest -X PUT -d value=true http://192.168.1.151:8176/variables/zoomcall
video_call=true
echo "Zoom call in progress"
fi
echo "Sleeping"
sleep 5
done
Still need to figure out how to run this elegantly on my work Mac without admin rights, and to check if I am on the home network. I have rather left myself open to jokes about the red lights now of course.
Neil
I finally got around to refining this to support both Zoom and Teams calls and to turn the wall lights outside my office to red when I am on a video call.
[attachment=0]IMG_1634.jpeg[/attachment]
The script is pretty crude, but sets a series of variables for a zoom call, teams call or a video call and a virtual device takes care of the lights and the colour adjustment
[code]#!/bin/bash
LOGFILE="${HOME}/Library/Application Support/Microsoft/Teams/logs.txt"
indigo_user="username"
indigo_pass="password"
while true
do
video_call=false
last_event=$(tail -r "${LOGFILE}" | grep -oh "eventData: s::;m::1;a::[0-9]" | head -n1)
if [[ "${last_event}" =~ 1$ ]]
then
echo "☎️ In a Teams call"
curl -u "${indigo_user}":"${indigo_pass}" --digest -X PUT -d value=true http://192.168.1.151:8176/variables/teamscall
video_call=true
echo "Teams call in progress"
else
curl -u "${indigo_user}":"${indigo_pass}" --digest -X PUT -d value=false http://192.168.1.151:8176/variables/teamscall
echo "No teams call in progress"
fi
zoom_call=$(lsof -i 4UDP | grep zoom | wc -l)
echo $zoom_call
if (( $zoom_call < 1 ))
then
curl -u "${indigo_user}":"${indigo_pass}" --digest -X PUT -d value=false http://192.168.1.151:8176/variables/zoomcall
echo "No Zoom call in progress"
else
curl -u "${indigo_user}":"${indigo_pass}" --digest -X PUT -d value=true http://192.168.1.151:8176/variables/zoomcall
video_call=true
echo "Zoom call in progress"
fi
echo "Sleeping"
sleep 5
done[/code]
Still need to figure out how to run this elegantly on my work Mac without admin rights, and to check if I am on the home network. I have rather left myself open to jokes about the red lights now of course.
Neil