rlue
4 days ago
Like all the other commenters here, I also devised my own solution—but AFAICT, it's the only other solution that's automated!
Requirements:
* macOS
* Zoom
* Home Assistant
* A signal light/sign on a smart switch (like [0])
The Procedure:First, create a script that checks whether you're currently on a Zoom call, and then turns your signal light on or off accordingly. Remember to chmod +x!
#!/bin/sh
if [ $(lsof -i 4UDP | grep zoom 2>/dev/null | wc -l) -gt 1 ]; then
curl \
-H "Authorization: Bearer ${HOME_ASSISTANT_ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"entity_id": "${ENTITY_ID}"}' \
https://${HOME_ASSISTANT_DOMAIN}/api/services/switch/turn_on
else
curl \
-H "Authorization: Bearer ${HOME_ASSISTANT_ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"entity_id": "${ENTITY_ID}"}' \
https://${HOME_ASSISTANT_DOMAIN}/api/services/switch/turn_off
fi
Then, create a LaunchAgent that monitors your Zoom Application Support directory for filesystem changes at ~/Library/LaunchAgents/local.${USER}.on-air.plist: <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.${USER}.on-air</string>
<key>ProgramArguments</key>
<array>
<string>${PATH_TO_SCRIPT}</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Users/${USER}/Library/Application Support/zoom.us/data</string>
</array>
</dict>
</plist>
Finally, load 'er up: $ launchctl load ../Library/LaunchAgents/local.${USER}.on-air.plist
[0]: https://www.amazon.com/dp/B09NJ8ZCHFOhSoHumble
4 days ago
I have something similar that I built a long while ago. It's a large Do Not Disturb sign. There is a raspberry pi mini that controls power going to it. There is a corresponding daemon running on a PC that checks Discord call status. In call? Power to sign. Not in call? No power to sign. The client/server daemons are in Golang and communicate over RPC.
Neywiny
3 days ago
What does the pi do? Feels like something that could get replaced with an ESP32 if it needs to be remote or just an ftdi chip or some other usb to gpio if not
OhSoHumble
3 days ago
It's what I had in the drawer.
stevenhubertron
3 days ago
You can make this quite a bit easier you could just connect your Apple calendar or Google calendar to Home Assistant directly and just set up an automation there no script needed