Automatically Cast Home Assistant to Nest Hub?

Hello, I was wondering if anyone knows a way I can make an automation like when the Nest hub is playing nothing for 1 minute it casts lovelace with Home Assistant Cast. Thanks in advance.
Edit: now there is a cast.show_lovelace_view but thanks.for helping me

3 Likes

have an automation that triggers on nest hub not playing for 1 min. you can use idle or off or both (e.g. not playing):

  trigger:
    - platform: state
      entity_id: media_player.nest_hub_media_player_name
      to: 'off'
      for:
        minutes: 1
    - platform: state
      entity_id: media_player.nest_hub_media_player_name
      to: 'idle'
      for:
        minutes: 1
2 Likes

And what should the action be like?

1 Like

I don’t know, that’s what I’m trying to figure out :sweat_smile:

Good point. Don’t think the cast service had been added to ha yet. For now you can only manually call it for now. More info here

1 Like

I have now been able to put this in an automation but I cannot find any appropriate trigger. Anyone got any ideas?

- alias: Cast to Hub
  trigger: 
    platform: state
    entity_id: media_player.hub
    to: 'idle'
    for:
      minutes: 1
  action:
    service: cast.show_lovelace_view
    data: 
      entity_id: media_player.hub
      view_path: hub

When I cast the state does not change on the Hub on Home Assistant. It just states Idle no matter what. :slight_smile:

2 Likes

Well, what are you trying to achieve? When do you want to cast something? This is what will define your trigger…

I want it to cast always. So if for instance home assistant or the hub is restarted then I want the cast to restart.

1 Like

ok, then try this:

  trigger:
    - platform: homeassistant
      event: start
1 Like

Thanks :slight_smile: I will do that! @lolouk44

Could you please post a working automation code example ? Thanks

2 Likes

Isn’t the trigger nest hub being idle? Did you managed to get it working? I’m looking also for a solution to have ha cast to nest hub always or at least when it’s idle. Currently I am able to cast to nest hub, but then the cast stops

No I never found a good way to do ut, just using the GUI for now. Will look into this again though.

Playing around with this myself, but I found something odd. When casting home assistant the status of the hub never changes from off which is odd.

The Google Home app recognized that it’s playing, hut not HA.

Where did you add that part in the code? When i replace the platform: state to homeassistant and add an extra line for the event (start) it doesn’t validate it. Do you have an example? :slight_smile:

add this to your automation.
It states that the trigger is when homeassistant starts
Can you share your automation?

This is my automation, it is starting successfully now. But i get an white screen and no loading screen or something:

- id: '1590166358190'
  alias: test
  description: test
  trigger:
  - event: start
    platform: homeassistant
  - entity_id: media_player.nesthub1288
    for: 00:01:00
    platform: state
    to: idle
  condition: []
  action:
    service: cast.show_lovelace_view
    data:
      entity_id: media_player.nesthub1288
      dashboard_path: lovelace
      view_path: woonkamer

I think i need the dashboard_path also - my url is like https://example.hass.org/lovelace/woonkamer

There is a problem to cast Lovelace views from the cast function. Only default_view or ‘0’ will work for now.

You can test this when using the following:

    data:
      entity_id: media_player.nesthub1288
      view_path: '0'

I hope Lovelace views can be send through the cast function.
For now when sending other Lovelace view, we see the message Google Cast error - Unable to find a view with path xxxx

Other links where problems was submitted are:
Cast stop working in 106.2

I’m having the same issue.

HA shows the hub as idle for a few seconds, and then shows it as off, even when casting.

I’m also seeing the cast working for about 10 mins, and then it just stops.

Everything was working great until I updated to the latest version of HA.

Any idea what’s going on? I checked the ticket in GitHub but it was closed and reading through it didn’t provide a solution.

That’s quite a bummer, was considering buying a hub and speaker in a nice deal. But this is holding me back now. Is this really a bug, or Google closing down the nest ecosystem for external integration even more?