I wanted to find a way to cast images or audio using Node-RED and Chromecast when something important happens in my Smart Home.

Sad Chromecast device

I didn’t put my Google Chromecast to a good use lately, so I decided to drastically change that.

Fortunately I manage to find how to do that and now I’m about to show it to you in details.

The same approach can be applied to Google Home devices with or without display. Apparently If your device is without display like the Google Home mini, then you can only cast audio files.

But before you say:
Kiril, I already can stream from my phone to my TV whenever I want, why are you wasting my time?

Imagine the following scenario: Someone ring at your door and your TV is automatically displaying a security camera image – isn’t it priceless?

Node-RED and Chromecast

The possibilities for a trigger of the cast are basically endless. They are depending of your needs and available sensors in your Smart Home.

I will focus more on the Chromecast and Node-RED integration, but you can easily adapt this to your needs afterwards.

Really quick before we get into the article – I just want to say a huge thank you to our sponsor today, which it’s called: Smash That Subscribe Button if you haven’t done that already.

For real there is no sponsor, but if you just hit the Subscribe button that would be good enough for me – thank you.

So anyway if you have any of these Google devices,

ChromecastAndroid TV devicesSoundbars and speakers
First generation (video)Nexus PlayerGoogle Home
Second generation (video)Nvidia ShieldVizio
Third generation (video)Xiaomi MiBoxSony
Chromecast AudioVizio televisionsLG
Chromecast UltraSharp televisionsPhilips
Sony televisionsB&O Play
Toshiba televisionsGrundig
Philips televisionsPolk Audio
Bang & Olufsen
Riva Wand
Grace Digital

the only additional thing that you will need is Node-RED.

Node-RED install

You need Docker client to install Node-RED, if you already have working Node-RED you can go directly to the Cast from Node-RED section.

Go to docker website and download the client for your Operating System.

Running Docker Client on MacOS

For MacOS, the running Docker client is looking like this. Windows client is pretty similar. You should see the green dot.

After you install and run the Docker client you have to open a Terminal/Console and you just need to type the following command:

docker run -it -p 1880:1880 --name nodered nodered/node-red:latest

This roughly means: start a Docker container with the latest official Node-RED image and export the port 1880 to localhost.

Cast from Node-RED

Node-RED is up & running. Let’s import some flows now.

To do that go to “Manage Palette” in the Node-RED menu and search for “node-red-contrib-cast” or just “cast”

Node-RED menu Manage Palette
Node-RED menu Manage Palette

Click on the Install button in the lower right corner and wait for the process to finish.

Then you can grab one of the examples (like the one below) from the GitHub page of the project and import it in your Node-RED

[{"id":"8d9663a.05e27a","type":"cast-to-client","z":"d900d7d9.c4c498","name":"","url":null,"contentType":"","message":null,"language":"en","ip":"","port":"","volume":null,"x":590,"y":200,"wires":[["b885e401.447548"]]},{"id":"6faf449b.c11efc","type":"inject","z":"d900d7d9.c4c498","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":200,"wires":[["23bdf480.46b85c"]]},{"id":"23bdf480.46b85c","type":"change","z":"d900d7d9.c4c498","name":"","rules":[{"t":"set","p":"ip","pt":"msg","to":"","tot":"str"},{"t":"set","p":"message","pt":"msg","to":"Subscribe for Kiril's newsletter","tot":"str"},{"t":"set","p":"language","pt":"msg","to":"En-gb","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":200,"wires":[["8d9663a.05e27a"]]},{"id":"b885e401.447548","type":"debug","z":"d900d7d9.c4c498","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":790,"y":200,"wires":[]},{"id":"9a5a2ce.5ae7ed","type":"comment","z":"d900d7d9.c4c498","name":"say a text","info":"","x":120,"y":160,"wires":[]}]
This sends a text to Google translate and as a result the text will be played using TTS
This sends a text to Google translate and as a result the text will be played using TTS

The only thing that you have to change here is the IP, you have to type the IP of your Chromecast / Google Cast device :

Change the IP with the IP of your Chromecast/Google Cast device
Change the IP with the IP of your Chromecast/Google Cast device

The last thing before you can test it, you have to hit the “Deploy” button in the upper right and then click on the inject button.

If everything is configured properly – you should hear an audio record from your Google Cast device.

You can test the other examples as well and of course you can adapt them to suit your needs.

Check the Device Status

The other thing that could be very useful for your Smart Home Automation is checking the current status of the Chromecast / Google Cast device.

You can understand the volume level, is device muted, is device currently playing any media and if yes – what exactly and so on and so on.

To accomplish this, just import the following example and change the IP with yours afterwards:

Flow to get the current status of the Chromecast / Google Cast device
Flow to get the current status of the Chromecast / Google Cast device


I would love to hear what are your ideas for a good use of this Chromecast and Node-RED collaboration – let me know your answers in the comments section below.

Support my work

Any sort of engagement on this channel does really help out a lot with the YouTube algorithm, so make sure you hit the subscribe, Like and Bell buttons If you enjoy this video.

Also feel free to add me on Twitter by searching for @KPeyanski.

I really hope that you find this information useful and you now can cast video and audio from Node-RED to your Chromecast or Google Home devices .

Thank you for watching/reading, stay safe and see you next time.


Chad Craig · 01/03/2020 at 4:23 am

What is the advantage of using the Change node and not just adding the msg’s to the Cast node?

    Kiril Peyanski · 01/03/2020 at 8:35 am

    In this simple flow there is no advantage and it is basically the same. But if you have something more complex for example: Several triggers/cameras in one Flow with different IPs, different Content Type etc, etc. In that case you may want to construct all of your variables in advance with Change nodes or Function nodes and then to pass them to only one empty Cast node, which will handle all of the variations without any issues. But at the end this is just a personal preference and the important part is to make it work 🙂 I hope I managed to answer. Thanks for you comment and have a nice day.

warren · 09/05/2020 at 6:29 am

Is there any way to cast a web page instead of images/videos? What I’m trying to do is set up magic mirror to be able to automatically cast to one of my TVs through chromecast. so that when I wake up I get a nice overview of the day. any ideas?

    KS · 10/07/2020 at 2:24 pm

    I want to do the same. Create a weather view or a visualization when someone calls me and I am at home.
    Unfortunately I have not yet found a way to display a website.

EdB1972 · 04/06/2020 at 6:21 pm

Is it possible to resume audio / video playback via the castable devices when playing a tts?

Example: Listen to TuneIn on Google Home and a TTS message appears. It will stop the stream, play the tts message. Resume TuneIn stream.

Sacurio · 28/04/2021 at 11:11 pm

I following your work, sincerely is awesome. I applied the steps of your tutorial in order to stream my security camera video to a Chromecast, and at the beginning all was working very well. Now, for some reason I’m received an “Not able to load media:Load failed Not able to load the media.” error and simply doesn’t work 🙁 .

To be honest, I don’t have any idea about the problem is. Can you suggest me something about it.


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *