core
core copied to clipboard
Plex clients (PlexAmp, Plex Player) show unavailable until they are active
The problem
I have a number of PlexAmp and Plex player clients on various devices: iPhone, iPad, Mac, Apple TVs, and nVidia Shield. When one of the clients is active, HA properly and instantly gets updates about the playing media. However, whenever a client goes idle for a period of time ALL clients show:
This entity is no longer being provided by the plex integration. If the entity is no longer in use, delete it in settings.
And if while I'm the entity dialog box that shows the unavailable state and play media, it instantly has the proper state. So it's like the PMS add-on tells HA the entity is no longer being provided while the client is idle, instead of passing along an idle state.
What version of Home Assistant Core has the issue?
core-2023.7.1
What was the last working version of Home Assistant Core?
unknown
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Plex
Link to integration documentation on our website
https://github.com/home-assistant/core/tree/dev/homeassistant/components/plex
Diagnostics information
home-assistant_plex_2023-07-10T05-30-49.373Z.log
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
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!
Code owner commands
Code owners of plex
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 plex
Removes the current integration label and assignees on the issue, add the integration domain after the command.
(message by CodeOwnersMention)
plex documentation plex source (message by IssueLinks)
I'm seeing the same behavior with unavailable entities across the board
Any head way on this issue. I've been experiance the same.
Same here, following.
Same here, also following.
Same here.
It is even worse than unavailable. Once you START playing the client is available in HA but none of the functions work like playing media or nothing.
When Plex is playing and trying to play media via HA using the simple UI and not service calls the following errors are thrown:
2023-12-19 11:41:13.919 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139872660546496] Client is not currently accepting playback controls: Plex (Plex for Apple TV - Apple TV)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 238, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2104, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 878, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 799, in async_play_media
await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/plex/media_player.py", line 487, in play_media
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Client is not currently accepting playback controls: Plex (Plex for Apple TV - Apple TV)
Plex clients can only be considered "idle" if they are advertising their availability and can be remotely controlled. Otherwise the only information available is when the Plex server reports ac active playback session.
Make sure you've enabled "Advertise as a player" (or variations of that language) and try to trigger the button.scan_clients
entity after the Plex client has been open for a few seconds to give it time to respond.
Some Plex clients seem to sometimes "forget" this setting during upgrades, so check it again in the Plex client settings if you believe you enabled it in the past.
Note: Plex clients must be directly connectable for controls to work. This means they must be reachable from the same network as your HA host.
If this is still not working, it's probably one of three things:
- The Plex client doesn't support remote control. For example, Plex Web clients (and non-HTPC desktop clients) had this feature removed a while back.
- Your HA setup cannot scan for clients using UDP multicast because of networking restrictions or HA running in a container without
host
networking. - Plex clients are not logged in or not using the same account as the server.
@jjlawren This is not the case. I have full control of my AppleTV Plex instance when there is media playing or paused. The instant the media stops (back button), the client is no longer available. This behavior is new, I used to be able to control the AppleTV Plex client as soon as the application was open. I even have an automation that when the AppleTV media source (input) changes to Plex, it scans for clients.
@jjlawren This is not the case. I have full control of my AppleTV Plex instance when there is media playing or paused. The instant the media stops (back button), the client is no longer available. This behavior is new, I used to be able to control the AppleTV Plex client as soon as the application was open. I even have an automation that when the AppleTV media source (input) changes to Plex, it scans for clients.
Same here.
I had scripts to trigger certain playlists and now they don't work unless media is already playing. Previously, I could trigger these even if the plex client was not currently playing content.
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.
Still a problem.
It is most certainly still broken.
I had scripts to trigger certain playlists and now they don't work unless media is already playing. Previously, I could trigger these even if the plex client was not currently playing content.
Same experience here
Same here. Following
Same here.
My workaround is adding an if else condition if the player is unavailable after plex launched then reloading the plex intervention via script shows it as active. There may need to be a delay for a few seconds depending on your device then it’ll work until they fix this bug
My workaround is adding an if else condition if the player is unavailable after plex launched then reloading the plex intervention via script shows it as active. There may need to be a delay for a few seconds depending on your device then it’ll work until they fix this bug
How do you reload the plex? Could you share more details? Thanks!
You have to get the config entry id for plex located in /config/.storage/core.config_entries then in the automation select conditional then entity select your plex media player device then unavailable. The action should be Call a service 'Home Assistant Core Integration: Reload config entry’ with the config id box checked and the config id from earlier. I also had to select my plex media server as the device. I have a 2 second wait after just in case it has to reload the integration.
@pranktap thanks, guy, it works!