Google Cast community integration, free and open source

Control your Chromecast, Google Nest and Cast TVs locally: music, volume, announcements.
Control your Google Cast devices from Gladys: Chromecast, Google Nest speakers and displays (Nest Mini, Nest Audio, Nest Hub...), TVs with Chromecast built-in or Google TV, and the speaker groups of the Google Home app.
Everything happens on your local network: no Google account, no cloud, no API key. This integration replaces the Google Cast integration built into Gladys, with much more than announcements.
Where it works
- Countries: everywhere. Google Cast is a local protocol, with no regional service behind it: the integration works in every country and region where Cast devices are sold, whatever the language of the device.
- Network: Gladys and the Cast devices must share the same local network. Discovery uses mDNS (the same as your phone), which does not cross routers: a device on another VLAN or subnet can still be added by its IP address (see Manual addresses), as long as Gladys can reach it on TCP port 8009 (and 32000-33000 for speaker groups).
- From outside your home: the Cast devices are only reachable from your home network, but Gladys is too — the dashboard, the scenes and Gladys Plus work from anywhere, Gladys relays the commands locally.
Requires Gladys Assistant 5.3.0 or later.
What you get
Each Cast device becomes a music player in Gladys, with:
- the "now playing" card on the dashboard: title, artist, album, artwork, progress, play / pause / previous / next, whatever app casts (Spotify, YouTube Music, Deezer, a web radio...);
- volume and mute, kept in sync when someone changes them from a phone or the device itself;
- announcements: the "Play a notification" scene action of Gladys speaks on the device (text-to-speech);
- a local badge on the device, red when the device is unreachable.
The integration keeps a connection open to each device you added: every change is pushed by the device, nothing is polled.
Installation and configuration
- Install Google Cast from the integration catalog.
- Open the Discovery tab: the Cast devices of your network are listed. Add the ones you want. The speaker groups appear too.
- That's it. The Configuration tab offers a few options:
- Manual addresses: the IP addresses of the devices the discovery does
not find (another VLAN), separated by commas, e.g.
192.168.20.15, 192.168.20.16:8009. Give these devices a fixed address in your router: the address identifies them. - Speaker groups: uncheck to hide the speaker groups.
- Announcement volume: the volume of the Gladys announcements, from 1
to 100 %; the previous volume comes back after the announcement.
0keeps the current volume. - Scan duration: raise it if some devices are missing from the Discovery tab.
- Manual addresses: the IP addresses of the devices the discovery does
not find (another VLAN), separated by commas, e.g.
Buttons of the Configuration tab:
- Search the network: finds the devices again (new ones go to the Discovery tab) and refreshes the addresses of the known ones.
- Test a device: connects to the chosen device and shows its volume and the app it runs.
A device whose address changed (new DHCP lease) is found again automatically after a few failed connections.
Scenes
Triggers
In the scene editor, under the integration's category:
- Cast playback started: something starts or resumes playing, or the
track changes. Variables:
title,artist,app. - Cast playback stopped: the media ended, was stopped, interrupted or
failed. Filter on the reason if you wish. Variables:
reason(finished,cancelled,interrupted,error),title. - Cast app launched: an app starts casting (YouTube, Netflix, Spotify...).
Filter on its exact name if you wish. Variables:
app,app_id. - Cast device online / offline: a device became reachable or unreachable.
Variable:
status(online,offline).
Each trigger can be limited to one device; left empty, any device matches. The
variables are read with {{triggerEvent.data.title}} in the following
actions. What the integration casts itself (scene actions, announcements)
never fires these triggers, so a scene cannot loop.
The volume and the playback state are device features too: the standard "Device state" trigger works on them ("when the TV is paused...").
Actions
- Cast a media: plays a URL on a device: a web radio, a sound, a video, a
picture (e.g. a camera snapshot). Pick the format, or let the integration
guess it from the URL; tick Live stream for a web radio. Output:
played. - Play a sound: plays a short sound (doorbell chime, alarm) at the chosen
volume, then restores the previous volume. Output:
played. - Stop casting: quits the app casting to the device. Output:
stopped(false when nothing was casting). - Launch a Cast app: opens an app from its Cast app id, e.g.
233637DE(YouTube). Output:launched.
The URL must be reachable by the Cast device itself (a public URL, or an
address of your local network). An unreachable device does not stop the
scene: the output is false, use it in a condition if needed.
The standard Gladys actions work too: Play a notification (text-to-speech), Set the value of a device (volume, mute, playback state).
Dashboard
- The core Music card shows any Cast device, with its artwork and controls.
- Google Cast devices widget: every device at a glance (online, the app casting, what plays).
- Google Cast player widget: one device, its live volume, the artwork, the title and artist, and the play / pause, next and stop buttons.
Migrating from the built-in Google Cast integration
The devices of this integration are new Gladys devices:
- Add the devices from the Discovery tab of this integration.
- In your scenes, point the Play a notification actions to the new devices, and update your dashboards.
- Delete the devices of the built-in integration (Integrations → Google Cast → Devices).
Troubleshooting
- No device in the Discovery tab: the devices must be on the same network as Gladys. Check that they show up in the Google Home app on the same Wi-Fi, raise the scan duration, or use the manual addresses.
- Unreachable badge: the device is off, or its address changed. Use Search the network, then Test a device.
- No sound for the announcements: the Cast device downloads the voice clip from Gladys: it must be able to reach the Gladys address on your network.
- Nothing happens on next / previous: some apps (YouTube, Netflix) do not accept these commands from another sender.
Logs: Integrations → Google Cast → Logs. Set the LOG_LEVEL environment
variable to debug for the full detail.
Privacy and security
The integration only talks to the Cast devices of your local network (encrypted TLS connection, port 8009) and, for the dashboard artwork, to the image servers of the apps that cast. No data leaves your home otherwise. See SECURITY.md to report a vulnerability.
Configuration settings
These are the settings Google Cast asks for in its configuration screen in Gladys.
| Setting | Type | Required | Description |
|---|---|---|---|
| Getting started | section | No | Everything stays on your local network: no Google account, no cloud. Gladys finds your Cast devices (Chromecast, Google Nest, TVs with Chromecast built-in, speaker groups) by mDNS: open the Discovery tab and add them. Works in every country. |
| Manual addresses | string | No | Only for devices mDNS cannot reach (another VLAN or subnet): their IP addresses, separated by commas, with an optional :port. Give them a fixed address in your router. |
| Speaker groups | boolean | No | Also offer the speaker groups created in the Google Home app. |
| Announcement volume (%) | number | No | Volume of the Gladys announcements (text-to-speech), the previous volume coming back afterwards. 0 keeps the current volume. |
| Scan duration (s) | number | No | How long to listen for devices during a scan. Raise it if some devices are missing. |
How to install Google Cast in Gladys
- In Gladys, open Integrations: Google Cast appears in the catalog, next to the native integrations, with a community badge.
- Click Install. Gladys pulls the Docker image (
ghcr.io/gboulvin/gladys-google-cast:1.0.0), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration). - Open the Configuration screen of the integration, fill in the settings, and save.
- You can also install it directly from its repository URL: https://github.com/gboulvin/Gladys-Google-Cast.
Google Cast requires Gladys >=5.3.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.
Not running Gladys yet? It is free and open source: follow the installation guide to get started.
About external integrations
Google Cast is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by gboulvin, not by the Gladys core team.
- Browse all integrations, native and community
- Build and publish your own external integration
- Source code on GitHub — source of this documentation