In today’s article we are going to talk about Home Assistant Google cast integration and Home Assistant cast functionality. As always we are not only going to do sweet talks, but we will see everything in action. We will setup these things first and then we will start casting like crazy using Home Assistant scripts and automations.

Home Assistant Google Cast vs Home Assistant Cast

Let’s first clear this out, as I also got confused initially. There is Home Assistant Google Cast integration and there is Home Assistant cast which are different things. Below you can find the detailed explanation.

What is Home Assistant Google Cast?

The Home Assistant Google Cast integration allows you to add a Chromecast device in your Home Assistant as media player. Then you can add it as a card to your Lovelace (Home Assistant UI). Using this card you can see what is currently playing on your Chromecast device and you can control it.

To activate the Home Assistant Google Cast integration you only need a Chromecast device and Home Assistant running in the same local network.

What is Home Assistant Cast?

Home Assistant Cast allows you to cast your Home Assistant (or part of it) on a Chromecast device. It also allows you to interact with Home Assistant on Google Assistant devices with a screen. This means that you can make a ton of useful automations and scripts and make your Home even smarter.

For example with a push of a button in your Home Assistant or automatically you can cast media like video, audio, camera images and even YouTube videos on your Chromecast.

Home Assistant Google Cast Integration demo

That Sounds good right? Let’s get back a bit and demo the Home Assistant Google Cast integration first and then we will continue with the Home Assistant Cast.

Open your Home Assistant and go to Configuration > Integrations > Search for Google Cast and click on the result and follow the instructions. Alternatively you can click on the My Home Assistant link below:

Open your Home Assistant instance and start setting up a new integration.
Home Assistant Google Cast Integration added with 1 device and 1 entity

You can then click on the found device to see what you just added to your Home Assistant.

Inside the Home Assistant Google Cast integration you can add the entity that was found to your Home Assistant Lovelace.

Using the Home Assistant Google Cast integration you can see what is playing at the moment on your Chromecast device and you can control it.
Using the Home Assistant Google Cast integration you can see what is playing at the moment on your Chromecast device and you can control it.

Afterwards you can see your Chromecast device as standard for Home Assistant Media Player.

You can use the Text to speak field to make your Chromecast say something from Home Assistant.

Even Text to speach functionality is working out of the box without any modifications.

Cast YouTube video using Home Assistant script

Now let’s continue with something fun like creating a Home Assistant script that will cast a Youtube video on your Chromecast device with a push of a button.

Use the Home Assistant Script Editor UI (as seen in the video) or paste the YAML code below in your scripts.yaml file. Result is the same and the choice is yours. If you don’t want to see my face when you run this script – you can change the media_id with any YouTube video id (strange symbols in the YouTube video URL).

alias: "Cast YouTube to My Chromecast"
sequence:
    - target:
        entity_id: media_player.chromecast
      data:
        media_content_type: cast
        media_content_id: '
          {
            "app_name": "youtube",
            "media_id": "ASsjdbW9KU8"
          }'
      service: media_player.play_media
mode: single

After you execute this script you will see two things:

  • Your Chromecast card in Home Assistant will get the YouTube video thumbnail as background.
  • The YouTube video defined in media_id will be casted to your Chromecast device (entity_id:).
Casting YouTube video using Home Assistant script is a success!
Casting YouTube video using Home Assistant script is a success!

And if by any chance you wish to see the video & article from the screenshot above. Follow the white rabbit 🐇

Home Assistant Cast

As I promised earlier I will smash the Subscribe button for my weekly Newsletter 🤣🤪😂

Now let’s continue with the Home Assistant Cast.

One of the requirements to enable the Home Assistant Cast is to have a Home Assistant installation that is accessible over HTTPS, that means to have a valid SSL certificate. Luckily, I have a detailed tutorial about that and you can follow it if you still don’t have this.

After you are ready with your HTTPS and the SSL certificate as described above, here are the steps that you need to follow:

  • Go to the Home Assistant Cast URL – https://cast.home-assistant.io (with Chrome or Edge browsers only) and enter your publicly accessible over HTTPS Home Assistant URL (sounds complicated, but it is not if you followed my guide from above).
  • Authorize yourself with your Home Assistant credentials.
  • Click on the Show Demo button to check if Home Assistant Cast is working correctly.

From now on you can cast Home Assistant Views to your Chromecast whenever you wish.

Cast Home Assistant views using a Blueprint

To better demonstrate you Home Assistant Cast, I will use one very nice Blueprint (greetings to the author – kind3r Emanuel Posescu).

The Blueprint is called Cast and re-cast a lovelace view to a Google Hub and it will help you create an automation that is casting a Home Assistan view of your choice to your Chromecast enabled device every 9 minutes. Why 9 minutes? To override the default screen saver settings.

To Import the Blueprint click on the My Home Assistant link below:

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

After you successfully import the Blueprint you can create the automation described above very easily.

Under Configuration > Blueprints > click Create Automation button.

You may wish to customise the following things:

  • Name – (optionally) you can change the name of the Automation
  • Entity – select your Chromecast device (media_player.YOUR_DEVICE)
  • Lovelace view path – Get it from Overview > three dots menu > Edit Dashboard > three dots menu > Raw configuration editor and search for “path”. Copy and paste the text after the colon of path:
  • Lovelace dashboard – you can leave it as it is.
Creating an automation from a Blueprint that will cast Home Assistant view every 9 minutes.
Creating an automation from a Blueprint that will cast Home Assistant view every 9 minutes.

After you are ready with the changes click on the Save button and manually run the automation once to check if it is working. After that, the automation will run by itself and you will be able to see your Home Assistant View every time when you are not using your Chromecast (instead of a screen saver).

Home Assistant Cast in action using a Blueprint/Automation
Home Assistant Cast in action using a Blueprint/Automation.

Cast Camera Image to Chromcast – Fail

What about an automation that will cast a camera image to Chromecast when something happens at your Home like motion sensor is activated or someone is ringing at your door?

I wanted to show you that, but unfortunately I wasn’t able to cast any jpeg (or other) still image to my Chromecast due to unknown for me reason.

My idea was to cast any image first first and then to adapt it for my security camera Image. The script I used had to cast my Frigate article thumbnail on my TV (Chromecast). But I stuck at this first step.

This below is the sample script that I used.

alias: cast frigate image
sequence:
  - service: media_player.play_media
    target:
      entity_id: media_player.chromecast
    data:
      media_content_id: image/jpeg
      media_content_type: >-
        https://peyanski.com/wp-content/uploads/2021/04/Frigate-HA-360x200-v4.jpg
mode: single

If you know what could be the reason and how to fix that – let me know in the comments! I will give you all the credits (to your social media handler if you wish) and I will change the section name from “fail” to “success” or something similar 😂

Conclusion

If you want to secure this site existence make sure that you hit the subscribe, like and bell buttons or you can become one of my Patreons.

Feel free to add me on Twitter by searching for this @KPeyanski username. You can find me on my Discord server as well.

Stay Safe and don’t forget home smart but not hard.

Thank you for watching I will see you in my next article.