Google Nest Hub as Dashboard with DashCast add-on

Edt: Try the official Google Cast before you use this method. It’s easier, has less issues, and has official support by Home Assistant.

Edit: check out GitHub - chiahsing/nest_hub: Home Assistant pyscript for using Nest Hub as a dashboard for the pyscript version.

Not sure why this approache is not mentioned enough. When I searched online, the most mentioned approach is to use catt or Nabu Casa. But I found that using DashCast add-on (GitHub - AlexxIT/DashCast: DashCast component for Home Assistant) is even simpler. My setup:

Device: Google Nest Hub (2nd gen)
Add-on: DashCast

configuration.yaml

homeassistant:
  auth_providers:
    - type: homeassistant
    - type: trusted_networks
      trusted_networks:
        - 10.1.1.5  # my Google Nest Hub IP
      trusted_users:
        10.1.1.5: <user id> 
      allow_bypass_login: true

Script:

alias: Cast Dashboard
sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ state_attr('media_player.nesthub', 'app_name') != 'DashCast' }}"
        sequence:
          - service: media_player.volume_set
            data:
              volume_level: 0
            target:
              entity_id: media_player.nesthub
          - service: dash_cast.load_url
            data:
              entity_id: media_player.nesthub
              url: http://url/to/dashboard
              force: true

The script cast the URL to the nest hub if the nest hub is not already running DashCast.

And to make it even more reliable, add an automation:

alias: Recast Dashboard
description: ""
trigger:
  - platform: template
    value_template: "{{ state_attr('media_player.nesthub', 'app_name') != 'DashCast' }}"
condition: []
action:
  - service: script.1662992499922  # The script above
    data: {}
mode: single

This automation is useful for using the device as a dedicated dashboard and does nothing else. The automation calls the script whenever the device is not showing the dashboard. Basically, you will get a sub-second response time whenever the device is accidentally swiped back to the idle page or being used for anything else.

I also have a couple of useful custom components installed: Kiosk Mode ( GitHub - maykar/kiosk-mode: 🙈 Hides the Home Assistant header and/or sidebar), ha-catt-fix (GitHub - swiergot/ha-catt-fix: A solution for the timeout issue when casting Home Assistant using CATT), Swipe Navigation (GitHub - zanna-37/hass-swipe-navigation: ↔️ Swipe through Home Assistant Dashboard views on mobile.). These together all make the Google Nest Hub dashboard even better.

Edit: See the comment below for a pyscript verison.

16 Likes

How did you add this add-on. I have an error all the time. The script / test service could not be called. Unable to find service dash_cast.load_url

It is not actually an addon. It is a custom integration and the instructions to install it are the first link in post 1 above.

Looks like you missed this step GitHub - AlexxIT/DashCast: DashCast component for Home Assistant

Now it works, I forgot to add an entry to configuration.yaml

Thanks a lot for your work but how do I get the trusted user id?

homeassistant:
  auth_providers:
    - type: homeassistant
    - type: trusted_networks
      trusted_networks:
        - 10.1.1.5  # my Google Nest Hub IP
      trusted_users:
        **10.1.1.5: <user id>** 

And how do I know the script-ID:

alias: Recast Dashboard
description: ""
trigger:
  - platform: template
    value_template: "{{ state_attr('media_player.nesthub', 'app_name') != 'DashCast' }}"
condition: []
action:
  - service: **script.1662992499922  # The script above**
    data: {}
mode: single
1 Like

Open your Home Assistant instance and show your users. - Click on the username and the ID is in the popup.

Open your Home Assistant instance and show your scripts. click on the script, then in the overflow menu click information and get its entityid in the Settings tab.

Oh wow this seems to work way Easier than CATT using the shell command.

Also the combination of the Catt-fix and the swipe navigation to navigate between dashboards is awesome!

Instead of the script I configured an automation based on a blueprint I used to have for the home assistant cast. Since I’m also using the Google hub for sending commands to home assistant and playing music etc.
It requires some tinkering and testing, if the automation is good I’ll share it here!

1 Like

Does one need to get DuckDNS or something before doing this?
Are you able to use the Nest Hub for it udual things, and have the dashboard as a menu?

For example, when touching nest hub I get usual things like “my afternoon” “media” an so on at the top.
Would have loved to have the HA dashboard as an option up there :smiley:

I believe using an IP address also works, but I never tried. I have my own domain name. In my case I just use the Nest Hub as a dedicated dashboard. You won’t be able to put an icon in the native Nest Hub interface to summon the dashboard. However, you should be able to use a voice command to do that if you have Google Assistant integration setup and spend some time tweaking it. One thing I tried was to put a Zigbee button next to it, and write an automation to cast the dashboard when the button is pressed. The latency is around 5 to 8 seconds. It’s not good, but tolerable.

When I try to create the script, as you shared in your first post, I get an error of Message malformed: extra keys not allowed @ data['sequence'][0]['sequence'] … so I’m clearly indenting improperly, but I’m not sure where/how to fix it. Here’s what I have.

alias: Cast Dashboard
sequence:
  - choose:
      - conditions:
          - condition: template
             value_template: {{ state_attr('media_player.nesthubmaxf32f', 'app_name')
             != 'DashCast' }}
        sequence:
          - service: media_player.volume_set
            data:
              volume_level: 0
            target:
              entity_id: media_player.nesthubmaxf32f
          - service: dash_cast.load_url
            data:
              entity_id: media_player.nesthubmaxf32f
              url: http://myipaddress:8123/lovelace/kitchen-cast?kiosk
              force: true
mode: single
icon: mdi:cast

Anything sticking out at you as something obviously wrong?

For giggles, I tried running both my script and yours through YAML Validator Online and both fail at line 6. Up at the validator it says: missed comma between flow comment entries. Down beneath, it says: Unexpected characters () !=‘DashCast’ }}

Your indentation is wrong.

I gave up on this. Doesn’t matter how many times I tried fixing the indentation (and I copied it verbatim from that original post) … DashCast on it’s on, for me, will play for as long as I want it to, with no interruptions, so recasting it is redundent.

no you did not.

Why don’t you just use the UI to set up the automation?

1 Like

Actually I did, and then changed it, and tried several other things. But thanks for your kindness.

What he said was not inappropriate, but calling him a dick is.

Anyways, the original post is missing quotes around the template and any amount of copy/paste/alter will not work.

- condition: template
  value_template: "{{ state_attr('media_player.nesthubmaxf32f', 'app_name') != 'DashCast' }}"

oh! I am sorry if I was missing some quotes. I was probably modifying the config before posting it here, but didn’t really check the validaity of it. Sorry for the confusion. But for what it is worth, below is what I am using now. I added a 20-second delay before the next re-casting if the Nest Hub became unavailable/offline. This is because casting right after Nest Hub boots up usually will fail (even though the state of the media player shows that it is showing the dashboard, it is not.)

  input_boolean:
    study_nest_hub_boot_delay:
      name: Study Nest Hub boot delay
      icon: mdi:television-off

  automation:
    - id: "study_nest_hub_recast"
      alias: "[nesthub] Study Nest Hub recast"
      description: ""
      trigger:
        - platform: state
          entity_id:
            - media_player.study_nest_hub
          to: "off"
      condition: []
      action:
        - choose:
            - conditions:
                - condition: state
                  entity_id: input_boolean.study_nest_hub_boot_delay
                  state: "on"
              sequence:
                - delay: "00:00:20"
                - service: input_boolean.turn_off
                  data: {}
                  target:
                    entity_id: input_boolean.study_nest_hub_boot_delay
        - service: media_player.volume_set
          data:
            volume_level: 0
          target:
            entity_id: "{{ trigger.entity_id }}"
        - service: dash_cast.load_url
          data:
            entity_id: "{{ trigger.entity_id }}"
            url: https://your-url:8123/
            force: true
      mode: single

    - id: "study_nest_hub_offline"
      alias: "[nesthub] Study Nest Hub offline"
      description: ""
      trigger:
        - platform: state
          entity_id:
            - media_player.study_nest_hub
          to: unavailable
      condition: []
      action:
        - service: input_boolean.turn_on
          data: {}
          target:
            entity_id: input_boolean.study_nest_hub_boot_delay
      mode: single

Another issue with this approach is that using DashCast is not an officially supported approach for casting HA dashboards. The officially supported approach is https://cast.home-assistant.io/ or , although I find it more difficult (i.e. more issues to solve) to use than this.

One particular drawback for using unofficially supported approach is that you may find unexpected bugs. Recently I just encountered an issue that when https is used, sensor cards won’t work (Sensor Card doesn't show in Google Nest Hub · Issue #14465 · home-assistant/frontend · GitHub). So if you run into problems, you may want to try https://cast.home-assistant.io/ or Google Cast - Home Assistant.

Hi,

I was following the above mentioned ways to have it work in my home and it continued to fail until
I got my nest_hub out of the group that was setup in the group in google home app.
@chicknlil25 You may want to try that if your nest_hub is included in a group that you have made.

So it works now, but there is something weird happening with the integration.
When I fire dash_cast.load_url, it would turn on dastcast on every nest device in the network.
The dashboard is casted only to nest_hub but dastcast would appear “idle” in every nest device.

So it means that the volume is set to 0 with the above script, to avoid the “boing” sound on
the nest hub but still that prompt sound comes out from other nest devices.
I can script that to set volume to 0 for all the devices on the network, but what is the point to
consider a non-targeted device?
I have 2 other nest mini devices, which is paired as a stereo speaker and those 2 actual and
1 virtual device have all their app_name as dashcast and the state is “idle”.

This won’t happen when I separately use catt to cast the dashboard to the targeted device.

Do you guys have multiple nest devices in the network?

I have 3 Nest Hub actually. This doesn’t happen to me. Maybe you want to check trigger.entity_id in automation trace to see what’s going on? On the other hand, you can try to duplicate the automation for each device and hard-code the entity_id (instead of relying on the trigger object) and see if that fixes your issue.

@chiahsing
Thanks for your suggestions. I will then try to identify the cause on my end.

Update:
I have checked and the script in the beginning would trigger dashcast on other devices but will not
come out with the prompt sound.
But if I put the content of the script in the automation, it would trigger the prompt sound from a untargeted device.
Will check more, but I am kinda clueless of what is happening here.