core: Plex broken for media_player.play_media

Home Assistant release with the issue:

0.85.0.dev0 (Fresh pull)

Last working Home Assistant release (if known): Not known

Operating environment (Hass.io/Docker/Windows/etc.):

(home-assistant) max@ubuntu:~/forks/home-assistant$ uname -a
Linux ubuntu 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
(home-assistant) max@ubuntu:~/forks/home-assistant$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"

Dev environment set from the dev guide.

Component/platform:

https://www.home-assistant.io/components/media_player.plex/

Description of problem: Cannot call service media_player.play_media on a plex client The plexapi library seems to have changed? some attributes are prefixed with an underscore, which the current plex.py doesn’t address. This seems related to #16250. Repro:

  1. Configure plex in Home assistant
  2. Go to the service tool
  3. call media_player.play_media with this service data:
{
  "entity_id": "media_player.chrome",
  "media_content_id": "{\"library_name\": \"Movies\", \"video_name\": \"Baby Shark\", \"shuffle\": \"0\"}",
  "media_content_type": "VIDEO"
}

I’ll submit a PR that fixes that.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant): Auto-discovered

# Discover some devices automatically
discovery:

plex.conf

{
    "192.168.1.150:32400": {
        "ssl": false,
        "token": "xxx",
        "verify": false
    }
}

Traceback (if applicable):

2018-12-28 10:24:46 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/home/max/forks/home-assistant/homeassistant/helpers/service.py", line 288, in _handle_service_platform_call
    await func(entity, data)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/max/forks/home-assistant/homeassistant/components/media_player/plex.py", line 763, in play_media
    media = self.device.server.library.section(
AttributeError: 'PlexClient' object has no attribute 'server'

Once Fixed:

2018-12-28 10:37:06 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/home/max/forks/home-assistant/homeassistant/helpers/service.py", line 288, in _handle_service_platform_call
    await func(entity, data)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/max/forks/home-assistant/homeassistant/components/media_player/plex.py", line 773, in play_media
    self._client_play_media(media=media, shuffle=src['shuffle'])
  File "/home/max/forks/home-assistant/homeassistant/components/media_player/plex.py", line 835, in _client_play_media
    server_url = self.device._server.baseurl.split(':')
AttributeError: 'PlexServer' object has no attribute 'baseurl'

Additional information:

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 31 (13 by maintainers)

Most upvoted comments

Still totally broken HA v. 0.97.2

Still totally broken HA v. 0.98.4

Any progress on this?

Still totally broken in HA v. 0.99.2

sunny beaches. It’s working. Cool.