A WiFi enabled physical volume knob for Chromecasts via a mash up of Griffin's no longer made USB device the PowerMate and the awesome python Chromecast controlling library catt using the equally awesome powermate python library. You can optionally show the volume on a screen.
Here's the current demo in an animated gif. Behind the PowerMate is a Chromebook running the Google Home app. When the Cattmate sets the volume you can kinda make out Google Home reflect the volume change as well:
This is my first real Python project! That means while the code is super stable (my desktop version has an uptime of weeks now), I'm guessing not everything follows the Pythonic way just so.
- Raspbery Pi - I used a Raspberry Pi Model 3B Rev 1.2
- PowerMate - Hopefully you can find one used on eBay if you don't already have one
- 0.96" SSD1336 OLED Screen (optional) - I use these from MakerFocus
- Chromecast - any sort will do, original, audio or ultra
If the PowerMate is too escoteric, consider checking out cattrotar! Cattrotar is another Chromecast volume control project, but it uses a cheap, comodity Rotary Encoder instead (<$2/ea).
Cattmate supports:
- Increase volume - rotate clockwise
- Decrease volume - rotate counter-clockwise
- Mute - push down - the light will strobe to denote muted status
- Unmute - push down again
- Pause - push down and hold 1+ second
- Play - push down and hold 1+ second again
- Fast Forward - push down and rotate clockwise
- Rewind - push down and rotate counter-clockwise
These steps assume you have your Pi set up with Raspbian, that it's booted up, connected
to the same WiFi as your Chromecast. If your Chromecast is on a different network, but
you can get to it by IP, the
config supports IPs instead of Chromecast names. It also assumes you're using the pi
default user with a home directory of /home/pi
and that you have both
pip3 and optionally
virtualenv installed:
- Clone this repo and cd into it:
git clone https://github.com/Ths2-9Y-LqJt6/cattmate.git /home/pi/cattmate; cd /home/pi/cattmate
- Create your own virtualenv and activate it
python3 -m venv venv;. venv/bin/activate
(optional) - Install all the python prerequisites with
pip3 install -r requirements.txt
- Create your own config file
cp config.dist.py config.py
and editconfig.py
with the names or IPs of the chromecasts you want to use (only first one supported right now ;) and whether you want to use an external I2C screen or not - Copy the systemd file into place, reload systemd, start and enable it:
sudo cp cattmate.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable cattmate sudo systemctl start cattmate
- Add the
udev
rule withsudo cp 60-powermate.rules /etc/udev/rules.d/
and plug your powermate into an open USB port.
You should be good to go! The system is very resilient in that you can not have screen plugged in when you start and the plug it in and systemd will notice and start things up. Same for the powermatte - you can unplug and plug and unplug all day and it satisfyingly just works!
You can debug the system in syslog with sudo tail -f /var/log/syslog
. I try to do a lot
of testing and explicit have except
errors that explicitly tell you what went wrong
and how to fix it.
Note that on slower devices, like the Pi 1 that I tested on, startup can take >60sec, so be patient ;)
If all else fails, open an issue and I'l try and help ya!
- 14 Jan 2020 v0.5 - Rewrite readme, add both
cattmate.service
and60-powermate.rules
for systemd and udev rules respectively. - 16 Dec 2019 v0.13 - Complete refactor to use native python driver per #8 and add pause, ff & rrwnd per #10
- 13 Dec 2019 v0.12 - Add MIN/MAX alerts per #2, fix #1
- 10 Dec 2019 v0.11 - refactor
ssd1306
lib toCsd1306
class, simplify calls to same, refactor for cleaner code - 10 Dec 2019 v0.10 - first decently functional code, known issue in #1 though.