Plex Media Server Docs Not Working For TV Episode?

Hi, I have been struggling over the last couple of days trying to get the TV Episode code to work following all the HA documentation. Everything else works GREAT such as calling for a specific movie, a playlist, a specific song (note: only works for me if you use the track number instead of track name).

Here is the TV Episode code I follow from the HA Documentation:

entity_id: media_player.my_plex_player_here
media_content_type: EPISODE
media_content_id: '{ "library_name": "TV Shows", "show_name": "Paw Patrol", "season_number": 3, "episode_number": 4 }'

I get the following error every time no matter which show, season or episode I select (I do verify all spelling and that the seasons/episodes are there). The weird thing is… if I delete the episode number section of the code, the show’s season will play correctly just with a random episode.

Log Details (ERROR)
Logger: homeassistant.components.websocket_api.http.connection
Source: components/plex/server.py:594
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 5:40:56 PM (8 occurrences)
Last logged: 5:45:41 PM

[139831617181824] 'NoneType' object has no attribute '_checkAttrs'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 136, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1455, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1490, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 215, in service_handler
    await script_entity.async_turn_on(
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 320, in async_turn_on
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1033, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 246, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 254, in _async_step
    await getattr(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 464, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1455, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1490, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 595, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 632, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 630, in async_play_media
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/plex/media_player.py", line 517, in play_media
    playqueue = self.plex_server.create_playqueue(media, shuffle=shuffle)
  File "/usr/src/homeassistant/homeassistant/components/plex/server.py", line 594, in create_playqueue
    return plexapi.playqueue.PlayQueue.create(self._plex_server, media, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/plexapi/playqueue.py", line 181, in create
    uuid = items.section().uuid
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 519, in section
    return self._server.library.sectionByID(self.librarySectionID)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 396, in __getattribute__
    self.reload()
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 280, in reload
    self._loadData(data[0])
  File "/usr/local/lib/python3.8/site-packages/plexapi/video.py", line 768, in _loadData
    self.media = self.findItems(data, media.Media)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 222, in findItems
    item = self._buildItemOrNone(elem, cls, initpath)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 93, in _buildItemOrNone
    return self._buildItem(elem, cls, initpath)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 78, in _buildItem
    return cls(self._server, elem, initpath, parent=self)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 51, in __init__
    self._loadData(data)
  File "/usr/local/lib/python3.8/site-packages/plexapi/media.py", line 65, in _loadData
    self.parts = self.findItems(data, MediaPart)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 222, in findItems
    item = self._buildItemOrNone(elem, cls, initpath)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 93, in _buildItemOrNone
    return self._buildItem(elem, cls, initpath)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 78, in _buildItem
    return cls(self._server, elem, initpath, parent=self)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 51, in __init__
    self._loadData(data)
  File "/usr/local/lib/python3.8/site-packages/plexapi/media.py", line 148, in _loadData
    self.streams = self._buildStreams(data)
  File "/usr/local/lib/python3.8/site-packages/plexapi/media.py", line 156, in _buildStreams
    items = self.findItems(data, cls, streamType=cls.STREAMTYPE)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 222, in findItems
    item = self._buildItemOrNone(elem, cls, initpath)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 93, in _buildItemOrNone
    return self._buildItem(elem, cls, initpath)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 78, in _buildItem
    return cls(self._server, elem, initpath, parent=self)
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 51, in __init__
    self._loadData(data)
  File "/usr/local/lib/python3.8/site-packages/plexapi/media.py", line 373, in _loadData
    if self._isChildOf(etag='Track'):
  File "/usr/local/lib/python3.8/site-packages/plexapi/base.py", line 124, in _isChildOf
    if obj._checkAttrs(obj._data, **kwargs):
AttributeError: 'NoneType' object has no attribute '_checkAttrs'

What version of HA are you running? I need to make sure I’m looking at the correct library release.

From the traceback it’s finding the episode fine, but there’s an issue in the library when creating the playqueue used to start playback.

Hi…looks like it’s version 2021.2.3,

Strange, I can’t reproduce this problem when picking specific episodes to play. You said this happens with every show you’ve tried?

At a quick glance it seems like it’s failing when it’s building up the media parts/streams. This might mean it’s specific to the Plex server version or the media itself. What Plex server version are you running?

Hi,
I’m running Plex Version 4.52.2

That’s the Plex Web version. Check Settings->General to see the server version.

Sorry about that…here it is Version 1.21.1.3876

I believe this is already fixed in the current release of the plexapi library (https://github.com/pkkid/python-plexapi/pull/656). Try updating HA to 2021.3.X as it’s already included.

Thank you…I really appreciate all your time on this. I’ll upgrade now and let you know the results.

Thank you so much @jjlawren it worked flawlessly. Man that was driving me nuts…thanks again !!!

1 Like