Add systemd service to bridge the Pi Unix socket over SSH, make fan.py fall back to the TCP tunnel, and rename the module from `custom/fan` to `custom/cooling_pad`. Update README install steps and connection details.
Waybar widget for the fan controller
A custom/fan Waybar module that talks to fan_controller over its Unix
socket (/tmp/fan_controller.sock) — the same protocol as FanController.qml.
Install
-
Copy the files:
mkdir -p ~/.config/waybar/scripts cp waybar/fan.py ~/.config/waybar/scripts/ chmod +x ~/.config/waybar/scripts/fan.py -
The daemon runs on the Pi, so bridge its Unix socket over SSH once:
cp waybar/fan-tunnel.service ~/.config/systemd/user/ systemctl --user daemon-reload systemctl --user enable --now fan-tunnelThis forwards
127.0.0.1:10250→root@10.55.0.1:/tmp/fan_controller.sock. -
Add the
custom/cooling_padentry (below) to~/.config/waybar/config.jsonc(merge it into your existing module list, e.g. undermodules-right). -
Restart Waybar.
waybar config
"custom/cooling_pad": {
"return-type": "json",
"exec": "~/.config/waybar/scripts/fan.py",
"interval": 5,
"on-click": "python3 ~/.config/waybar/scripts/fan.py cycle",
"on-right-click": "python3 ~/.config/waybar/scripts/fan.py auto"
}
Connection details
fan.py uses the local /tmp/fan_controller.sock if it exists, otherwise the
tunnel at 127.0.0.1:10250. Override with FAN_CONTROLLER_ENDPOINT
(unix:/path or host:port). If the widget shows fan: offline, check
systemctl --user status fan-tunnel and ssh root@10.55.0.1 'ls -la /tmp/fan_controller.sock'.
Usage
-
Status — shows
temp / mode, e.g.48.3° auto 55°or51.0° 75%. Hover for a tooltip with temp, duty, RPM, mode and safe-mode state. -
Left click — cycles
auto → 25% → 50% → 75% → 100% → auto. -
Right click — returns to auto mode.
-
CLI equivalents:
fan.py cycle # same as left click fan.py auto # same as right click fan.py duty 75 # set manual duty (0-100) fan.py setpoint 55 # set auto setpoint (35-85)
Optional styling
The script sets CSS classes fan, plus offline when the controller is
unreachable and safe in safe mode. Example for style.css:
#waybar .fan.offline { background: #505050; }
#waybar .fan.safe { background: #e05050; }
Notes
FAN_CONTROLLER_SOCKenv var overrides the socket path if needed.- Each poll is a short-lived process (5 s interval), matching how the Quickshell widget talks to the daemon — no persistent client required.