home-assistant/core

Plex: Sorry, something went wrong... when i try to cast

Closed this issue · 12 comments

The problem

Hi,
when i want to cast a movie from my plex libary to a google cast device, i see an error on google hub :

What could be wrong?

thnx in advance

image

What version of Home Assistant Core has the issue?

core-2021.11.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Plex

Link to integration documentation on our website

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

Example YAML snippet

test_cast:
  alias: "TEST Cast Plex to Chromecast"
  sequence:
  - service: media_player.play_media
    target:
      entity_id: media_player.google_hub
    data:
      media_content_type: movie
      media_content_id: 'plex://{"library_name": "Movies", "title": "Dune"}'

Anything in the logs that might be useful for us?

No error in log , debug not enabled yet, what component should i enable?

Additional information

No response

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

Can you test against a native or web Plex client to ensure this payload plays on non-CC devices correctly?

hi, yes that works , only not on a cast device like google hub max or chromecast ?

Does any Plex media play on the CC device?

Where are HA, Plex server, and the CC device in relation to each other on the network? Same subnet, different VLANS, behind firewalls, etc?

tried other media , same issue, did enable some logging:

    homeassistant.components.cast: debug             
    homeassistant.components.cast.media_player: debug
    pychromecast: debug                              
    pychromecast.socket_client: debug
    homeassistant.components.plex: debug
    homeassistant.components.plex.server: debug  

but dont see any error in log?

`2021-11-10 16:01:54 INFO (SyncWorker_12) [pychromecast.controllers] Receiver:Launching app 9AC194DC
2021-11-10 16:01:54 DEBUG (SyncWorker_12) [pychromecast.socket_client] [Google Hub(192.168.0.185):8009] Sending: Message urn:x-cast:com.google.cast.receiver from sender-0 to receiver-0: {'type': 'LAUNCH', 'appId': '9AC194DC', 'requestId': 20}
2021-11-10 16:01:54 DEBUG (Thread-6) [pychromecast.socket_client] [Google Hub(192.168.0.185):8009] Received: Message urn:x-cast:com.google.cast.receiver from receiver-0 to *: {'requestId': 0, 'status': {'userEq': {'high_shelf': {'frequency': 4500.0, 'gain_db': 0.0, 'quality': 0.707}, 'low_shelf': {'frequency': 150.0, 'gain_db': 0.0, 'quality': 0.707}, 'max_peaking_eqs': 4, 'peaking_eqs': []}, 'volume': {'controlType': 'attenuation', 'level': 0.44999998807907104, 'muted': False, 'stepInterval': 0.05000000074505806}}, 'type': 'RECEIVER_STATUS'}
2021-11-10 16:01:54 DEBUG (Thread-6) [pychromecast.controllers] Received status: CastStatus(is_active_input=False, is_stand_by=True, volume_level=0.44999998807907104, volume_muted=False, app_id=None, display_name=None, namespaces=[], session_id=None, transport_id=None, status_text='', icon_url=None, volume_control_type='attenuation')
2021-11-10 16:01:55 DEBUG (zeroconf-ServiceBrowser-_googlecast._tcp-282) [pychromecast.discovery] update_service _googlecast._tcp.local., Google-Nest-Hub-Max-a97ff841901efdb4ad3aaf839a577c06._googlecast._tcp.local.
2021-11-10 16:01:55 DEBUG (zeroconf-ServiceBrowser-_googlecast._tcp-282) [pychromecast.dial] Resolved service ServiceInfo(type='host', data=('192.168.0.185', 8009)) to 192.168.0.185
2021-11-10 16:01:55 DEBUG (zeroconf-ServiceBrowser-_googlecast._tcp-282) [homeassistant.components.cast.discovery] Discovered new or updated chromecast ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.0.185', 8009)), ServiceInfo(type='mdns', data='Google-Nest-Hub-Max-a97ff841901efdb4ad3aaf839a577c06._googlecast._tcp.local.')}, uuid='a97ff841-901e-fdb4-ad3a-af839a577c06', _manufacturer='Google Inc.', model_name='Google Nest Hub Max', friendly_name='Google Hub', is_audio_group=False, is_dynamic_group=None)
2021-11-10 16:01:55 DEBUG (MainThread) [homeassistant.components.cast.media_player] _async_create_cast_device: ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.0.185', 8009)), ServiceInfo(type='mdns', data='Google-Nest-Hub-Max-a97ff841901efdb4ad3aaf839a577c06._googlecast._tcp.local.')}, uuid='a97ff841-901e-fdb4-ad3a-af839a577c06', _manufacturer='Google Inc.', model_name='Google Nest Hub Max', friendly_name='Google Hub', is_audio_group=False, is_dynamic_group=None)
2021-11-10 16:01:55 DEBUG (MainThread) [homeassistant.components.cast.media_player] Discovered chromecast with same UUID: ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.0.185', 8009)), ServiceInfo(type='mdns', data='Google-Nest-Hub-Max-a97ff841901efdb4ad3aaf839a577c06._googlecast._tcp.local.')}, uuid='a97ff841-901e-fdb4-ad3a-af839a577c06', _manufacturer='Google Inc.', model_name='Google Nest Hub Max', friendly_name='Google Hub', is_audio_group=False, is_dynamic_group=None)
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.socket_client] [Google Hub(192.168.0.185):8009] Received: Message urn:x-cast:com.google.cast.receiver from receiver-0 to *: {'requestId': 20, 'status': {'applications': [{'appId': '9AC194DC', 'appType': 'WEB', 'displayName': 'Plex', 'iconUrl': 'http://lh3.ggpht.com/F-carnehpMLNP_IxDt3-IhX9qlnPZcgnC1Ri8E9xkkkIWoeWI_GcD5ZeIQlNkKblg2jOvZLHUm-metNK', 'isIdleScreen': False, 'launchedFromCloud': False, 'namespaces': [{'name': 'urn:x-cast:com.google.cast.debugoverlay'}, {'name': 'urn:x-cast:com.google.cast.cac'}, {'name': 'urn:x-cast:plex'}, {'name': 'urn:x-cast:com.google.cast.broadcast'}, {'name': 'urn:x-cast:com.google.cast.media'}], 'sessionId': 'd1b9471f-6c72-42cc-bc0f-18c99a862ff5', 'statusText': 'Plex', 'transportId': 'd1b9471f-6c72-42cc-bc0f-18c99a862ff5', 'universalAppId': '9AC194DC'}], 'userEq': {'high_shelf': {'frequency': 4500.0, 'gain_db': 0.0, 'quality': 0.707}, 'low_shelf': {'frequency': 150.0, 'gain_db': 0.0, 'quality': 0.707}, 'max_peaking_eqs': 4, 'peaking_eqs': []}, 'volume': {'controlType': 'attenuation', 'level': 0.44999998807907104, 'muted': False, 'stepInterval': 0.05000000074505806}}, 'type': 'RECEIVER_STATUS'}
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.controllers] Received status: CastStatus(is_active_input=False, is_stand_by=True, volume_level=0.44999998807907104, volume_muted=False, app_id='9AC194DC', display_name='Plex', namespaces=['urn:x-cast:com.google.cast.debugoverlay', 'urn:x-cast:com.google.cast.cac', 'urn:x-cast:plex', 'urn:x-cast:com.google.cast.broadcast', 'urn:x-cast:com.google.cast.media'], session_id='d1b9471f-6c72-42cc-bc0f-18c99a862ff5', transport_id='d1b9471f-6c72-42cc-bc0f-18c99a862ff5', status_text='Plex', icon_url='http://lh3.ggpht.com/F-carnehpMLNP_IxDt3-IhX9qlnPZcgnC1Ri8E9xkkkIWoeWI_GcD5ZeIQlNkKblg2jOvZLHUm-metNK', volume_control_type='attenuation')
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.socket_client] [Google Hub(192.168.0.185):8009] Sending: Message urn:x-cast:com.google.cast.tp.connection from sender-0 to d1b9471f-6c72-42cc-bc0f-18c99a862ff5: {'type': 'CONNECT', 'origin': {}, 'userAgent': 'PyChromecast', 'senderInfo': {'sdkType': 2, 'version': '15.605.1.3', 'browserVersion': '44.0.2403.30', 'platform': 4, 'systemVersion': 'Macintosh; Intel Mac OS X10_10_3', 'connectionType': 1}}
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.socket_client] [Google Hub(192.168.0.185):8009] Sending: Message urn:x-cast:plex from sender-0 to d1b9471f-6c72-42cc-bc0f-18c99a862ff5: {'type': 'GET_STATUS', 'requestId': 21}
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.socket_client] [Google Hub(192.168.0.185):8009] Sending: Message urn:x-cast:com.google.cast.media from sender-0 to d1b9471f-6c72-42cc-bc0f-18c99a862ff5: {'type': 'GET_STATUS', 'requestId': 22}
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.controllers] Start app_launch_event_function...
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.controllers] Create command: 
'{\n    "type": "LOAD",\n    "requestId": 1,\n    "media": {\n        "contentId": "/library/metadata/4063",\n        "streamType": "BUFFERED",\n        "contentType": "video",\n        "customData": {\n            "offset": 0,\n            "directPlay": true,\n            "directStream": true,\n            "subtitleSize": 100,\n            "audioBoost": 100,\n            "server": {\n                "machineIdentifier": "d0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d",\n                "transcoderVideo": true,\n                "transcoderVideoRemuxOnly": false,\n                "transcoderAudio": true,\n                "version": "1.24.4.5081-e362dc1ee",\n                "myPlexSubscription": false,\n                "isVerifiedHostname": true,\n                "protocol": "http",\n                "address": "192.168.0.14",\n                "port": 32400,\n                "accessToken": null,\n                "user": {\n                    "username": "xxx@gmail.com"\n                }\n            },\n            "containerKey": "/playQueues/6825?own=1&window=200"\n        },\n        "autoplay": true,\n        "currentTime": 0,\n        "activeTrackIds": null\n    },\n    "requestiId": 1\n}'

2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.controllers] Sending msg {'type': 'LOAD', 'requestId': 1, 'media': {'contentId': '/library/metadata/4063', 'streamType': 'BUFFERED', 'contentType': 'video', 'customData': {'offset': 0, 'directPlay': True, 'directStream': True, 'subtitleSize': 100, 'audioBoost': 100, 'server': {'machineIdentifier': 'd0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d', 'transcoderVideo': True, 'transcoderVideoRemuxOnly': False, 'transcoderAudio': True, 'version': '1.24.4.5081-e362dc1ee', 'myPlexSubscription': False, 'isVerifiedHostname': True, 'protocol': 'http', 'address': '192.168.0.14', 'port': 32400, 'accessToken': None, 'user': {'username': 'xxx@gmail.com'}}, 'containerKey': '/playQueues/6825?own=1&window=200'}, 'autoplay': True, 'currentTime': 0, 'activeTrackIds': None}, 'requestiId': 1} urn:x-cast:com.google.cast.media True None False.
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.socket_client] [Google Hub(192.168.0.185):8009] Sending: Message urn:x-cast:com.google.cast.media from sender-0 to d1b9471f-6c72-42cc-bc0f-18c99a862ff5: {'type': 'LOAD', 'requestId': 23, 'media': {'contentId': '/library/metadata/4063', 'streamType': 'BUFFERED', 'contentType': 'video', 'customData': {'offset': 0, 'directPlay': True, 'directStream': True, 'subtitleSize': 100, 'audioBoost': 100, 'server': {'machineIdentifier': 'd0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d', 'transcoderVideo': True, 'transcoderVideoRemuxOnly': False, 'transcoderAudio': True, 'version': '1.24.4.5081-e362dc1ee', 'myPlexSubscription': False, 'isVerifiedHostname': True, 'protocol': 'http', 'address': '192.168.0.14', 'port': 32400, 'accessToken': None, 'user': {'username': 'xxx@gmail.com'}}, 'containerKey': '/playQueues/6825?own=1&window=200'}, 'autoplay': True, 'currentTime': 0, 'activeTrackIds': None}, 'requestiId': 1, 'sessionId': 'd1b9471f-6c72-42cc-bc0f-18c99a862ff5'}
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.socket_client] [Google Hub(192.168.0.185):8009] Received: Message urn:x-cast:com.google.cast.media from d1b9471f-6c72-42cc-bc0f-18c99a862ff5 to *: {'type': 'MEDIA_STATUS', 'status': [], 'requestId': 0}
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.controllers] Media:Received status {'type': 'MEDIA_STATUS', 'status': [], 'requestId': 0}
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.socket_client] [Google Hub(192.168.0.185):8009] Received: Message urn:x-cast:com.google.cast.media from d1b9471f-6c72-42cc-bc0f-18c99a862ff5 to sender-0: {'type': 'MEDIA_STATUS', 'status': [], 'requestId': 22}
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.controllers] Media:Received status {'type': 'MEDIA_STATUS', 'status': [], 'requestId': 22}
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.socket_client] [Google Hub(192.168.0.185):8009] Received: Message urn:x-cast:com.google.cast.media from d1b9471f-6c72-42cc-bc0f-18c99a862ff5 to *: {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 1, 'playbackRate': 1, 'supportedMediaCommands': 12303, 'media': {'contentId': '/library/metadata/4063', 'streamType': 'BUFFERED', 'contentType': 'video', 'customData': {'offset': 0, 'directPlay': True, 'directStream': True, 'subtitleSize': 100, 'audioBoost': 100, 'server': {'machineIdentifier': 'd0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d', 'transcoderVideo': True, 'transcoderVideoRemuxOnly': False, 'transcoderAudio': True, 'version': '1.24.4.5081-e362dc1ee', 'myPlexSubscription': False, 'isVerifiedHostname': True, 'protocol': 'http', 'address': '192.168.0.14', 'port': 32400, 'user': {'username': 'xxx@gmail.com'}}, 'containerKey': '/playQueues/6825?own=1&window=200'}, 'autoplay': True, 'currentTime': 0, 'mediaCategory': 'VIDEO'}, 'currentItemId': 1, 'repeatMode': 'REPEAT_OFF'}], 'requestId': 0}
2021-11-10 16:01:56 DEBUG (Thread-6) [pychromecast.controllers] Media:Received status {'type': 'MEDIA_STATUS', 'status': [{'mediaSessionId': 1, 'playbackRate': 1, 'supportedMediaCommands': 12303, 'media': {'contentId': '/library/metadata/4063', 'streamType': 'BUFFERED', 'contentType': 'video', 'customData': {'offset': 0, 'directPlay': True, 'directStream': True, 'subtitleSize': 100, 'audioBoost': 100, 'server': {'machineIdentifier': 'd0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d', 'transcoderVideo': True, 'transcoderVideoRemuxOnly': False, 'transcoderAudio': True, 'version': '1.24.4.5081-e362dc1ee', 'myPlexSubscription': False, 'isVerifiedHostname': True, 'protocol': 'http', 'address': '192.168.0.14', 'port': 32400, 'user': {'username': 'xxx@gmail.com'}}, 'containerKey': '/playQueues/6825?own=1&window=200'}, 'autoplay': True, 'currentTime': 0, 'mediaCategory': 'VIDEO'}, 'currentItemId': 1, 'repeatMode': 'REPEAT_OFF'}], 'requestId': 0}
2021-11-10 16:01:57 DEBUG (zeroconf-ServiceBrowser-_googlecast._tcp-282) [pychromecast.discovery] update_service _googlecast._tcp.local., Google-Nest-Hub-Max-a97ff841901efdb4ad3aaf839a577c06._googlecast._tcp.local.
2021-11-10 16:01:57 DEBUG (zeroconf-ServiceBrowser-_googlecast._tcp-282) [pychromecast.dial] Resolved service ServiceInfo(type='host', data=('192.168.0.185', 8009)) to 192.168.0.185
2021-11-10 16:01:57 DEBUG (zeroconf-ServiceBrowser-_googlecast._tcp-282) [homeassistant.components.cast.discovery] Discovered new or updated chromecast ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.0.185', 8009)), ServiceInfo(type='mdns', data='Google-Nest-Hub-Max-a97ff841901efdb4ad3aaf839a577c06._googlecast._tcp.local.')}, uuid='a97ff841-901e-fdb4-ad3a-af839a577c06', _manufacturer='Google Inc.', model_name='Google Nest Hub Max', friendly_name='Google Hub', is_audio_group=False, is_dynamic_group=None)
2021-11-10 16:01:57 DEBUG (MainThread) [homeassistant.components.cast.media_player] _async_create_cast_device: ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.0.185', 8009)), ServiceInfo(type='mdns', data='Google-Nest-Hub-Max-a97ff841901efdb4ad3aaf839a577c06._googlecast._tcp.local.')}, uuid='a97ff841-901e-fdb4-ad3a-af839a577c06', _manufacturer='Google Inc.', model_name='Google Nest Hub Max', friendly_name='Google Hub', is_audio_group=False, is_dynamic_group=None)
2021-11-10 16:01:57 DEBUG (MainThread) [homeassistant.components.cast.media_player] Discovered chromecast with same UUID: ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.0.185', 8009)), ServiceInfo(type='mdns', data='Google-Nest-Hub-Max-a97ff841901efdb4ad3aaf839a577c06._googlecast._tcp.local.')}, uuid='a97ff841-901e-fdb4-ad3a-af839a577c06', _manufacturer='Google Inc.', model_name='Google Nest Hub Max', friendly_name='Google Hub', is_audio_group=False, is_dynamic_group=None)
`

and yeah, all same network, same subnet

Ok. And how is your Plex integration configured? It appears it may have been configured manually with an IP as the hostname.

If so, what are the SSL settings used? Any chance you've configured the integration without a token by allowing local connections without authentication on the Plex server?

yes, was configured with IP, no http

dont remeber anymore if i used token, can i see that in the core.device_registry file?
the identifier i see below, is not the token


            {
                "config_entries": [
                    "7d70ab5177cebf22e61f81bd71176a1a"
                ],
                "connections": [],
                "identifiers": [
                    [
                        "plex",
                        "d0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d"
                    ]
                ],
                "manufacturer": "Plex",
                "model": "Plex Media Server",
                "name": "Synology",
                "sw_version": "1.24.4.5081-e362dc1ee",
                "entry_type": null,
                "id": "8e00d4c7d9074d65b5799c761db7de4c",
                "via_device_id": null,
                "area_id": null,
                "name_by_user": null,
                "disabled_by": null,
                "configuration_url": "http://192.168.0.14:32400/web"
            },

also in plex server settings , i have entered there 192.168.0.17 , thats the IP of my HA instance

image

i see indeed that token is optional when trying to add plex as integration
maybe thats the issue then? that i didnt enter a token? why is it used?

Yes, that's likely what's going on. The token is stored in the core.config_entries file.

I always suggest using the standard integration configuration which sends you to plex.tv to authenticate and obtain a dedicated token for HA. It tends to avoid edge-cases like this scenario.

ah , ok, that was it!
deleted and added plex, this time manually and WITH token
now it works :-)

thnx for support as always! much appreciated!