Google Cast error - Unable to find a view with path xxxx

Trying out the Google cast function by making a card for the front end.

I have,

type: entities
title: Entities card sample
entities:
  - type: call-service
    icon: 'mdi:hass:television'
    name: Chromecast
    action_name: launch
    service: cast.show_lovelace_view
    service_data:
      entity_id: media_player.family_room_tv
      view_path: Lights

But I get an error stating ‘Unable to find a view with path Lights’. I’m assuming the path is a Tab name in Lovelace UI? I have tried some of my other Tab name, and get the same error. What am I doing wrong??

Edit: I should say that it works normally, if I go via the url method via https://cast.home-assistant.io/
cheers

1 Like

Hi,

I have the same problem here. No errors in the logging.
How to debug this ?

Same-same with services tool:

Update: When I cast a path of 0,1,2,3 etc, the corresponding "non-lovelace’ view shows ok.
Maybe you need to somehome set Lovelace as the default view or something first on the device?
Or maybe it doesn’t work in with lovelace .yaml mode?
I’m just wildly speculating…

I had the same problem and I found a solution.
I edited the tab in the lovelace view and I set not only “name” but also “URL path”

name:Lights
URL path:Lights

And it’s casting now with your code.

Mine starting working using your approach after i also reauthorised via https://cast.home-assistant.io/ . It only works for the views where I’ve done as you’ve suggested…

Cheers.

You are right. I have checked that, and mine also works only after authorisation via https://cast.home-assistant.io/

When starting the cast from the cast.home-assistant.io site and then using the cast.show_lovelace_view command with lovelace maps the function is working.

But when starting the launcher directly from the command " cast.show_lovelace_view " then i can only use the “states” views. Lovelace views will say "Error: Unable to find a view with path "

2 Likes

Same with me. I have tried all combinations: /lovelace/name_of_the_view, /name_of_the_view, with or without starting slash or ending slash, nothing. And the manual cast (the one from 98.x) still works fine.

I have an additional question - how to stop casting the view from a service. Is it possible? I know I can stop the cast from media_player service - is it correct way to do this?

Same here, the cast is not working

title: Impresora 3d
icon: 'mdi:printer-3d'
path: impresora
cards:
- entities:
    - entity: binary_sensor.octoprint_printing
    - entity: sensor.octoprint_actual_bed_temp
      name: Temperatura cama
    - entity: sensor.octoprint_actual_tool0_temp
      name: Temperatura extrusor
    - entity: sensor.octoprint_current_state
      name: Estado
    - entity: sensor.octoprint_job_percentage
      name: Porcentaje impresion
    - entity: sensor.octoprint_time_elapsed_format
      name: Tiempo trancurrido
      icon: mdi:clock-start
    - entity: sensor.octoprint_time_remaining_format
      name: Tiempo restante
      icon: mdi:clock-end
  show_header_toggle: false
  title: Impresora 3D
  type: entities

- camera_image: camera.octoprint
  entity: binary_sensor.octoprint_printing
  type: picture-entity
  
- type: horizontal-stack
  cards:
  - type: 'custom:mini-graph-card'
    entities:
    - entity: sensor.octoprint_actual_bed_temp
      name: Cama
    line_color: red
    font_size: 75
    animate: true
  - type: 'custom:mini-graph-card'
    entities:
    - entity: sensor.octoprint_actual_tool0_temp
      name: Extrusor
    line_color: green
    font_size: 75
    animate: true

1 Like

I also can’t get this to work. The error goes away but I just get the Home Assistant love Nabu Casa logos and it shows “connected” but that’s it. It never shows a view.

Same problem here,
using the https://cast.home-assistant.io/ all works fine, cast.show_lovelace_view doesn’t…

Yes this works, but like you said, we need to establish a connected via the ‘old’ way first. Once this is done, you can connect via the front end.

But this way we can’t use this in an automation, or I’m wrong?

Not sure what you mean by automations? I had a quick play in Node Red, as an automation to get the cast started and it worked easily using
call service node, the right device and this as the data:

"entity_id": "media_player.family_room_tv",
"view_path":"default_view"

Simple: Starting from scretch without using the cast.home-assistant.io website is not working. That he means by automations

yes, exactly that

I confirm the problem too. It only works if you previously get authorised via https://cast.home-assistant.io/ , or it can cast “old” views, but not Lovelace views.
Hopefully this will get fixed :slight_smile:

2 Likes

Ok, I understand now. I think so far in my limited testing you only have to connect once the ‘old way’ and then the cast function from the front end seems to work thereafter every other time. I suspect and will need to test, if the ‘old way’ via the URL will need to be used once again after a restart of Chromecast device before can use the front end?

I had it working via the front end, but when it ran from an automation it failed. Do I need to authorize it via the raspberry pi it is running on? If so, that will require me to install the desktop tools and chrome and I am running the pi in minimal mode.

I can confirm what you are saying @vasseurf.
If i cast using https://cast.home-assistant.io/ the correct views are shown and with the latest configs.
But if i use developer tools or with an automation, i can only get defalut_view to work, and some really old version of it aswell.
I have tried both with yaml-mode and normal config-mode, same result when using developer tools.