home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
3.98k stars 2.72k forks source link

Google Cast error - Unable to find a view with path [X] #4614

Closed OkhammahkO closed 2 years ago

OkhammahkO commented 4 years ago

Home Assistant release with the issue:

Home Assistant 0.101.1 (hassio)

Last working Home Assistant release (if known):

na

Operating environment (Hass.io/Docker/Windows/etc.):

hassio

Integration:

Cast (cast.show_lovelace_view)

Description of problem:

Summary: cast.show_lovelace_view will not cast a lovelace view unless you "pre-authorise" via https://cast.home-assistant.io/ . You get an error on the cast device showing Error: Unable to find a view with path [path:]

See this thread: https://community.home-assistant.io/t/google-cast-error-unable-to-find-a-view-with-path-xxxx/138180/3

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

Traceback (if applicable):

Additional information:

Haven't raise many issues, so let me know if you need more info etc.

jparthum commented 4 years ago

Are y'all retrying a few times to establish the initial connection?

Even when casting is 'working' for me, several retries are often needed initially. Sometimes I just get the white/logo screen with connected, sometimes I get the Unable to find a view with path ... error, and sometimes the View I cast appears. Typically within 5 attempts I get a successful cast, but not always. This has been the case from the very beginning for me (maybe trouble authenticating?).

However, after the initial retries with my initial View successfully cast, any/all other Views are successfully cast as quickly as I can select them (either via cast.home-assistant.io or the cast.show_lovelace_view service), navigation from the hub touchscreen is responsive, and the connection remains active and stable for days at a time. So this is what I'm referring to as 'working'.

BenWoodford commented 4 years ago

I wouldn’t classify that as “working” in that case. A lot of the usefulness comes from being able to automate casting, so having to retry multiple times isn’t terrible useful.

I’ve generally had luck with the cast site, but the service is very unpredictable.

jparthum commented 4 years ago

@BenWoodford How would you classify the ability to cast after a few retries as opposed to being unable to cast at all?

I have retries automated through Node-Red using node-red-contrib-cast. Setting msg.status to true should return msg.payload.applications[0].statusText containing the title that's configured in ui-lovelace.yaml. If it doesn't, I have it retry every 5 seconds with a 21 second timeout.

I had video feeds from my cameras automagically casting long before casting Lovelace Views was an option, and the ~5 second inherent delay in establishing cast sessions (even with no retries) was too long to be very useful for me (whatever had triggered the camera was usually gone). By establishing a casting session ahead of time, the Views with my camera feeds appear instantly when motion is detected. So having an initial delay of up to 21 seconds with every camera feed being instant is far superior to having a ~5 second delay for every camera feed, IMHO.

RCourtenay commented 4 years ago

Just throwing it in there that I have the same issue. Around the time 106.2 was released casting broke for me entirely. Until that point I had been using a startup automation to start casting. Around a week after 106.2 was released (106.4 or .5 had been released by then from memory) casting worked again as normal for 2 or 3 days. After that it broke again and has been at least partially broken since.

Around 107.x I found I can cast if I log into cast.home-assistant.io and as others have stated, basically 'pre-authenticate' my device. After doing this I can then change cast views via the HA Dev Tools. Since a reboot breaks this I can't have casting automated at startup however. I've also noticed different behaviour from trying to cast from my startup automation and the dev console.

Quick summary of the behaviour is

My other observation is that while I said the issues occurred around the time 106.2 was released, I don't believe I did any upgrade the moment I had it working for those 3 days or so and certainly didn't upgrade when it broke the second time. To me it seems like there's a cloud service failure somewhere for certain scenarios, scenarios that using cast.home-asssitant.io doesn't trigger but automations and service calls do.

ngseer commented 4 years ago
  • From the dev tools, services page, if I manually call cast either I get a view where all my custom cards are broken (non custom ones work)

Not sure if this is relevant to your case but I also had some custom cards broken while casting. It turned out that these cards had resource type JavaScript File (Deprecated) or something like that (type: js in raw config). Changing it to JavaScript Module (type: module) resolved the issue completely for me.

OkhammahkO commented 4 years ago

Hello @bramkragten , I just wanted to confirm if you believe this issue is still open/active and is clear enough for you? I am still having similar symptoms to the OP. I can provide more details if required. Thank you.

TheHomieFox commented 4 years ago

I'm having issues with casting to Google Nest Hub. First time I call the service the HA screen shows up and says 'Connected', but lovelace doesn't come up. I have to call the service again (some times several times) until it shows the dashboard.

lindsaymarkward commented 4 years ago

I would really like to know what's happening with this as well. Thanks @bramkragten for your work. I had this working mostly, then not. I've never used the cast.home-assistant URL. I changed from using the http SSL to using NGINX as a reverse proxy to serve the SSL via my duckdns.org domain (internal_url is now the IP via http), and casting and TTS to my Google Home Hub worked great! A day or two later and it stopped. The best I can do is the ❤️ screen and the error that's the title of this issue. Google Assistant and Google TTS work fine. I'm running 0.110.4 via venv on Raspbian.

Interesting points: I CAN cast the 'default_view' it seems. It doesn't look like my normal lovelace default_view and seems to have every entity on it. I was also able to get Rick Rolled by playing the youtube clip in the docs using the service: media_player.play_media and media_content_type: cast. Why aren't the 'normal' views able to be found? ... After lots of tries and tests, I called the service again with a normal view and it worked. I imagine it will stop working again soon, since I'm doing nothing different than when it didn't work a few minutes ago.

Any updates? Thanks!

bramkragten commented 4 years ago

This is hard to debug as I have to be able to reproduce it and it is kinda hit and miss with no clear sign what the problem could be.

I will look into it shortly.

lindsaymarkward commented 4 years ago

Thanks! That's what I hear on the forums and discord as well - people say it works x% of the time (x < 100). I tried again this morning and got 3 different experiences when trying to cast:

NeilDuToit92 commented 4 years ago

I tried this a few times every day for the last week and am getting the same issue 100% of the time:

Can this perhaps be caused by a timeout between the app and my HA instance? This is assuming the hub loads the view via the hosted app, and it's not a direct connection between the hub and my HA.

lindsaymarkward commented 4 years ago

@bramkragten - What do you think it means that I get a different view for default_view when I cast it? This morning I cast two custom views I've made with YAML and got the usual "unable to find error" (but it did respond first go). Then when I cast default_view, I got what I think is the auto-generated, everything-on-one-page view. @NeilDuToit92 - is this the same for you? Is your default_view specified with YAML and/or does it match your normal UI? Does this say something about where/how it's looking for views? If it only finds the one with the default name and it's not one of my actual views?

NeilDuToit92 commented 4 years ago

@lindsaymarkward default_view displays the auto generated page for me as well. I can't get it to display any other page 99% of the time. view_paths 'home' and 'dashboard' doesn't work, but 'default_view' shows the auto generate mess of things.

    cards:
      - name: Show Home on Hub
        tap_action:
          action: call-service
          service: cast.show_lovelace_view
          service_data:
            entity_id: media_player.living_room_display
            view_path: home
        theme: default
        type: button
      - name: Show Dashboard on Hub
        tap_action:
          action: call-service
          service: cast.show_lovelace_view
          service_data:
            entity_id: media_player.living_room_display
            view_path: dashboard
        theme: default
        type: button
      - name: Stop cast
        tap_action:
          action: call-service
          service: media_player.turn_off
          service_data:
            entity_id: media_player.living_room_display
        theme: default
        type: button
        entity: media_player.living_room_display
        show_icon: false
        show_name: true
      - name: Show Default View on Hub
        tap_action:
          action: call-service
          service: cast.show_lovelace_view
          service_data:
            entity_id: media_player.living_room_display
            view_path: default_view
        theme: default
        type: button

And in case anyone asks, I do have the paths set up for 'home' and 'dashboard':

...
    path: home
    title: Home
...
    path: dashboard
    title: dashboard
...
bramkragten commented 4 years ago

@NeilDuToit92 you might want to try the Lovelace Cast row instead of the service call if you don't use it in automation.

https://www.home-assistant.io/lovelace/entities/#cast

disconn3ct commented 4 years ago

@bramkragten doesn't that require using Chrome on a desktop? The service call can be triggered by a mobile device or Firefox, etc.

NeilDuToit92 commented 4 years ago

@NeilDuToit92 you might want to try the Lovelace Cast row instead of the service call if you don't use it in automation.

https://www.home-assistant.io/lovelace/entities/#cast

I want to use it in an automation, basically have zigbee button next to the Nest Hub to trigger the HA cast to it. So it's a service call on the button so I can test it before building the automation

WhimsySpoon commented 4 years ago

The process described here https://community.home-assistant.io/t/google-cast-error-unable-to-find-a-view-with-path-xxxx/138180/92 has yielded a 100% success rate for me.

It's not perfect as it still renders an error message until the second command is called five seconds later. Hopefully it might provide some clues as to the cause of the underlying issue.

bramkragten commented 4 years ago

Thanks @WhimsySpoon, that might help.

OkhammahkO commented 4 years ago

Mine seems to have taken a step backwards when testing today (was a bit excited about @WhimsySpoon 's work-around). I can't even get past the 'unable to connect to websocket API' error (rather than the 'Unable to find a view with path [X]' error). Can cast from https://cast.home-assistant.io though.

NeilDuToit92 commented 4 years ago

The user radar posted a solution on the thread linked above I removed the 5s delay he had in there and it it seems to be working for me.

- entity_id: input_boolean.test
    platform: state
    to: 'on'
  action:
  - data:
      entity_id: media_player.nest_hub
    service: media_player.turn_off
  - delay: "00:00:01"
  - data:
      entity_id: media_player.nest_hub
    service: media_player.turn_on
  - data:
      entity_id: media_player.nest_hub
      view_path: test
    service: cast.show_lovelace_view
  - data:
      dashboard_path: lovelace
      entity_id: media_player.nest_hub
      view_path: test
    service: cast.show_lovelace_view

@bramkragten if this does continue to work for me over the next 2-3 days I will update this thread. Hopefully more users can test and see if this works.

boesing commented 4 years ago

@NeilDuToit92 can confirm that this is working for me aswell! Nice catch!

NeilDuToit92 commented 4 years ago

Okay, so I have found a scenario where my previous post didn't work. When you ask the hub to play a YouTube video, then tell HA to cast, it didn't always show, updated config to add a delay and a second cast action which seems to fix it 99% of the time.

- id: cast-test
  alias: Test Nest Hub
  trigger:
  - entity_id: input_boolean.cast_dashboard
    platform: state
    to: 'on'
  action:
  - data:
      entity_id: media_player.living_room_display
    service: media_player.turn_off
  - delay: 00:00:01
  - data:
      entity_id: media_player.living_room_display
    service: media_player.turn_on
  - data:
      entity_id: media_player.living_room_display
      view_path: dashboard
    service: cast.show_lovelace_view
  - delay: 00:00:05
  - data:
      dashboard_path: lovelace
      entity_id: media_player.living_room_display
      view_path: dashboard
    service: cast.show_lovelace_view
  - entity_id: input_boolean.cast_dashboard
    service: homeassistant.turn_off
NeilDuToit92 commented 4 years ago

Without making any changes to my automation, it has stopped working again.

lindsaymarkward commented 4 years ago

Here's a new experience to add. Today, I tested one of my scripts that shows a view on the home hub and it worked :) ... but I got the error:

Custom element doesn't exist: button-card

So, it displays the stock UI elements OK (e.g. a switch), but not the custom resource one. It works fine on my web and iOS view. I see this has happened before: https://community.home-assistant.io/t/custom-element-doesnt-exist-but-only-when-casting/140458 All of my custom cards are up to date, and I'm on HA 0.112

ngseer commented 4 years ago

Here's a new experience to add. Today, I tested one of my scripts that shows a view on the home hub and it worked :) ... but I got the error:

Custom element doesn't exist: button-card

So, it displays the stock UI elements OK (e.g. a switch), but not the custom resource one. It works fine on my web and iOS view. I see this has happened before: https://community.home-assistant.io/t/custom-element-doesnt-exist-but-only-when-casting/140458 All of my custom cards are up to date, and I'm on HA 0.112

Oh I can confirm that. It happened to me just a couple of months ago in a very random manner but currently (starting from 0.111 or 0.110, I guess) it happens every time.

jtonk commented 4 years ago

Same here, docker , ngix proxy, hacs install for custom cards. Custom cards work through the browser from remote url and local url, so I guess the path is accessible. This has been haunting me occasionally prior to 0.110, but now it’s persistently failing.

lindsaymarkward commented 4 years ago

Hi @bramkragten and others. Is there anything we/I can do to help with this? I have a few automations I'm really keen to get working, but this is still "unable".

NeilDuToit92 commented 4 years ago

@lindsaymarkward, it seems like people are having more success using 'catt' to cast their lovelace dashboards. I haven't tried it myself, but it looks promising. At least until the cast component is eventually fixed it may be a good alternative.

lindsaymarkward commented 3 years ago

I see that some new work has been done for casting and stream in 0.115.6. Is there any chance that any of this helps get us closer to showing HA views on via cast? Thanks @bramkragten :)

bramkragten commented 3 years ago

We are working on some things yeah, and that also includes fixing this issue.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

SebRut commented 3 years ago

This issue is still present for me, so still relevant I guess.

StefanoGiu commented 3 years ago

Same issue

lindsaymarkward commented 3 years ago

I can confirm that nothing has changed for me - same problem. Thanks in advance, @bramkragten :)

ajitam commented 3 years ago

After some time I tried this thing again and I found out something.

I might found i workaround.

This is the "payload" I'm sending

entity_id: media_player.living_room_tv
dashboard_path: lovelace
view_path: lr-tv-dashboard

By (just) sending this nothing happens, BUT if I send "wrong" payload (for example I write dashboard_path: lovelacex < x at the end) I get "nabu casa" screen with Unable to find a view with path lr-tv-dashboard and then I fix the dashboard_path and send it again - IT WORKS

kind3r commented 3 years ago

Try using this blueprint I made to also work around the issue that the hub stops the cast after 10 min : https://community.home-assistant.io/t/cast-and-re-cast-a-lovelace-view-to-a-google-hub/259631

fgonza2 commented 3 years ago

After some time I tried this thing again and I found out something.

I might found i workaround.

This is the "payload" I'm sending

entity_id: media_player.living_room_tv
dashboard_path: lovelace
view_path: lr-tv-dashboard

By (just) sending this nothing happens, BUT if I send "wrong" payload (for example I write dashboard_path: lovelacex < x at the end) I get "nabu casa" screen with Unable to find a view with path lr-tv-dashboard and then I fix the dashboard_path and send it again - IT WORKS

yes, i found this too, that is a good workaround, for automations, it might work. The main issue i have right now is that custom cards don't work and you get a red square instead... why?

kintaroju commented 3 years ago

I'm also having the same issue too, with the latest HA install but using the OVA VM install with the HassOS.

nschwing commented 3 years ago

Can confirm that this issue is still present. The workaround from @ajitam works, thanks!

kintaroju commented 3 years ago

Yea, the workaround is the only way to be able to cast lovelace at the moment. But casting lovelace has some limitations too, eg some camera feeds can't be streamed, or some things with graphs won't/can't be shown.

lindsaymarkward commented 3 years ago

The recent 2021.4 update included: https://github.com/home-assistant/core/pull/47232 (Add support for a list of known hosts to Google Cast). Does this help/affect this issue at all? I realised from my comment a few weeks ago that I had neglected to update my external_url when it changed. Fixing this and I'm now back to this error here. I can (sometimes) cast with the workaround but it still doesn't show custom cards...

EDIT: I just found that a post in the forums from last August about manually adding duplicate resources with /local/community/ URLs allows me to see custom cards now! https://community.home-assistant.io/t/custom-element-doesnt-exist-but-only-when-casting/140458/16 (or at least so far I have it working for some but not all custom cards)

Any hope of this being sorted out in the integration without workarounds @bramkragten ? Thanks!

lindsaymarkward commented 3 years ago

Each release, I check if casting works yet... but it still doesn't. My previous workaround isn't even working. Can we get some love for this @bramkragten and others?

NeilDuToit92 commented 3 years ago

If it is too much of a struggle to get the current casting to work, it might even be worth it to look at CATT (Cast All The Things) and potentially pull that into HA core? https://community.home-assistant.io/t/using-catt/130332

I have been using it as an add-on and it's been working without issues.

fgonza2 commented 3 years ago

i gave up on casting, the lack of compatibility with the GUI and some lovelace cards + the complex DNS/SSL setup makes it a complicated effort and little value.

It is easier/cheaper to run an RPI in kiosk mode and connect to another HDMI input to TV

brentk7 commented 3 years ago

Also intermittently getting this error when casting to Nest Hub. Sometime it works, sometimes it gives the error.

RyanEwen commented 3 years ago

I believe the issue is that the desired dashboard/view is being loaded before nabu casa is REALLY ready to load it. My rationale is that an Entities card with a Cast entity in it works every time. When you use a Cast entity card, there's a delay between connecting and showing a dashboard/view, because you're required to first connect and then forced to wait before you can click Show.

Until this is fixed I am forced to do the workaround mentioned here. I'm using it in a script like so (note the x in the dashboard_path the first time:

alias: Cast Outside Cameras
mode: single
sequence:
  - service: media_player.turn_off
    target:
      entity_id: media_player.some_chromecast
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: cast.show_lovelace_view
    data:
      entity_id: media_player.bedroom_chromecast
      dashboard_path: lovelacex
      view_path: camgrid
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: cast.show_lovelace_view
    data:
      entity_id: media_player.bedroom_chromecast
      dashboard_path: lovelace
      view_path: camgrid
github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

lindsaymarkward commented 2 years ago

Every new version of HA, I give this a try. Usually it doesn't work. This time (.11), it worked - once! I was so excited... until it didn't work after the very first time. Surely the fact that it sometimes works means there's something that can be done here? It would be really valuable for me and many people. @bramkragten - are you still the right Nabu Casa person to ask to look at this? Thanks in advance.

lindsaymarkward commented 2 years ago

Thankfully, version 2021.12 seems to have solved this - I'm very happy! Does it work for others too now? Any edge cases? I do still have the Custom element doesn't exist problem, so not quite there yet...

jtonk commented 2 years ago

yes, for me casting now also works as well. I also suffered from the Custom element doesn't exist afterwards, but reinstalling the cards through HACS and a reboot of the hub solved it for most of them. I think it has to do with the ?hacstag=########## tag that needed a refresh. However I still have a couple of cards that I can't get play nice.

curious to hear what solved the timeout issue and whether it can be solved for CATT as well.