core icon indicating copy to clipboard operation
core copied to clipboard

Re-casting a dashboard causes Home Assistant Cast to break

Open jeremynoesen opened this issue 1 year ago • 1 comments

The problem

While a dashboard is already being cast to my Nest Hub (2nd gen), calling cast.show_lovelace_view with the same dashboard and view that is currently casting will cause two things:

  1. The Nest Hub will minimize the current cast and go back to the clock after like 30 seconds, and will keep doing so even when tapping on the tile again.
  2. The dashboard does not re-cast, instead the previous cast remains casting.

Re-casting is useful for when a cast service call is somehow called another time (via an automation for example), or when restarting the cast to fix issues with custom cards not loading the first time. Currently, I am calling media_player.turn_off before casting again to avoid this behavior.

When doing something similar with media_player.play_media (media already playing, playing the same media again via the service call), the media restarts normally and there are no issues.

I am unsure if this happens on other Chromecast devices, as I do not have any others.

What version of Home Assistant Core has the issue?

core-2024.1.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Google Cast

Link to integration documentation on our website

https://www.home-assistant.io/integrations/cast/

Diagnostics information

home-assistant_cast_2024-01-15T20-19-46.698Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

jeremynoesen avatar Jan 15 '24 20:01 jeremynoesen

Hey there @emontnemery, mind taking a look at this issue as it has been labeled with an integration (cast) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of cast can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign cast Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


cast documentation cast source (message by IssueLinks)

home-assistant[bot] avatar Jan 15 '24 20:01 home-assistant[bot]

Yeah, same here.

ENT108 avatar Jan 18 '24 22:01 ENT108

I've tried re-casting the same view several times to a 2nd generation Nest hub, model number GUIK2, but I can't reproduce the problem.

@jeremynoesen the log you shared only shows a single attempt to show a lovelace view

To help solve this, please enable the logs below, then reproduce the issue - i.e. cast the lovelace view twice and make sure the issue happens - and share the log

logger:
  default: debug
  default: info
  logs:
    homeassistant.core: debug
    homeassistant.components.cast: debug
    pychromecast: debug
    pychromecast.dial: warning
    pychromecast.discovery: warning
    homeassistant.components.cast.discovery: warning

emontnemery avatar Jan 19 '24 07:01 emontnemery

Sorry, the logs I posted only showed the re-cast. I will try this again with both casts and all that logging enabled within the next week.

jeremynoesen avatar Jan 23 '24 05:01 jeremynoesen

Here is my log file. At some point I casted, waited for that to load, casted again, then waited like 30 sec for the stream to minimize on the nest hub. home-assistant.log

jeremynoesen avatar Jan 23 '24 16:01 jeremynoesen

This same issue just happened to me when casting a different dashboard. This happens infrequently, while the topic of this issue happens regularly.

jeremynoesen avatar Jan 25 '24 15:01 jeremynoesen

This issue still occurs as of core-2024.3.1. There is no issue casting a different view when a dashboard is already being cast, but casting the same view again, common when an automation is firing again, causes the same behavior as described in the original issue. If more logs are needed than what was provided, please let me know.

jeremynoesen avatar Mar 19 '24 20:03 jeremynoesen

Here is my log file. At some point I casted, waited for that to load, casted again, then waited like 30 sec for the stream to minimize on the nest hub. home-assistant.log

I'm also seeing the same behaviour on a 1st gen google Nest Hub, HA Core 2024.4.3 (I can also provide logs if useful, but they look pretty similar to those attached by @jeremynoesen).

jeverley avatar Apr 15 '24 09:04 jeverley

Same issue here with first gen Google Hubs and different camera pages

mvanlijden avatar Jul 03 '24 15:07 mvanlijden

@emontnemery I keep seeing this error in my debug logging for Cast:

2024-07-10 10:06:53.702 ERROR (SyncWorker_60) [homeassistant.util.logging] Exception in _handle_signal_show_view when dispatching 'cast_show_view': ({'hass_url': 'https://snip.ui.nabu.casa', 'hass_uuid': 'snip', 'client_id': None, 'refresh_token': 'snip'}, 'media_player.hub_werkkamer', 'all', 'dashboard-cameras') Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 1031, in _handle_signal_show_view self._hass_cast_controller.show_lovelace_view(view_path, url_path) File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/homeassistant.py", line 195, in show_lovelace_view self._send_connected_message( File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/homeassistant.py", line 215, in _send_connected_message self.send_message_nocheck(data, callback_function=callback_function) File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/init.py", line 186, in send_message_nocheck self._message_func( File "/usr/local/lib/python3.12/site-packages/pychromecast/socket_client.py", line 949, in send_app_message raise UnsupportedNamespace( pychromecast.error.UnsupportedNamespace: Namespace urn:x-cast:com.nabucasa.hast is not supported by current app. Supported are urn:x-cast:com.google.cast.sse, urn:x-cast:com.google.cast.cac

My HA is up to date to latest release. Device is Nest Hub Gen 1 Fuchsia version 18.20240225.3.63 Software version: 58.102.2.613521407 Chromecast firmware: 3.73.411796

mvanlijden avatar Jul 10 '24 08:07 mvanlijden

Hello, I have the same issue, casting to Nest works for the first dashboard, subsequent casting does not work. If I restart HA then the first casting works, but noting after that. Note: only dashboard casting is impacted, casting images, for example, works just fine. Log below:

Logger: homeassistant.util.logging Source: util/logging.py:95 First occurred: 10:42:09 (11 occurrences) Last logged: 12:08:34

Exception in _handle_signal_show_view when dispatching 'cast_show_view': ({'hass_url': 'https://redacted', 'hass_uuid': 'redacted', 'client_id': None, 'refresh_token': 'redacted'}, 'media_player.google_nest_hub', '0', 'for-nest') Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 1031, in _handle_signal_show_view self._hass_cast_controller.show_lovelace_view(view_path, url_path) File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/homeassistant.py", line 195, in show_lovelace_view self._send_connected_message( File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/homeassistant.py", line 221, in _send_connected_message self._connect_hass( File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/homeassistant.py", line 144, in _connect_hass self.send_message( File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/init.py", line 148, in send_message self.launch( File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/init.py", line 97, in launch self._socket_client.receiver_controller.launch_app( File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/receiver.py", line 174, in launch_app self._send_launch_message(app_id, force_launch, callback_function) File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/receiver.py", line 229, in _send_launch_message callback_function(True, None) File "/usr/local/lib/python3.12/site-packages/pychromecast/response_handler.py", line 71, in _callback on_success(callback_function=callback_function) File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/init.py", line 186, in send_message_nocheck self._message_func( File "/usr/local/lib/python3.12/site-packages/pychromecast/socket_client.py", line 949, in send_app_message raise UnsupportedNamespace( pychromecast.error.UnsupportedNamespace: Namespace urn:x-cast:com.nabucasa.hast is not supported by current app. Supported are urn:x-cast:com.google.cast.debugoverlay, urn:x-cast:com.google.cast.cac, urn:x-cast:com.google.cast.media

turbatus avatar Jul 19 '24 10:07 turbatus

Same thing happening here.

Casting works for a few days, then suddenly breaks with the above error.

The only solution is to restart home assistant, which is rubbish

mattinglis avatar Jul 28 '24 09:07 mattinglis