Plex can't find unwatched on a single series, all others work

Hi there,

I setup the Plex integration, and it sees my server and connected players fine. I want to setup a script that will play the next, unwatched show from a series “The West Wing”. following the recipe in the docs i have:

service: media_player.play_media
data:
  entity_id: media_player.plex_home_plex_for_apple_tv_family_room
  media_content_type: EPISODE
  media_content_id: >-
    { "library_name" : "TV Shows", "show_name": "The West Wing",
    "episode.unwatched": true, "episode.inProgress": [true, false], "sort":
    "addedAt:asc", "maxresults": 1 }

I get the following error:

[139841100997440] Media could not be found: { "library_name" : "TV Show", "show_name" : "The West Wing", "episode.unwatched": true, "episode.inProgress": [true, false], "sort": "addedAt:asc", "maxresults": 1 }

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 190, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1630, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1667, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 282, in service_handler
    await script_entity.async_turn_on(
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 386, in async_turn_on
    await coro
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 412, in _async_run
    return await self.script.async_run(script_vars, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1253, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 354, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 372, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 575, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1630, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1667, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  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 668, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 705, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 720, in async_play_media
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/plex/media_player.py", line 523, in play_media
    raise HomeAssistantError(f"Media could not be found: {media_id}")
homeassistant.exceptions.HomeAssistantError: Media could not be found: { "library_name": "TV Shows", "show_name": "The West Wing", "episode.unwatched": true, "episode.inProgress": [true, false], "sort": "addedAt:asc", "maxresults": 1 }

However, if I substitute any other series, it works fine. I’ve tested that I can play a single episode of The West Wing this way, by specifying something like season 1, episode 1, but trying to find the first unwatched episode doesn’t work.

I’ve tried marking all seasons except one watched, just to make sure it wasn’t having problems with too many results. No luck. I’ve even tried other shows with 7+ seasons, and they work fine also.

Anyone have any ideas what to try? I’m going crazy here. Thanks in advance.

Okay, I figured it out. The search is only against the owner’s library watched/unwatched status. Player is logged in as a managed user named ‘Home’. The advanced search was against the owner user’s library status.

Is there any way to specify your search as another user?