core
core copied to clipboard
Plexamp doesnt show media controls in UI
The problem
Plexamp (ersion 4.2.2) doesnt show media controls in the media card.
What version of Home Assistant Core has the issue?
Core-2022.6.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Core
Integration causing the issue
Plex
Link to integration documentation on our website
No response
Diagnostics information
Here is the log
022-06-14 12:25:15 DEBUG (SyncWorker_3) [plexapi] GET https://plex.tv/users/account
2022-06-14 12:25:15 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that uses deprecated `async_get_registry` to access entity registry, use async_get instead. Please report issue to the custom component author for localtuya using this method at custom_components/localtuya/__init__.py, line 315: ent_reg = await er.async_get_registry(hass)
2022-06-14 12:25:15 DEBUG (SyncWorker_3) [plexapi] GET https://plex.tv/api/users/
2022-06-14 12:25:15 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that uses deprecated `async_get_registry` to access entity registry, use async_get instead. Please report issue to the custom component author for shelly using this method at custom_components/shelly/__init__.py, line 356: await self.hass.helpers.entity_registry.async_get_registry()
2022-06-14 12:25:16 DEBUG (SyncWorker_3) [homeassistant.components.plex.server] Linked accounts: {'Adults', 'Kids'}
2022-06-14 12:25:16 DEBUG (SyncWorker_3) [homeassistant.components.plex.server] Server owner found: 'user'
2022-06-14 12:25:16 DEBUG (MainThread) [homeassistant.components.plex] Connected to: User Home (https://172-16-3-28.blahblah.plex.direct:32400)
2022-06-14 12:25:16 DEBUG (SyncWorker_1) [plexapi] GET https://172-16-3-28.blahblah.plex.direct:32400/library
2022-06-14 12:25:16 DEBUG (SyncWorker_1) [plexapi] GET https://172-16-3-28.blahblah.plex.direct:32400/library/sections
2022-06-14 12:25:16 DEBUG (MainThread) [homeassistant.components.plex.media_player] New entity listener created
2022-06-14 12:25:19 DEBUG (MainThread) [homeassistant.components.plex] Websocket to User Home successful
2022-06-14 12:25:19 DEBUG (MainThread) [homeassistant.components.plex.server] Updating devices
2022-06-14 12:25:19 DEBUG (SyncWorker_5) [homeassistant.components.plex] Scanning for GDM clients
2022-06-14 12:25:21 DEBUG (SyncWorker_2) [plexapi] GET https://172-16-3-28.blahblah.plex.direct:32400/clients
2022-06-14 12:25:21 DEBUG (SyncWorker_2) [plexapi] GET https://172-16-3-28.blahblah.plex.direct:32400/status/sessions
2022-06-14 12:25:22 DEBUG (SyncWorker_2) [plexapi] GET https://plex.tv/api/resources?includeHttps=1&includeRelay=1
2022-06-14 12:25:22 DEBUG (SyncWorker_2) [homeassistant.components.plex.server] Current available clients from plex.tv: []
2022-06-14 12:25:22 DEBUG (MainThread) [homeassistant.components.plex.server] Ignoring Plex Web PMS: y6f3t6oopbkf53clxa14z0e3
2022-06-14 12:25:25 DEBUG (MainThread) [homeassistant.components.plex.sensor] Refreshing sensor [sensor-59ff8d430625b01dc11428b9849d39b4942bb2de]
2022-06-14 12:26:02 DEBUG (MainThread) [homeassistant.components.plex.server] Updating devices
2022-06-14 12:26:02 DEBUG (SyncWorker_15) [homeassistant.components.plex] Scanning for GDM clients
2022-06-14 12:26:03 DEBUG (SyncWorker_9) [plexapi] GET https://172-16-3-28.blahblah.plex.direct:32400/clients
2022-06-14 12:26:03 DEBUG (SyncWorker_9) [plexapi] GET https://172-16-3-28.blahblah.plex.direct:32400/status/sessions
2022-06-14 12:26:03 DEBUG (SyncWorker_5) [homeassistant.components.plex.server] Creating new Plex session: <Track:152884:Goa-Aana>
2022-06-14 12:26:03 DEBUG (SyncWorker_5) [plexapi] Reloading Track 'Goa Aana' for attr 'thumb'
2022-06-14 12:26:03 DEBUG (SyncWorker_5) [plexapi] GET https://172-16-3-28.blahblah.plex.direct:32400/library/metadata/152884?checkFiles=1&includeAllConcerts=1&includeBandwidths=1&includeChapters=1&includeChildren=1&includeConcerts=1&includeExternalMedia=1&includeExtras=1&includeFields=thumbBlurHash%2CartBlurHash&includeGeolocation=1&includeLoudnessRamps=1&includeMarkers=1&includeOnDeck=1&includePopularLeaves=1&includePreferences=1&includeRelated=1&includeRelatedCount=1&includeReviews=1&includeStations=1
2022-06-14 12:26:03 DEBUG (SyncWorker_5) [homeassistant.components.plex.server] New Plexamp from session: a48a79ec-896b-4e45-9880-10638427bacb
2022-06-14 12:26:03 DEBUG (MainThread) [homeassistant.components.plex.media_player] New entities: [{'device': <PlexClient:/resources:raspberrypi>, 'player_source': 'session', 'session': <52:Goa Aana>}]
2022-06-14 12:26:03 DEBUG (MainThread) [homeassistant.components.plex.media_player] Added media_player.plex_plexamp_raspberrypi [59ff8d430625b01dc11428b9849d39b4942bb2de:a48a79ec-896b-4e45-9880-10638427bacb]
2022-06-14 12:26:06 DEBUG (MainThread) [homeassistant.components.plex.sensor] Refreshing sensor [sensor-59ff8d430625b01dc11428b9849d39b4942bb2de]
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
plex documentation plex source (message by IssueLinks)
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)
It's not being found using GDM or from plex.tv available clients. Is it signed in using the same account as your Plex integration?
Are you able to test some python scripts from your HA host?
Yes, it is signed in with the account. The other client on the same VLAN (nvidia shield) is being discovered. Not sure why the Plexamp is not.
Sure, i can do tests as required.
If you check out plexapi, you can run the gdm.py module directly to see what you can see from the host:
$ git clone https://github.com/pkkid/python-plexapi
$ python ./python-plexapi/plexapi/gdm.py
You can also see what the plex.tv endpoint is reporting for available clients:
curl 'https://plex.tv/api/resources?X-Plex-Token=<YOUR_TOKEN_HERE>'
You are right gdm doesnt list the raspberry pi at all. Also, the other clients (shield tv) were also listed intermittently i.e. sometimes i received an empty response and a subsequent try showed up the shield tv client.
Other thing i noticed that the raspberrypi never showed up in gdm.py even in its own network. Plexamp client on my mobile can see it though, so clearly it is being broadcasted. Maybe gdm.py support is lacking?
Finally plex.tv endpoint showed up the raspberry pi consistently on each call,
<Device name="raspberrypi" product="Plexamp" productVersion="4.2.2" platform="Linux" platformVersion="5.15.32-v8+" device="Linux" clientIdentifier="a48a79ec-896b-4e45-9880-10638427bacb" createdAt="1651777556" lastSeenAt="1655180606" provides="client,player,pubsub-player" owned="1" publicAddress="redacted" publicAddressMatches="0" presence="1">
<Connection protocol="http" address="rfc1918" port="32500" uri="http://rfc1918:32500" local="1"/>
</Device>
GM isn't 100% reliable as it relies on multicast/broadcast packets. I tested with Plexamp on a Mac and it responded ~70% of the time.
Any chance there's plex errors/warnings earlier in your log during HA startup?
I ran gdm on the RPi running plexamp and got nothing back,
pi@raspberrypi:~/tmp $ python ./python-plexapi/plexapi/gdm.py
'Scanning GDM for servers...'
[]
'Scanning GDM for clients...'
[]
pi@raspberrypi:~/tmp $ python ./python-plexapi/plexapi/gdm.py
'Scanning GDM for servers...'
[]
'Scanning GDM for clients...'
[]
pi@raspberrypi:~/tmp $ python ./python-plexapi/plexapi/gdm.py
'Scanning GDM for servers...'
[]
'Scanning GDM for clients...'
[]
GDM is an "extra" method for discovery used by the integration, so it's not required to be working. Note that GDM server discovery uses multicast, while client discovery uses broadcast. They might need to be handled slightly differently if your network is not completely flat.
Do you have any other warnings or errors in your home-assistant.log? If not, the next step would be to enable debug logging for the Plex integration.
No warnings related to plex,
2022-06-17 08:56:59 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration shelly which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-06-17 08:56:59 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-06-17 08:56:59 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration localtuya which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-06-17 08:56:59 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration nodered which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-06-17 08:57:04 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that uses deprecated `async_get_registry` to access entity registry, use async_get instead. Please report issue to the custom component author for shelly using this method at custom_components/shelly/__init__.py, line 356: await self.hass.helpers.entity_registry.async_get_registry()
2022-06-17 08:57:12 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Brother DCP-L2540DW series' for ipp integration not ready yet: Invalid response from API: Timeout occurred while connecting to IPP server.; Retrying in background
Please try to run the integration in debug:
logger:
logs:
homeassistant.components.plex: debug
You can then force a scan for clients by activating the button.scan_clients entity. That should write info relevant to this problem to the log on demand.
2022-08-08 02:51:34.323 DEBUG (MainThread) [homeassistant.components.plex.media_player] New entities: [{'device': <PlexClient:http://192.168.8.50::Plexamp>, 'player_source': 'PMS'}, {'device': <PlexClient:http://192.168.0.200:xxxxxxxxxx>, 'player_source': 'GDM'}, {'device': <PlexClient:/resources:mobiledevice-Plexamp>, 'player_source': 'session', 'session': <7:xxxxxxxx - xxxxxxxx - xxxxxxxx>}]
An authenticated request to https://plex.tv/api/resources does contain the Player tag with matching machineIdentifier value, but in my specific case I suspect this is complicated by my network having a /28 v4 block, and the device that is failing to show player controls has a different external IP to what the Plex server or Home Assistant container do, so the publicAddressMatches check inside PlexServer.plextv_clients() would fail to include this client. All other working clients are returned by the GDM check (as they're on the same broadcast domain as the Home Assistant container).
Manually removing the x.publicAddressMatches works to resolve this issue for me, at least when the device plays a track - the player_source now shows as plex.tv, and supported_features returns as 152127 - same as other Plexamp clients.
The plex.tv discovery seems reliable enough, but might need some tweaking to allow handling strange edge cases (i.e. Plexamp running on a mobile device may not always pass the x.presence test (if discovery runs when Plexamp is not running on the device, the cached state has presence stored as 0).
It's conceivable that the publicAddressMatches check could be changed to be a configuration option on the integration (e.g. "Show all Plex.tv clients, even if the external address does not match"), but the other filtering would still cause occasional issues. Ideally the presence check could be considered during the PlexServer.process_sessions method - if there's an active play session, the client is much more likely to be active, regardless of the cached presence status.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.