This script exposes a virtual HomeKit Television accessory where each input corresponds to a Steam user. Selecting an input updates the Steam’s AutoLoginUser; turning the "TV" off restarts Steam.
We regularly game on a headless machine and wanted to switch Steam users easily without fiddling with a KVM. HomeKit provides a convenient way to control devices, and by exposing Steam user accounts as HomeKit inputs, we can seamlessly switch users with our existing HomeKit setup and even set up personalized scenes.
- HomeKit Television service (Active + ActiveIdentifier)
- Inputs are Steam users (PersonaName as label, AccountName as slug)
- When you switch input, AutoLoginUser is set accordingly
- When you turn the TV off, Steam is restarted (killall steam)
- Pairing/state stored under XDG state:
~/.local/state/homekit-steam-user-switcher/
- Linux with Python 3.9+
- Install dependencies
pip install --user -r requirements.txt- Install the script into your user bin directory
install -Dm755 homekit_steam_user_switcher.py ~/.local/bin/homekit_steam_user_switcher.py- Create a systemd user unit
install -Dm644 homekit-steam-user-switcher.service ~/.config/systemd/user/homekit-steam-user-switcher.service
systemctl --user daemon-reload
systemctl --user enable --now homekit-steam-user-switcher.serviceLogs:
journalctl --user -u homekit-steam-user-switcher.service -f- Pairing code:
111-11-111 - In Apple Home: Add Accessory -> More Options -> select the accessory named by
--name(default "Steam Switcher").
- Change name/port/bind IP, or pass manual inputs:
~/.local/bin/homekit_steam_user_switcher.py --name "Steam Switcher" --port 51826 --bind auto
~/.local/bin/homekit_steam_user_switcher.py --inputs "Alice,Bob"Delete the state directory:
rm -rf ~/.local/state/homekit-steam-user-switchersystemctl --user disable --now homekit-steam-user-switcher.service
rm -f ~/.config/systemd/user/homekit-steam-user-switcher.service
rm -f ~/.local/bin/homekit_steam_user_switcher.py
rm -rf ~/.local/state/homekit-steam-user-switcherMIT