Google Chromecast devices were introduced in 2013 and provide a means to “cast” content to any Chromecast compatible device. There are several devices that implement the Chromecast protocol including the Nvidia Shield. In this tutorial, we discuss the Cast All The Things (CATT) utility to “cast” content under program control.
The media that you cast can be images, streamed content or web pages. I use the “CATT” utility to send various media to my Chromecast devices as a part of my home automation. In the video, I focus on the CATT utility. I will extend that here to include a discussion of the “CATT Director” Hubitat Elevation hub application which adds a layer of user friendliness and usability to CATT.
Chrome based browsers including Google Chrome, the Brave Browser and others have embedded support for casting either a tab in your browser or your computer screen to a Chromecast device.
We want to control our casting under program control. You can install the CATT utility to any Linux computer. For our purposes, I am creating an Incus container.
incus launch images:ubuntu/24.04 CATT-Server -p default -p bridgeprofile -c boot.autostart=true
Move inside the container.
incus shell CATT-Server
Take the upgrades, if any.
apt update && apt upgrade -y
CATT is a Python application. Install some dependencies, including Python.
apt install python3 python3-pip python3-venv telnet telnetd openssh-server net-tools nano -y
Telnet is not a protocol that is frequently installed. Since the CATT Director program on Hubitat uses Telnet, I installed it and to enable Telnet we need to edit the following file.
nano /etc/inetd.conf
Scroll down in the nano editor to the “telnet” line and uncomment it as shown in green below.
Do a CTRL O and enter to save the file and a CTRL X to exit the editor.
Execute the following command to restart initutils.
systemctl restart inetutils-inetd
Create yourself a user account and place it in the sudo group.
adduser scott
usermod -aG sudo scott
Move into the new user account.
su - scott
Since CATT is a Python application and we are using Ubuntu 24.04, there is a requirement to create a Python virtual environment for security reasons. Create the virtual environment with this command.
python3 -m venv ~/catt-env
Activate the new Python environment and move inside of it.
source ~/catt-env/bin/activate
Install the Cast All the Things (CATT) utility.
pip install catt
If all you want to do is install CATT, you are done other than my notes on how to use it.
Since the CATT Director user defined application on Hubitat logs in via Telnet, we need to make sure that the Telnet login starts in our Python virtual environment. Unlike a terminal in the bash shell that uses .bashrc, Telnet uses the .profile file. Let’s update .profile to add our Python environment.
echo 'source /home/scott/catt-env/bin/activate' >> ~/.profile
To see the help for catt:
catt -h
To scan your network to see which Chromecast compatible devices you have. I have a Chromecast 4k Ultra and two Google Home Minis on my network.
catt scan
The simplest catt command would be to send a video to a destination Chromecast device. Here is how I “casted” the popular Big Buck Bunny animation video to my TV named “Family Room TV”:
catt -d "Family Room TV" cast https://storage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
Although the prompt returns almost immediately, the content is being casted. In this example, the Chromecast uses H.264 video and AAC audio, which the Chromecast Ultra supports natively.
To stop the casted content:
catt -d "Family Room TV" stop
There are many commands. Here’s a couple more.
catt -d "Family Room TV" pause
catt -d "Family Room TV" play
Just as a reminder, the catt command is installed in the Python virtual environment and requires it to access catt. If I exit the virtual environment, you can see that it is not available.
deactivate
As a reminder, to enter the Python virtual environment again:
source ~/catt-env/bin/activate
To test to see whether our catt server will offer the python environment from telnet, find out the address of your container.
ifconfig
Then, telnet to the address you just found (in my case 172.16.1.138) and log in with your username and password.
Notice above that the telnet session correctly enters the Python virtual environment which you can see from the prompt and the “catt scan” command. This is in virtue of the change we made to the .profile file.
If you are a Hubitat user, head over to the web interface for your Hubitat Elevation Hub and add the drivers for the CATT Director Parent, the CATT Director child and the device driver for the “Send to Hub with CATT Driver”. There is documentation in the Hubitat Community forum on configuring the app.
I use CATT director to send Hubitat dashboards and websites to my Chromecast. Here’s an example of my family weather dashboard child app that launches a webpage. I have many such “child” apps defined in the CATT Director.
I normally voice command my casted apps from Alexa which just amounts to turning on a virtual switch that triggers an automation like the example child automation above.