Keeping my Nest Hub display alive and showing Lovelace dashboard

Hey everyone!

I’ve been wanting a Nest Hub for a while now, as a replacement for an old Nexus 7 dashboard that gave up the ghost a while back. Finally pulled the trigger over the weekend and I was excited to get started casting my Lovelace dashboard to it.

It worked beautifully using https://cast.home-assistant.io/, I could cast any tab from my default Lovelace with only minor problems (mostly some custom cards that did not seem to be supported). But my excitement lasted only as long as it took the Nest Hub to turn on photo mode. So, while it works great as a test, I really didn’t feel like casting via a website was going to be very convenient or sustainable for me.

So I started playing with service calls to test before writing an automation to handle the casting for me. To my surprise, I was getting some weird results. I could get the right view to show up by calling the service as shown below, but once Google took back over and I wanted to cast again, I ran into three problems:

  • Calling the service did nothing at all unless I woke the device up first
  • The same service call would either result in a “dashboard not found” message when specifying a view_path, OR if I changed it back to ‘0’ it would show the standard auto-generated lovelace config with everything.
  • There’s no state change in HA when the device transitions into photo mode

I also didn’t find a lot of information about this behavior here or anywhere else really, aside from the post Automatically Cast Home Assistant to Nest Hub? where I saw the technique of casting a “wrong” view, waiting five seconds, and then casting the desired view.

I also had a problem with needing to wake the thing up before casting would be successful. So I ended up adding to that automation… mine looks like this now:

  - id: '1591682005536'
    alias: Test Nest Hub
    description: ''
    trigger:
    - event: start
      platform: homeassistant
    - entity_id: media_player.kitchen_display
      platform: state
      to: 'off'
    action:
    - data:
        entity_id: media_player.kitchen_display
      service: media_player.turn_on
    - delay: '00:00:05'
    - data:
        entity_id: media_player.kitchen_display
        view_path: lovelace
      service: cast.show_lovelace_view
    - delay: '00:00:05'
    - data:
        dashboard_path: lovelace-cast
        entity_id: media_player.kitchen_display
        view_path: home
      service: cast.show_lovelace_view

The triggers never actually happen, of course (unless I restart HA – the state never transitions to ‘off’ or even ‘idle’ for me). So I set up a flow in Node-Red to trigger this automation every ten minutes and it’s been working reliably for the past day or so.`

It’s pretty simple: every ten minutes, we turn the media_player entity back on, cast the wrong view, wait five seconds, and cast the right view. The only irritating thing is if you’re trying to use the display for… well, i guess literally anything else, you have at most ten minutes to do so until the automation brings it back to lovelace. I guess I could build a condition into the Node-Red flow to see if anything else is going before triggering the automation, but realistically I don’t know how much of a problem that’s going to be.

It’s a bit of a hack, but I’m happy to have it working. I didn’t see a lot of posts on this topic so I thought I’d post here for anyone running into the same problems I did.

Also half hoping that the old adage of posting something wrong on the internet is the best way to get the right answer in case anyone is offended by the admittedly inelegant nature of my solution.

Anyway, thanks for looking, and hope someone else finds this useful, or at least interesting!

2 Likes

Have you looked at CATT? Using CATT

Yes, that was one of the other options that kept popping up, but I wanted to try native functionality first.

Maybe I’ll give it a try and see if I like it better – though while I was researching the native cast behavior, it wasn’t entirely clear that CATT would work very seamlessly in a supervised install.

I always had problems with the Cast functionality but seemed to disappear with CATT once I had played around. I’m fairly sure I had it working in a supervised install also but now on HA docker. Give me a shout if you need any help.

Thanks! CATT was simple enough to set up and start casting, but I don’t see a way to authenticate on the Nest Hub. Even if I add my local as a trusted network, HA still wants a user…

I’m borrowing someone else’s image but if you click where it says trusted providers, you should be able to log in without needing a user? It’s not always clear to see, depending on what theme you are using.

Oh wow, yeah, that was completely obscured by my theme. I did add trusted network and trusted user to the config as well, but it’s working now, thanks!

@cdybdahl,

Have you checked that when the hub takes over the old cast has been terminated ?

  • swipe down check multimedia and see if home assistant is still present ?
    because if it is still casting you get the errors you describe.

you could make a input selector what changes on the state of the hub and put that in the conditions rule of the automation so it does not trigger every 10 minutes but only when it’s in a state other then wanted.

@licky_lauda

I’m actually not seeing any state changes in HA when casting, but it do see that the cast is still “active” when the hub takes over and starts displaying photos.

The only time a state change is visible in HA is when I trigger my “keep alive” automation, and then only for the media_player.turn_on activity. Once casting begins, the hub returns to its “Off” state. It also goes to “Idle,” occasionally, but I’m not certain why…

So I guess the problem is that it’s still casting, but the device decides on its own when to start the stupid slide show instead of doing what I told it to do. I see the same behavior with CATT as well (although in that case I do not need to wake the device up). Very strange, and not sure how to work around it other than by brute force.

I’m using the ‘re-cast every ten minutes’ solution above.
I’ve noticed my Hub has had a cast firmware upgrade to 1.50.229149 (from 1.46 iirc), so I tried to disable this automation for a test. Lo and behold, it seems like the ‘stupid slide show’ after 10 minutes behaviour has stopped! Instead, the page gets reloaded every 10 minutes by itself (triggered by the Hub I presume).
Don’t sell the farm on it yet, maybe I’ve botched the experiment with some cron still running somewhere, but there is hope.

Aaaaand now it’s broken again… no clue.

Did any of you guys find a solution to this other than recasting every 10 minutes? I’ve tried “everything”, but nothing seems to be keeping it alive. I’ve tried casting other pages, pages that are not found, changing the volume, but same result: it just closes after 10 minutes. The only thing that works is touching the screen

No luck here… anybody got friends at Google?

Nej det kras