Google Cast Lovelace only works once. “Session is closed”?

I’m trying to cast a lovelace dashboard to my Google hub displays (I have one original Hub and one Hub Max).

It took me a few tries to get the syntax correct in the Developer Tools ‘Call Service ‘ tab , but after a few tries I found the correct url and view path and the default_view dashboard showed up on my Google Hib Max display.

But after that, no more calls will show on the display. I created a script to cast a different dashboard to my other Google display, and that worked. But none of the buttons navigating to other dashboards worked. As with the first display, casting no longer works after that first load.

There were no errors shown for the script, but I’m getting the following in my logs

Logger: custom_components.googlewifi
Source: custom_components/googlewifi/__init__.py:171
Integration: Google WiFi Integration ([documentation](https://github.com/djtimca/hagooglewifi), [issues](https://github.com/djtimca/hagooglewifi/issues))
First occurred: 7:13:33 PM (5 occurrences)
Last logged: 7:15:33 PM

Unexpected error fetching GoogleWifi data: Session is closed

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 250, in _async_refresh self.data = await self._async_update_data() File "/config/custom_components/googlewifi/__init__.py", line 171, in _async_update_data system_data = await self.api.get_systems() File "/usr/local/lib/python3.10/site-packages/googlewifi/__init__.py", line 188, in get_systems response = await self.get_api(url, headers, payload) File "/usr/local/lib/python3.10/site-packages/googlewifi/__init__.py", line 63, in get_api async with self._session.get( File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1141, in __aenter__ self._resp = await self._coro File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 400, in _request raise RuntimeError("Session is closed") RuntimeError: Session is closed

Is there a “session” that I need to reset each time I cast a dashboard? Will that fix the issue with the navigation buttons not working or is that a separate issue (I’m guessing it’s related)

Edit: just a note, I haven’t configured any “known hosts” or “allowed UUIDs”, I’m using what’s auto discovered. If I need to do that, I’ll give it a try.

Edit #2: after installing a couple of updates, I checked again to see if a restart would reset this issue, but the dashboard still doesn’t show on the display.

Another error:


Logger: homeassistant.util.logging
Source: util/logging.py:168 
First occurred: 7:51:07 PM (3 occurrences) 
Last logged: 8:27:18 PM

Exception in _handle_signal_show_view when dispatching 'cast_show_view': (<pychromecast.controllers.homeassistant.HomeAssistantController object at 0x7f556e20e0>, 'media_player.kitchen_display', '0', 'lovelace') Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 987, in _handle_signal_show_view self._hass_cast_controller.show_lovelace_view(view_path, url_path) File "/usr/local/lib/python3.10/site-packages/pychromecast/controllers/homeassistant.py", line 128, in show_lovelace_view self._send_connected_message( File "/usr/local/lib/python3.10/site-packages/pychromecast/controllers/homeassistant.py", line 145, in _send_connected_message self._connect_hass( File "/usr/local/lib/python3.10/site-packages/pychromecast/controllers/homeassistant.py", line 107, in _connect_hass raise PyChromecastError() # pylint: disable=broad-exception-raised pychromecast.error.PyChromecastError
Exception in _handle_signal_show_view when dispatching 'cast_show_view': (<pychromecast.controllers.homeassistant.HomeAssistantController object at 0x7f5c849c60>, 'media_player.master_bedroom_display', '0', 'lovelace') Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 987, in _handle_signal_show_view self._hass_cast_controller.show_lovelace_view(view_path, url_path) File "/usr/local/lib/python3.10/site-packages/pychromecast/controllers/homeassistant.py", line 128, in show_lovelace_view self._send_connected_message( File "/usr/local/lib/python3.10/site-packages/pychromecast/controllers/homeassistant.py", line 145, in _send_connected_message self._connect_hass( File "/usr/local/lib/python3.10/site-packages/pychromecast/controllers/homeassistant.py", line 107, in _connect_hass raise PyChromecastError() # pylint: disable=broad-exception-raised pychromecast.error.PyChromecastError
Exception in _handle_signal_show_view when dispatching 'cast_show_view': (<pychromecast.controllers.homeassistant.HomeAssistantController object at 0x7f5f446740>, 'media_player.master_bedroom_display', '0', 'lovelace') Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 987, in _handle_signal_show_view self._hass_cast_controller.show_lovelace_view(view_path, url_path) File "/usr/local/lib/python3.10/site-packages/pychromecast/controllers/homeassistant.py", line 128, in show_lovelace_view self._send_connected_message( File "/usr/local/lib/python3.10/site-packages/pychromecast/controllers/homeassistant.py", line 145, in _send_connected_message self._connect_hass( File "/usr/local/lib/python3.10/site-packages/pychromecast/controllers/homeassistant.py", line 107, in _connect_hass raise PyChromecastError() # pylint: disable=broad-exception-raised pychromecast.error.PyChromecastError

Update: if I cast a video to the display, I can then cast the dashboard.

But first it shows a “Not connected” message (with the HA and Nabu Casa logos) before changing to connected and then showing the dashboard. I don’t believe it did that the first times I tried. (BTW, I’m using DuckDNS/NGINX to connect my Google account to HA)

But the navigation buttons still don’t work.