đź—Ł Play Plex media on your media player using Assist voice command

Main features

Play any Plex media on a media player of your choice using an Assist voice action.
The media player has to support this action for the command to work.
Both Movies and TV Shows are supported.
The automation will first try to find a TV Show, if it cannot be found it will try to find the movie by the media title.

Voice command

To play a movie or a TV show use the following Assist command:
Play {title} on Plex

Importing

Click the badge to import this Blueprint:

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Or import this Blueprint by using the Gist URL.

Limitations

  • It is required to enter both a Movies and TV Shows library, not just one of both.
  • The voice command itself is not customizable yet, but I will probably add that later.

F.A.Q.

To be added.

Changelog

  • 2023-08-03: Initial version
  • 2023-08-07: Added support for using blueprint for multiple different media players by setting media player friendly name to trigger on.

If you have any issues or questions, please let me know :slight_smile:

4 Likes

Can I add multiple TVs for media player?

Not with the old version, but I’ve now created a new version of the blueprint that supports setting a media_player_friendly_name. This way you can create multiple automations from the blueprint for multiple media players. I wanted to try to add support for a fully customized trigger sentence, but that does not seem to be supported by the conversation trigger currently. Please try the new version and see if it works for you :slight_smile:

1 Like

How do i get the new version?

Re-import the blueprint to get the new version. There is no update mechanism for blueprints yet…

True, but maybe you can include some “version number” in the description as blacky does on his blueprints, so at least the user has a clearer indicator to know if they are on the last version.

Also, after a reimport, you might need to reload automations to be sure the last blueprint is loaded up to use.

Btw, great job with this blueprint :raised_hands::tada::grin:

I have updated the blueprint but still the same results. When I give it a command it says done and the logs says it completed the task but nothing on my tv moves or plays anything?

Do you get errors in the home assistant logs? Possibly your media player does not support this action. Not all of my media players do, for instance a nest hub works but my Nvidia shield does not. In that case I get an error in the logs that this action is not supported for that media player.

I’m using Plex from my LG TV Appstore. There were errors. I will find the logs.

Can you add Jellyfin and Emby to this too?

1 Like

I don’t think so, since the blueprint depends on the media_player.play_media service. Shortly googling it seems Emby nor Jellyfin support this. But if I’m wrong it should be possible to create a blueprint that does the same thing for those systems.

1 Like

Is it posible to control it using alexsa?

You are right, unfortunately the jellyfin addon is a bit lacking

I imported the new blueprint and configured 2 automations with different media players and media player friendly names, however when using assist to call one of them plex always streams on the same device(but both the automations created are called). Am I doing something wrong?

Later edit: if it helps i stream to the media players created by the plex media server integration. i can see in the logs sometimes that it skips one of them cause it s not available. but even when they both are only one receives the stream regardless of what i chose as the speaker)

great idea. but somehow it’s not working for me at all … the player is not reachable or smth :frowning:

I am also using Plex TV APP on my LG C9. My TV powers on using remote.harmony_hub but it won’t open plex or launch a show at all. just sits at the home screen of the TV. I am wondering/guessing it is a lack of support on the LG side. I am guessing this blueprint would work great on an Android streaming box or Apple TV etc as home assistant has more control over them. anymore troubleshooting I can provide let me know

EDIT I maybe using a different blueprint

This works great for me with 2x Nvidia Shields and an android TV. I’ve created 3 automations with friendly names, and voice assistant can play to any of the 3. The caveat is when all 3 friendly names are idle and I ask to play one of the rooms, all 3 start playing the same movie. once that happens, I can use a voice command to change by friendly name. Any ideas how to stop this from happening? Woke the wife up with Top Gun Maverick at 1am in the bedroom asking for it in my man cave LOL! all 3 rooms woke up to jet engines :slight_smile: Thanks!

Here is a fixed .yaml for this so it doesn’t play a title on every TV at the same time. Also added synonyms to isolate things better like “the bedroom TV” if the spoken word is different. Sorry I don’t know how to create the blueprint to install so just follow these directions and paste the yaml into a new file.

How to install it
1. In HA, open File Editor (or Samba/VS Code) and create this file:
/config/blueprints/automation/plex_assist_guard/plex_assist_guard.yaml
2. Paste the YAML below and save.
3. Go to Settings → Automations & Scenes → Blueprints → Import Blueprint → “Filesystem” (top-right menu) → it will appear as Play Plex media using Assist (guarded).
4. Create one automation per room and fill the UI (media player, friendly name, libraries).
5. Test by saying: “Play Inception on bedroom tv.”

.yaml

blueprint:
  name: Play Plex media using Assist (guarded)
  description: >
    Play any Plex media on a chosen media player via Assist. TV shows first (unwatched),
    then fall back to movies. Includes a guard so only the matching room runs.
  domain: automation
  input:
    media_player:
      name: Media player
      description: Media player on which to start Plex playback
      selector:
        entity:
          domain: media_player
    media_player_friendly_name:
      name: Media player friendly name
      description: The spoken name this automation should respond to (e.g., "bedroom tv")
      default: bedroom tv
      selector:
        text:
    media_player_synonyms:
      name: Optional synonyms for this room
      description: Other ways you might say the room/player (e.g., "the bedroom tv")
      default: []
      selector:
        select:
          multiple: true
          custom_value: true
          options: []
    movies_library_name:
      name: Movies library name
      description: The name of your Plex Movies library
      default: Movies
      selector:
        text:
    tvshows_library_name:
      name: TV Shows library name
      description: The name of your Plex TV Shows library
      default: TV Shows
      selector:
        text:

mode: restart
max_exceeded: silent

variables:
  target_media_player: !input media_player
  target_movies_library: !input movies_library_name
  target_tvshows_library: !input tvshows_library_name
  friendly_name_cfg: !input media_player_friendly_name
  synonyms_cfg: !input media_player_synonyms

trigger:
  - platform: conversation
    command:
      - "Play {plex_media_name} on {media_player_assist_name}"

action:
  # ---- Guard: only continue if the spoken player name matches this automation ----
  - alias: "Guard: ensure spoken player name matches this automation"
    condition: template
    value_template: >
      {% set said = (trigger.slots.media_player_assist_name | default('', true) | lower | trim) %}
      {% set mine = (friendly_name_cfg | default('', true) | lower | trim) %}
      {% set alts = (synonyms_cfg | default([], true)) | map('lower') | map('trim') | list %}
      {{ said == mine or said in alts }}

  # ---- Try TV shows first: next unwatched episode ----
  - service: media_player.play_media
    continue_on_error: true
    target:
      entity_id: !input media_player
    data:
      media_content_type: tvshow
      media_content_id: >-
        plex://{"library_name": "{{ target_tvshows_library }}",
                 "show.title": "{{ trigger.slots.plex_media_name }}",
                 "episode.unwatched": true,
                 "allow_multiple": 1 }

  # Wait up to 10s to see if playback actually started
  - wait_template: "{{ is_state(target_media_player, 'playing') }}"
    timeout: "00:00:10"
    continue_on_timeout: true

  # ---- If not playing yet, fall back to Movie ----
  - if:
      - "{{ not wait.completed }}"
    then:
      - service: media_player.play_media
        continue_on_error: true
        target:
          entity_id: !input media_player
        data:
          media_content_type: movie
          media_content_id: >-
            plex://{"library_name": "{{ target_movies_library }}",
                     "movie.title": "{{ trigger.slots.plex_media_name }}" }
  • Only the automation whose friendly name (or synonyms) matches what you said will fire.
  • You can now type synonyms directly into the UI chips box.

Enjoy!

Pause all automations from the old blueprint, and add new automations from this new blueprint " Guarded"

1 Like