How to? Casting with service or entities card

Hi

I have a Home Assistant setup that I have managed to get working with cast.home-assistant.io.

For anyone interested I achieved it by doing the following:

  • I enabled https with the help of letsencrypt.
  • I have a local DNS forwarding in my router, that forwards subdomain.mydomain.dk to the Home Assistant server IP.
  • I have a rule in my router that redirects DNS traffic from my Google Nest Hub to my router (because Google DNS is hard coded in the Nest Hub).

While cast.home-assistant.io is working fine, I find it a bit limiting.
1: I can only cast the default “Overview” dashboard.
2: It would be nice to start a cast from a dashboard or service.

I haven’t managed to ever get casting working from either a service call or with the entities card.
I use the following to initiate the cast from a button.

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: cast.show_lovelace_view
  data:
    entity_id: media_player.nest_hub
    dashboard_path: /lovelace
    view_path: /ur
icon: mdi:cast

I´m not sure if the syntax is correct. Do I need a forward slash before the paths or not (I tried both).

Anyway, I just see the following on my Nest Hub.

Does anyone have any tips to get it working with either the card or the service?

I would be happy to supply any information needed.

Kind regards
Michael Tandrup
Denmark

Also it would be nice to be able to incorporate the cast in some sort of automation or monitoring.
For example a reinitiation of the cast if it stops for some reason.

I can’t see how that would be possible, if the cast is always initiated from cast.home-assistant.io.

I solved it.

I had to add external_url and correct address to configuration.yaml.

I guess cast.home-assistant.io doesn’t care about external_url.