Casting Lovelace to chromecast

I am trying to make use of some of the newer features of home assistant to simplify my setup. I am having issues casting lovelace windows to a chromecast. I can cast media, videofeeds and audio without issue. When I try and cast a lovelace dashboard, the screen goes white and I get an error in the logs.

Unfortunately, I’m at a loss on where to go from here to resolve it. I have an external address and SSL etc all working fine. The log error is posted below. Can anyone explain what is going wrong, and, even better, how to fix it?

Logger: homeassistant.util.logging
Source: util/logging.py:114
First occurred: 18:11:50 (1 occurrences)
Last logged: 18:11:50

Exception in _handle_signal_show_view when dispatching ‘cast_show_view’: (<pychromecast.controllers.homeassistant.HomeAssistantController object at 0x7f9b287be5e0>, ‘media_player.house’, ‘0’, ‘lovelace-cast’) Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/components/cast/media_player.py”, line 945, in _handle_signal_show_view self._hass_cast_controller.show_lovelace_view(view_path, url_path) File “/usr/local/lib/python3.9/site-packages/pychromecast/controllers/homeassistant.py”, line 118, in show_lovelace_view self._send_connected_message( File “/usr/local/lib/python3.9/site-packages/pychromecast/controllers/homeassistant.py”, line 129, in _send_connected_message self._connect_hass( File “/usr/local/lib/python3.9/site-packages/pychromecast/controllers/homeassistant.py”, line 102, in _connect_hass raise PyChromecastError() pychromecast.error.PyChromecastError

I can’t help you on either count. However, I sometimes get the same error but not always. I cast a lovelace view to my bedside clock (Google Home) whenever it’s not casting something else. Sometimes when I go into the bedroom I see the display is white. I got the error for the 4th time today at 2:07:04, and my code shows that a Node-Red “wait until” node fired (configured to fire if the clock is not “playing” for 30 seconds), and that the status was “off”. This triggers it to cast again, so now an hour later it’s still fine.

I also log some of the state changes, but not all. At 2:06:23 it went from “playing” to “off”, and then at 2:07:07 it went from “unavailable” to “playing”. Given the error occurred between these times, I’m guessing that it’s occurring when casting to a device that goes unavailable.

So this may only be useful info to you if your cast device is going unavailable a lot.

Regardless, I’ve read of other people recasting every 9 minutes to avoid some presumed 10 minute limit, but I have not found that necessary.