Home Cinema Automations with Home Assistant and Chromecast

TV Unit with automated LED strip and Google Home

The addition of Chromecast to my setup has opened up even more automation opportunities. In particular, to improve the movie watching and media consumption experience.

These automations add a nice touch to your home cinema, allowing automatic light dimming based on Chromecast’s current state.

Refer to the Google Cast documentation on Home Assistant’s website to setup your Chromecast with Home Assistant.


Kitchen Multi-Timer Pro

Now you’re cooking

Multi Timer Pro is your ultimate meal prep companion, keeping track of multiple cooking times and making adjustments on the fly. Give it a try today and become a better home cook!


Check what entity id is assigned to it by opening the known_devices.yaml file after a server restart.

The following automation use the state component to trigger automations based on the state of the chromecast. Your chromecast can be in 3 states: idle, playing,paused and we can write automations that take advantage of these states.

- alias: Media player paused
  trigger:
    - platform: state
      # entity_id: media_player.plex_web_chrome
      entity_id: media_player.tv
      to: 'paused'
  condition:
    condition: template
    value_template: "{{states.media_player.tv.attributes.media_content_type != 'music' }}"
  action:
    service: light.turn_on
    entity_id: light.living_room_table_lamp


- alias: Media player idle
  trigger:
    - platform: state
      entity_id: media_player.tv
      to: 'idle'
  condition:
    condition: template
    value_template: "{{states.media_player.tv.attributes.media_content_type != 'music' }}"

  action:
    service: light.turn_on
    entity_id: light.living_room_table_lamp

- alias: Media player playing
  trigger:
    platform: state
    entity_id: media_player.tv
    to: 'playing'
    for:
      seconds: 5
  condition:
    condition: template
    value_template: "{{states.media_player.tv.attributes.media_content_type != 'music' }}"
  action:
    - service: media_player.turn_off
      entity_id: media_player.soundtouch
    - service: light.turn_off
      entity_id: light.living_room_table_lamp

MY MISSION

This blog started nearly 10 years ago to help me document my technical adventures in home automation and various side projects. Since then, my audience has grown significantly thanks to readers like you.

While blog content can be incredibly valuable to visitors, it’s difficult for bloggers to capture any of that value – and we still have to work for a living too. There are many ways to support my efforts should you choose to do so:

Consider joining my newsletter or shouting a coffee to help with research, drafting, crafting and publishing of new content or the costs of web hosting.

It would mean the world if gave my Android App a go or left a 5-star review on Google Play. You may also participate in feature voting to shape the apps future.

Alternatively, leave the gift of feedback, visit my Etsy Store or share a post you liked with someone who may be interested. All helps spread the word.

BTC network: 32jWFfkMQQ6o4dJMpiWVdZzSwjRsSUMCk6

These automations turn a lamp on and off depending on Chromecasts playing state. The lamp is a placeholder as I am working on a LED controller for common anode RGB LED strips to replace the cheap remote control controller that came with my RGB LED strip. I added a condition to my autmations using the condition template component, because I realised my actions would execute not only for movies and youtube videos (‘video’ content type) but also when casting music through Spotify. The conditions stop these automations from happening when casting music.

Feel free to adapt to your needs, I thought I should include it in case you find it useful.

Related posts

Troubleshooting Asus Xonar U7: Blinking LED and Connectivity Issues

Cheap Wifi MQTT Controlled LED strip using Tasmota and Home Assistant

Integrating Mi/QingPing BLE sensors into Home Assistant without a Gateway

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More