Cast and re-cast a lovelace view to a Google Hub

Hi.

I struggled with the same error. In your case, these setting should work (at least they work for me);
dashboard_path: lovelace
view_path: oversikt

In yaml:

          - service: cast.show_lovelace_view
            data:
              dashboard_path: lovelace
              entity_id: media_player.<put your media player name here>
              view_path: oversikt

I personally had the dashboard path wrong causing the “can’t find view named xyz” error on google nest hub display. So the error message was a bit misleading in this case.

1 Like

I’m also having the same problem where the background of my lovelace view cast on the Google Nest Hub is light but the rest of the UI is dark (when the Google Nest Hub is set to dark theme).

I’m using the default theme (no theme) but this is also an issue when using other dark mode themes (obtained via HACS), the background just isn’t being set or changed from white.

If you manually switch the Display Theme to Light (swipe up on the Google Nest Hub > Settings > Display) and then back to Dark the background will change to be dark (this fixes the problem, but requires manual interaction).

Is there a way to remotely change the Display Theme of the Google Next Hub or some other way to fix this problem?

Thanks! It makes more sense now. Changing the Nest Hub display to dark or light will fix the background accordingly. Not perfect but better than “random” behaviour that obviously was caused by “auto mode” setting I had selected on one of my Hubs.

I’d also like to hear if you can set the background color remotely e.g. via HA automation.

Br,
Mikko

I’d also like to hear if you can set the background color remotely e.g. via HA automation.

I have the dark theme “Backend-selected” selected in my profile, and it shows up in my Nest. It was a while ago when I set it up though so I don’t remember for sure what I had to do to make it work. I have an automation to set the theme at startup which may have something to do with it, so I’ll share that here in case it helps.

alias: Set theme at startup
trigger:
  - platform: homeassistant
    event: start
action:
  - service: frontend.set_theme
    data:
      name: ios-dark-mode-blue-red

That was helpful. Thank you.

While still not an ideal solution (and I’d argue this background issue is a legit bug worthy of a fix), this script will cause the background to flip to dark (I’m running my Google Nest Hubs in Auto Light/Dark mode and this only changes it when Dark mode is active).

I’ve got the iOS Dark mode themes installed (via HACS), but I’m only using it to cause the background to change, then I flip back to the default theme.

Script to force the background color to change to dark on a Google Nest Hub (if in dark mode):

alias: Fix Google Nest Hub Display Mode
sequence:
  - service: frontend.set_theme
    data:
      name: ios-dark-mode-dark-blue
      mode: dark
  - delay:
      seconds: 1
  - service: frontend.set_theme
    data:
      name: default
      mode: dark
mode: single
icon: mdi:theme-light-dark
1 Like

For me everything is working suddenly. I discovered that some lovelace layouts and cards bring everything to fail.
I then started with a blank one and added card by card. Now everything is fine by now.

Also I use the dashboard 0 and not a named one.

Love this, thanks! Is there any risk of burnout with casting this display 24/7?

trying to cast a lovelace view containing a webpage card with an http: address (another device on my network) to a google nest hub. catt is having the 30 second timeout problem; will the home assistant cast allow me to cast the lovelace view with a card containing an http website ? thanks

How do you stop the casting?
Mine is stuck with the casting

For me after the update there are some problems with this blueprint.
It looks like there is always some backdrop running.

conditions:
- condition: or
conditions:
- condition: state
entity_id: media_player.flurscreen
state: ‘off’
- condition: state
entity_id: media_player.flurscreen
state: paused
for: ‘00:00:20’

Is not true and the automation not starting

I had the same issue. Before HA 2022 update, the state of Nest Hub when not doing anything was ‘off’. After 2022 update, this state has changed to ‘idle’. So I copied the blueprint and modified it, replacing the two occurrences of ‘off’ with ‘idle’. I then pointed my automation to the new blueprint, and now it works again.

Can you republish the blueprint or create a PR so we can also use it? :slight_smile:

I’m new to this, so not sure how to re-publish, but here is the blueprint I now use. Note only 2 changes, from off to idle

blueprint:
  name: Cast to Google Hub v2
  description: Cast a lovelace view to a Google Hub. This tries to bypass the 10 min
    timeout for the picture frame by re-casting every 9 min
  domain: automation
  input:
    player:
      name: Google Hub
      description: Google Hub or Chromecast device to cast to
      selector:
        entity:
          integration: cast
    view:
      name: Lovelace view path
      description: Path of the view to cast. A path has to be defined in your Lovelace
        YAML for each view, as outlined in the views documentation.
    dashboard:
      name: Lovelace dashboard
      description: Path to lovelace. Defaults to 'lovelace' if empty.
      default: lovelace
  source_url: https://community.home-assistant.io/t/cast-and-re-cast-a-lovelace-view-to-a-google-hub/259631
trigger:
- platform: state
  entity_id: !input 'player'
  to: 'idle'
  for: 00:00:20
- platform: state
  entity_id: !input 'player'
  to: paused
  for: 00:00:20
- platform: time_pattern
  minutes: /9
- platform: time_pattern
  minutes: '0'
action:
- choose:
  - conditions:
    - condition: or
      conditions:
      - condition: state
        entity_id: !input 'player'
        state: 'idle'
      - condition: state
        entity_id: !input 'player'
        state: paused
        for: 00:00:20
    sequence:
    - service: media_player.volume_mute
      data:
        is_volume_muted: true
        entity_id: !input 'player'
    - service: media_player.turn_off
      data:
        entity_id: !input 'player'
    - delay:
        seconds: 2
    - service: media_player.turn_on
      data:
        entity_id: !input 'player'
    - service: cast.show_lovelace_view
      data:
        view_path: !input 'view'
        dashboard_path: !input 'dashboard'
        entity_id: !input 'player'
    - service: cast.show_lovelace_view
      data:
        view_path: !input 'view'
        dashboard_path: !input 'dashboard'
        entity_id: !input 'player'
    - delay:
        seconds: 10
    - service: media_player.volume_mute
      data:
        is_volume_muted: false
        entity_id: !input 'player'

They changed it back to off instead of idle. Thanks for your script :slight_smile:

Hi! How do you deal with the situation when the lovelace is casting (the state is “playing”) but the Hub shows anything but the lovelace? so the lovelace is something like minimized

If you wait, it’ll be brought to the front. At least it has for me. I think at the 10 minute timeout though. I wish there was a way to force it. I haven’t found a way.

no it won’t. it can run in the background for hours

There seems to be a problem with this blueprint after the upgrade to 2022.4.0 and 2022.4.1
Not working reliably at all…

3 Likes

I’m also seeing some issues after update. I suddenly find my nesthub not showing the lovelace view. When I check the status of the nesthub using Developer Tools, it says ‘playing’ even though the nesthub is actually idle. So the blueprint/automation won’t fire. This looks to be an issue with the HA → Chromecast integration to me.

I think it is a bit of both. Please see my suggestion for an update to the blueprint in the thread for my report against the cast integration since I have it working now:

1 Like