-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling play_media
for Plex devices doesn't update Plex Server
#31599
Comments
The integration simply shows the active sessions that the Plex server reports back. Seems like a Plex issue if they're not even showing up in the dashboard. Is the media being played located on the Plex server you're monitoring? |
@jjlawren I was thinking that could be the issue as well, except that it works fine if I play media through the regular plex clients (Shield Plex App, Plex mobile app, Plex for Web, etc)--even the
Yep. Just one Plex server and I'm calling it using similar commands in my other issue (although this issue is more for Shield clients): entity_id: "media_player.plex_living_room"
media_content_id: "{\"library_name\":\"TV Shows\",\"show_name\":\"Superstore\",\"season_number\":\"5\",\"episode_number\":\"14\",\"shuffle\":\"0\"}"
media_content_type: "EPISODE" I don't believe this is related, but my only errors in my logs are Heartbeat errors: Traceback (most recent call last):
File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_ws.py", line 102, in _send_heartbeat
self._loop.create_task(self._writer.ping()) # type: ignore
AttributeError: 'NoneType' object has no attribute 'ping'
2020-02-07 10:09:54 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback WebSocketResponse._send_heartbeat()
Traceback (most recent call last):
File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_ws.py", line 102, in _send_heartbeat
self._loop.create_task(self._writer.ping()) # type: ignore
AttributeError: 'NoneType' object has no attribute 'ping'
2020-02-07 10:09:54 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback WebSocketResponse._send_heartbeat()
Traceback (most recent call last):
File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_ws.py", line 102, in _send_heartbeat
self._loop.create_task(self._writer.ping()) # type: ignore
AttributeError: 'NoneType' object has no attribute 'ping'
2020-02-07 10:09:55 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback WebSocketResponse._send_heartbeat()
Traceback (most recent call last):
File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_ws.py", line 102, in _send_heartbeat
self._loop.create_task(self._writer.ping()) # type: ignore
AttributeError: 'NoneType' object has no attribute 'ping' And I've monitored my firewall, just in case, and nothing is being blocked. |
I'm combing through Plex logs now and will add anything I find "intersting" (after calling Feb 07, 2020 10:58:04.440 [7516] DEBUG - Streaming Resource: Added session da56c5e2f61313a9-com-plexapp-android
Feb 07, 2020 10:58:04.440 [7516] DEBUG - Found session GUID of da56c5e2f61313a9-com-plexapp-android in session start.
Feb 07, 2020 10:58:04.440 [7516] DEBUG - Using session GUID da56c5e2f61313a9-com-plexapp-android for new transcode session.
Feb 07, 2020 10:58:04.440 [7516] VERBOSE - [IDLE] Adding (3->4) work item transcoder - da56c5e2f61313a9-com-plexapp-android
Feb 07, 2020 10:58:04.440 [7516] VERBOSE - [IDLE] * http_download - /video/:/transcode/universal/session/da56c5e2f61313a9-com-plexapp-android/base/00000.ts - 3 active item(s)
Feb 07, 2020 10:58:04.440 [7516] VERBOSE - [IDLE] * http_download - /video/:/transcode/universal/session/da56c5e2f61313a9-com-plexapp-android/base/00001.ts - 3 active item(s)
Feb 07, 2020 10:58:04.440 [7516] VERBOSE - [IDLE] * transcoder - da56c5e2f61313a9-com-plexapp-android - 4 active item(s)
Feb 07, 2020 10:58:04.440 [7516] DEBUG - Cleaning directory for session da56c5e2f61313a9-com-plexapp-android ()
[...]
// IS THIS IMPORTANT?
Feb 07, 2020 10:58:04.456 [15072] DEBUG - Request came in with unrecognized domain / IP <MYDOMAIN>.net' in header Host; treating as non-local I should also note that calling the {
"MediaContainer": {
"size": 0
}
} However, if I call |
Odd, I'm not familiar with that endpoint. The Maybe the Plex API has changed with a recent upgrade. |
@jjlawren I think the transcode endpoint is a separate tracker for sessions that are actually transcoding. Between that endpoint and the logs, it appears transcoding is working fine, which makes sense, since it's needed for playback. For whatever reason, client status isn't being tracked. |
I've also determined that Plex Webhooks won't fire if using |
I'm saying that all active playing sessions used to be reported when calling |
@jjlawren I see. I'll try downgrading the server and see if that fixes things. |
I tested a few different versions:
|
Thanks for being so thorough. Unfortunately I'm not sure what to make of the results. It doesn't seem like any version is working properly for you... |
@jjlawren No problem. Happy to help. And I can't seem to make anything of it, either. I take it that things work for you just fine? |
@jjlawren I turned on network logging in the Shield and see this: 02-07 16:36:16.271 i: Fetching [method:POST] http://<HA IP>:32400/:/timeline?X-Plex-Token=...null-1oWp6J-3Yt2u93mEz_v&includeExternalMedia=1
02-07 16:36:16.279 i: Time out fetching http://<HA IP>:32400/:/timeline?X-Plex-Token=...null-1oWp6J-3Yt2u93mEz_v. Plex edits out the token, but I find the
Not sure how to fix this, but that seems like the issue. I'd guess it is something related to this |
I got my hands on a Shield and reproduced the issue. It looks like it's a combination of (newer) behavior of the Plex client on Shield and the subscription command sent during a media playback request in the underlying library. Basically it requests the Shield to call back to the HA address on the server's port with POST state updates. This will always fail. I think with HA this will need to be changed to a poll mechanism, which should be fine as we're already notified of updates via the websocket connection. Opened an issue for the library here. |
Alright, so even when skipping the callback subscription command, the server still doesn’t report playback status on the normal |
Although the subscription calls seem incorrect, they don't seem to be related to the Plex server not reporting the playback status. Old Shield Plex clients behave fine (ie, roll back to the one that's preinstalled on the Shield and it reports playback fine). The newer ones appear to have some issue when playback is started via the player's API. I posted on the Plex forums a while back with info for their devs and I've been testing each incremental version released. No fixes available yet. |
I'm still seeing this behavior on the latest Shield client released a few days ago. As a sanity check, @mdrichardson is your Shield client on a different subnet as your Plex server, and/or are there any possible networking restrictions between them? I have mine on separate VLANs and only allow known Plex ports through. Curious if that could be a common theme that should be explored further. |
@jjlawren I have two Shields and both are on the same subnet with everything else--haven't separated everything into VLANs yet. I still haven't had a chance to really test this, but I'll watch my firewall logs to see if anything is getting blocked--shouldn't be though as I allow all traffic between LAN clients. I just migrated Plex to a Linux LXC in Proxmox from Windows, so I'll see if that makes a difference as well. |
Well, this looks promising: https://forums.plex.tv/t/plex-for-android/29115/341
Edit: Nope, still broken. |
Thanks for confirming. I've started to get some feedback over in the Plex forums that seems to acknowledge the issue(s): https://forums.plex.tv/t/no-session-status-when-starting-playback-on-shield-over-remote-control-api/555067 |
I'm getting this same issue using an Amazon Fire TV. The media plays fine but nothing is reported to the sessions endpoint. I also tried on my iphone and the session is reported. I've been trying to think of a workaround since this is also effecting how plex syncs with trakt |
@dmintz7 this seems to be a Plex issue with AndroidTV clients. I'm sure it's not showing up in your Plex Web activity, either. I'm working with Plex to get this resolved. |
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. |
Still chasing this problem upstream. Would like to keep this open for now in case others encounter the same issue. |
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. |
I may have finally tracked this down. Created pkkid/python-plexapi#826 upstream to fix. I'll need to test more to be sure. |
The problem
If you call
play_media
with amedia_player.plex*
device, the media will play, but the Plex Server won't show that any clients are playing in the Dashboard. Becausemedia_player.plex*
gets its state from the server, it also won't show that anything is playing.If media is played directly from the Plex Client (not at all through Home Assistant), everything updates appropriately.
Environment
Problem-relevant
configuration.yaml
N/A
Traceback/Error logs
Nothing relevant. After calling
play_media
:Additional information
Maybe we need to send a subscribe command on behalf of the client?
From what I can tell based on a quick read-through, it looks like
play_media
uses hass to actually play the media. Would it not make more sense to useplexapi
?Probably related feature request
The text was updated successfully, but these errors were encountered: