Finally I managed to get a setup for cast to nest hub working (dashboard)

Tags: #<Tag:0x00007f7397dca908> #<Tag:0x00007f7397dca840> #<Tag:0x00007f7397dca778> #<Tag:0x00007f7397dca610> #<Tag:0x00007f7397dca2f0>

Ive been struggling for a long time to get a smart way to cast Lovelace to my Nest Hub. Im not an expert and Im sure its a better way, but I could not find it anywhere. So I decided to share how I did it.

In short:
I have created an integration with IFTTT to fire a script that start the cast. reason: wanted a clever way to get it started if its not already casting to the nest hub.
I also created a script that at least work to get this working (feel free to let me know if its a smarter way).

Script:

'1602435208762':
  alias: Cast Dashboard
  sequence:
  - service: media_player.turn_on
    data: {}
    entity_id: media_player.nesthub9851
  - delay: 00:00:01
  - service: cast.show_lovelace_view
    data:
      entity_id: media_player.nesthub9851
      dashboard_path: lovelace
      view_path: cast
  - delay: 00:00:01
  - service: cast.show_lovelace_view
    data:
      entity_id: media_player.nesthub9851
      dashboard_path: lovelace
      view_path: cast
  mode: single
  icon: mdi:cast

The IFTTT integration makes it possible to ask Google to cast Dashboard. This ends up in HomeAssistant as an event that triggers the script.

Just wanted to share since I have been struggling with this for quite some time.

Cheers

Petter

1 Like

Does it show your Lovelace longer then 10min?
With my settings for Catt, I must reload it every 10 min

I haven’t timed it, but it times out after probably 10 min. But then its just to ask google to cast and it comes back on. In my opinion its fine that it only shows when you ask for it :slight_smile:

IFTTT only lets you have 3 applets…

only 3 for free. but it only takes 1 to do this :slight_smile:

1 Like

Does the hub have a proximity sensor you can see in HA? otherwise you can work with a small zigbee proximity sensor which triggers the casting automation when walking up to the hub.

Does it work well, lovelace dashboard on nest hub? I’m thinking of buying 1 myself instead of mounting a tablet to the wall.

I will continue looking at different ways to start the cast i.e. Sensor.

I dont see any proximity sensor coming from the hub.

The dashboard works great on the hub

Can you please explain this? I’m trying to configure IFTTT with a webhook, but I didn’t find the right URL to lounch the cast yet…

Add the IFTTT integration to Home Assistant. Read the docs. Create an automation.

Why do you call cast.show service twice?

I did the following and I got very close to what I expect:

  • added the IFTTT Integration
  • created an automation that calls a script. Here is my automation:
- id: '1602917937379'
  alias: Call WeatherStation Script from IFTTT
  description: 'Call WeatherStation Script from IFTTT'
  trigger:
  - event_data:
      action: call_service
    event_type: ifttt_webhook_received
    platform: event
  condition: []
  action:
  - data:
      entity_id: '{{ trigger.event.data.entity_id }}'
    service: '{{ trigger.event.data.service }}'
  • the script is configured as follows:
cast_weatherstation:
  alias: Cast Weatherstation
  sequence:
  - service: cast.show_lovelace_view
    data:
      entity_id: media_player.nesthub1026
      dashboard_path: lovelace
      view_path: weather_station
  mode: single
  icon: mdi:cast

In IFTTT I have an applet triggered by a voice command which calls a web request where the body of my json post is:

{ "action": "call_service", "service": "script.turn_on", "entity_id": "script.cast_weatherstation" }

Now I can see that when I say my keyword to the nest hub it goes in cast mode, connects to home assistant but doesn’t start the lovelace tab that I configured in my view_path (weather_station). If i change that to the default lovelace tab (default_view) that one is shown, so the chain ifttt->automation->script works.
I manually configured the name weather_station in the lovelace optional URL, here is the part of the lovelace configuration that does that:

  - title: WeatherStation
    path: weather_station
    theme: clear
    badges: []
    cards:
      - type: horizontal-stack

I tried to manually call that tab via the https://cast.home-assistant.io/ web page and it works
What am I missing?
Thank you very much

Why use IFTTT? Why not using Google assistant? So you can expose a script directly? Or even make a template switch, so the button is actually visible on the hub itself to turn on the cast?

Ciao Fabio, I personally don’t need a button on the hub cause I want to call the script via voice command.
If I can avoid IFTTT I’m happy to do it, but I need the script to work properly in the first place before I think about more efficent ways to call it…

You can just expose the script to the Google home and call it by voice, or turn on a switch by voice… No additional service needed like IFTTT

You can even use routines then

This is very interesting. I use a motion sensor in my kitchen with an automation that turns on the light and says good morning on my Nest Hub. I’ve been looking to expend its functionality since the basics work very well. Being able to cast a useful view to the hub would allow me to show some relevant info for the day. Timing out after 10 minutes would be fine in my case.

1 Like

Turns out my problem (tab not being casted, only the default_view) was not only my problem but a well known and yet not resolved bug. In the meantime there is a weird workaround which I gladly write here cause it worked for me:

cast_weatherstation:
  alias: Cast Weatherstation
  sequence:
  - data:
      entity_id: media_player.nesthub1026
    service: media_player.turn_off
  - delay: 00:00:01
  - data:
      entity_id: media_player.nesthub1026
    service: media_player.turn_on
  - data:
      entity_id: media_player.nesthub1026
      view_path: weather_station
    service: cast.show_lovelace_view
  - delay: 00:00:05
  - data:
      dashboard_path: lovelace
      entity_id: media_player.nesthub1026
      view_path: weather_station
    service: cast.show_lovelace_view
  mode: single
  icon: mdi:cast