Roku, Plex and Automated script

I am trying to find someone that was able to play a movie/tvshow through a script. I want to run an automated script on HA to play a PLEX movie/show “also random would be cool” on my roku device. I just cant find anyone that has done it on a roku device.

I can get it to open the Plex app but it will not play a movie or tv show. All the disney and netflix apps I can get a show to play but not plex. Any advise or code for me to try?

Here is an example how disney works for me.

alias: Play Bluey On Living Room TV
sequence:
  - service: remote.turn_on
    metadata: {}
    data: {}
    target:
      device_id: cede71f7dea1a5a8a758f90688dfe71e
  - service: media_player.play_media
    data:
      media_content_id: "291097"
      media_content_type: app
      extra:
        content_id: c9b9104c-e334-457c-8c8a-5689de962a26
        media_type: episode
    target:
      device_id: cede71f7dea1a5a8a758f90688dfe71e
  - delay:
      hours: 0
      minutes: 0
      seconds: 25
      milliseconds: 0
  - condition: not
    conditions:
      - condition: state
        state: playing
        entity_id: media_player.living_room_roku
  - service: remote.send_command
    data:
      command: select
    target:
      device_id: cede71f7dea1a5a8a758f90688dfe71e
mode: single
icon: mdi:play-pause

ha ha, I asked you about how you got the Disney Content ID in July and now I’m trying to get movies playing in Plex… you just have the same problems before me… Did you figure out playing in plex?

This is what I use to get random TV episodes to play for my son.

service: media_player.play_media
metadata:
  title: Paw Patrol
data:
  media_content_id: >-
    { "library_name" : "TV Shows", "show_name": "Paw Patrol", "shuffle": "1",
    "maxresults": 1 }
  enqueue: replace
  media_content_type: EPISODE
target:
  entity_id: media_player.plex_plex_for_android_tv_chromecast_google_tv
enabled: true

Sorry, life has been busy! I been playing on HA for the last week trying to fix stuff that have broken over the past 5 months since I have not been paying attention to it. I have not figured out plex yet but just read rujelus22’s comment and will try that. I wont get my hopes up and hoping for more posts to come just in case.