core: Calling `play_media` for Plex devices doesn't update Plex Server

The problem

If you call play_media with a media_player.plex* device, the media will play, but the Plex Server won’t show that any clients are playing in the Dashboard. Because media_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

  • Home Assistant release with the issue: 0.105.0
  • Last working Home Assistant release (if known): Unknown, but I think this was working a week or so ago.
  • Operating environment (Hass.io/Docker/Windows/etc.): Pi 3b+
  • Integration causing this issue: Plex
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/plex/
  • Plex Server Version: 1.18.5.2309

Problem-relevant configuration.yaml

N/A

Traceback/Error logs

Nothing relevant. After calling play_media:

2020-02-07 09:20:45 DEBUG (SyncWorker_18) [homeassistant.components.plex.server] Updating devices
2020-02-07 09:20:45 DEBUG (SyncWorker_18) [homeassistant.components.plex.server] Refreshing XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-com-plexapp-android
2020-02-07 09:20:45 DEBUG (SyncWorker_18) [homeassistant.components.plex.server] Refreshing XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-com-plexapp-android
2020-02-07 09:20:45 DEBUG (MainThread) [homeassistant.components.plex.media_player] Refreshing media_player.plex_living_room [<PlexClient:http://XX.XX.XX.X::Living-Room> / None]
2020-02-07 09:20:45 DEBUG (MainThread) [homeassistant.components.plex.media_player] Refreshing media_player.plex_rec_room [<PlexClient:http://XX.XX.XX.X::Rec-Room-TV> / None]
2020-02-07 09:20:45 DEBUG (SyncWorker_17) [homeassistant.components.plex.sensor] Refreshing sensor [sensor-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX]

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 use plexapi?

Probably related feature request

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 27 (13 by maintainers)

Most upvoted comments

@jjlawren That’s my experience, as well. Still getting the error I mentioned above

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 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.