❱ Plex Assistant

Hello. I am new to Home Assistant and stumbled upon it by looking for an alternative to Flex TV. I am running VirtualBox on my Plex Server. I have HA setup just fine, I am able to access the frontend and I’ve already setup quite a few devices on my network for automation. I seem to be running into an issue getting Plex Assistant to show in the Integrations tab. I was able to get hacs installed and configured but I cannot locate Plex Assistant yet. I also cloned git data to the Custom_components folder as well, but I still cannot get it to show either. The IFTTT portion is already configured, I think the last piece of the puzzle (without testing the cast devices yet) is getting Plex Assistant to function. Would you happen to have any insight?

Plex Assistant will not appear in HA’s integrations tab. To install with HACS: click on the integrations section in HACS, hit the plus sign in the bottom right, search for “Plex Assistant”, click the result and then “install this repository in HACS”. Then follow the instructions in the readme on how to add the config to your configuration.yaml file. You will need to restart after installing and editing configuration.yaml.

If after successful install and configuration you’re still having issues, check your logs to see if there are any errors and report them here or as an issue on this projects github. Also, be sure to add the companion sensor to your configuration.yaml as well if you need help identifying devices.

Thank you for your quick response! I have no idea how I missed that. Once I actually navigated to HACS I easily installed Plex Assistant. ANother question if you don’t mind. I was able to enter the information into my configuration.yaml file, but only the IFTTT portion.

I get an error for the HOME ASSISTANT CONVERSION SETUP stating “bad indentation of a sequence entry” next to “intent script” My config file looks like this:

Configure a default setup of Home Assistant (frontend, api, etc)

default_config:

Text to speech

tts:

  • platform: google_translate

group: !include groups.yaml

automation:- alias: Plex Assistant Automation

trigger:

  • event_data:

    action: call_service

    event_type: ifttt_webhook_received

    platform: event

condition:

condition: template

value_template: “{{ trigger.event.data.service == ‘plex_assistant.command’ }}”

action:

  • data_template:

    command: “{{ trigger.event.data.command }}”

    service_template: ‘{{ trigger.event.data.service }}’

script: !include scripts.yaml

scene: !include scenes.yaml

conversation:

intents:

PlexAssistant:

 # These trigger commands can be changed to suit your needs.

 - Tell Plex to {command}

 - {command} with Plex

intent_script:

PlexAssistant:

speech:

  text: Command sent to Plex.

action:

  service: plex_assistant.command

  data_template:

    command: "{{command}}"

Do I have them in the wrong order? Sorry for being so dense pertaining to this.

So it seems like there might be some indentation issues according to the error, but it’s impossible to tell you where or what else might be wrong since your code was not formatted as a code block.

Place three backticks before pasting in your code ``` and after the last line of your code.

Alternatively, you can highlight all the code you are trying to post and click this icon above the post editor:image

This will format it so that I can help you troubleshoot your issue.

Sorry for that. Here is the current setup I have.

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation:- alias: Plex Assistant Automation
trigger:
- event_data:
    action: call_service
  event_type: ifttt_webhook_received
  platform: event
condition:
  condition: template
  value_template: "{{ trigger.event.data.service == 'plex_assistant.command' }}"
action:
- data_template:
    command: "{{ trigger.event.data.command }}"
  service_template: '{{ trigger.event.data.service }}'
script: !include scripts.yaml
scene: !include scenes.yaml

```conversation:
  intents:
    PlexAssistant:
     # These trigger commands can be changed to suit your needs.
     - Tell Plex to {command}
     - {command} with Plex

intent_script:
  PlexAssistant:
    speech:
      text: Command sent to Plex.
    action:
      service: plex_assistant.command
      data_template:
        command: "{{command}}"```

Don’t use ``` in your actual yaml file, only use it in the forums to properly format code so that it is readable and includes proper indentation (I use it for the code block below). Indentation and format is very important and your code had quite a few issues (fixed it up below).

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml

automation:
  - alias: Plex Assistant Automation
    trigger:
    - event_data:
        action: call_service
      event_type: ifttt_webhook_received
      platform: event
    condition:
      condition: template
      value_template: "{{ trigger.event.data.service == 'plex_assistant.command' }}"
    action:
    - data_template:
        command: "{{ trigger.event.data.command }}"
      service_template: '{{ trigger.event.data.service }}'

script: !include scripts.yaml
scene: !include scenes.yaml

conversation:
  intents:
    PlexAssistant:
     # These trigger commands can be changed to suit your needs.
     - Tell Plex to {command}
     - {command} with Plex

intent_script:
  PlexAssistant:
    speech:
      text: Command sent to Plex.
    action:
      service: plex_assistant.command
      data_template:
        command: "{{command}}"

Also, I only see the configuration for the IFTTT webhook and the Conversation integration. I don’t see Plex Assistant’s main configuration anywhere in there.

Instructions on how to configure Plex Assistant and an example of its config can be found at the start of the readme in the configuration section.

I would recommend trying to get familiar with Home Assistant before starting to use it just for just this integration. Though I understand that Plex Assistant might be the only alternative to FlexTV at the moment and that’s what pushed me to make it, at some point I will be making this into a stand alone project. There’s still a fair bit of work to do until then, but it might be worth waiting for.

Home Assistant’s documentation can be lacking in some areas, but it is still a great starting point. It looks like you got through the first few steps, so you might want to start here. Another good bit of information can be found in the first pinned post on these forums:

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question

Again, thank you very much! I was able to enter the Plex Assistant’s main configuration in the file with no errors. After some testing, I am unable to get the shows or movies to cast. I cannot find anything in the log that relates to it. I believe it may be getting caught up at IFTTT at this point as I am not even getting a notification that the applet is running.

default_config:

  # Text to speech
  tts:
    - platform: google_translate
  
  group: !include groups.yaml
  
  automation:
    - alias: Plex Assistant Automation
      trigger:
      - event_data:
          action: call_service
        event_type: ifttt_webhook_received
        platform: event
      condition:
        condition: template
        value_template: "{{ trigger.event.data.service == 'plex_assistant.command' }}"
      action:
      - data_template:
          command: "{{ trigger.event.data.command }}"
        service_template: '{{ trigger.event.data.service }}'
        plex_assistant:
          url: 'http://127.0.0.1:32400'
          token: '######################################## REDACTED'
          default_cast: 'Player 2'
          language: 'en'
          tts_errors: true
          aliases:
            Mancave TV: Samsung UN55MU8000
            Nursery TV: Nursery
            sensor:
              - platform: plex_assistant

I’m just posted that for a verification but I will continue to look into the issue. I don’t want to bother you more today. I really appreciate your time assisting me with this thus far. And thank you as well for the links provided. I will get more familiar with HA definitely, I think I may have been too excited to finally have found an answer to my Plex + Google Home matchmaking quest and laser focused on that.

Here’s my last hint and it comes with a tip: Don’t ever post your api key, token, or any other personally identifiable information here or anywhere else. If that was your real plex token invalidate it and get a new one.

default_config:

# Text to speech
tts:
  - platform: google_translate
  
group: !include groups.yaml

plex_assistant:
  url: 'http://127.0.0.1:32400'
  token: ######################################## REDACTED
  default_cast: 'Player 2'
  language: 'en'
  tts_errors: true
  aliases:
    Mancave TV: Samsung UN55MU8000
    Nursery TV: Nursery

sensor:
  - platform: plex_assistant

automation:
  - alias: Plex Assistant Automation
    trigger:
    - event_data:
        action: call_service
      event_type: ifttt_webhook_received
      platform: event
    condition:
      condition: template
      value_template: "{{ trigger.event.data.service == 'plex_assistant.command' }}"
    action:
    - data_template:
        command: "{{ trigger.event.data.command }}"
      service_template: '{{ trigger.event.data.service }}'

Geez… I definitely did not mean to put that part in there. I’ve since rectified that. Good looking out man. Thank you again!!!

not sure what I am doing wrong here but I have many cast devices/clients and I am only seeing 1 my Nvidia Shield and I cant even control that 1. When I ask it to play a movie nothing plays/

The Nvidea Shield Plex “app” would need to be open to receive commands, if it is do you get any errors? Also, see this post above for info on how to enable Plex Assistant’s debug logs.

Make sure you’re updating the plex assistant companion sensor as per the docs as well.

Plex Assistant relies on the Pychromecast library for discovery of Google’s Cast devices. There are a handful of open issues on that github that may point you in the right direction to help troubleshoot, may also want to search closed issues:

Should I look into the troubleshooting even if HA is seeing all of my devices? Its just Plex Assistant that is not. I do see this error in the logs.

Logger: root
Source: custom_components/plex_assistant/helpers.py:17
First occurred: 11:18:33 AM (1 occurrences)
Last logged: 11:18:33 AM

Uncaught thread exception
Traceback (most recent call last):
File “/usr/local/lib/python3.8/threading.py”, line 932, in _bootstrap_inner
self.run()
File “/usr/local/lib/python3.8/site-packages/zeroconf/init.py”, line 1721, in run
self._service_state_changed.fire(
File “/usr/local/lib/python3.8/site-packages/zeroconf/init.py”, line 1479, in fire
h(**kwargs)
File “/usr/local/lib/python3.8/site-packages/zeroconf/init.py”, line 1577, in on_change
listener.add_service(*args)
File “/usr/local/lib/python3.8/site-packages/pychromecast/discovery.py”, line 65, in add_service
self._add_update_service(zconf, typ, name, self.add_callback)
File “/usr/local/lib/python3.8/site-packages/pychromecast/discovery.py”, line 123, in _add_update_service
callback(uuid, name)
File “/usr/local/lib/python3.8/site-packages/pychromecast/init.py”, line 242, in internal_callback
callback(
File “/config/custom_components/plex_assistant/helpers.py”, line 17, in cc_callback
PA.clients = PA.server.clients()
AttributeError: ‘NoneType’ object has no attribute ‘clients’

Plex Assistant uses Pychromecast to find Google cast devices and doesn’t use HA’s media_player entities. This is because playing Plex media on Chromecast media_player entities is currently unsupported in HA.

The error you are receiving there is possibly unrelated, but I am aware of it and it should be fixed in the next release.

I think I’m almost there, but I’m new to home assistant (installing just for this plugin). Maybe this is an obvious question but how do you allow access to HA from the IFTTT webhook? The webhook URL needs to be public facing but the one HA gives during the IFTTT setup contains the local IP address. Using this URL (http://192.168.X.X:8123/api/webhook/[long string of characters]) gives “Action failure message: Unable to make web request: Error: ETIMEDOUT”. I assume it times out because it obviously cannot reach this local URL. What’s the best way to solve this or am I totally off base?

I’m using a Raspberry Pi with HA installed using Docker, if that info is helpful.

You need to use a dns to access your ha instance from outside and open a port in firewall… Or use nabucasa

Thank you fabio, it was a hell of a ride but I think I got it working!

I had a feature suggestion: Play On Deck by default (if an On Deck entry exists).

For example, if I had been watching “The Office” - I have S03E04 “On Deck”, but if I say “Hey Google Tell Plex to Play The Office (US)”, it starts from S01E01. Using the command “Hey Google Tell Plex to play The Office (US) On Deck” works great for this but is a little verbose. It also would be great if it resumed instead of started from the beginning. For now I made a routine for some key shows in the Google home app.

Also, “Jump forward” seems to crash with a gray screen. Thanks again for writing this, it’s awesome finally having voice control for Plex media!

I’ve been working on adding the ability for continuous play (this would be preferred rather than relying on onDeck), but it may be a bit as it still requires a PR to a home assistant library, as well as 2 PRs to update that library and and another it relies on to all be pulled into an HA release.

I’ll look into your jump forward issue (maybe add an issue to the Github) and you should add a feature request on the Github for the resume playback feature.

Also, if you’re just using onDeck to watch the next unwatched episode, it’s unnecessary. Just saying "Hey Google Tell Plex to Play Office U.S." will by default play the first episode marked as unwatched in Plex.

Hi @maykar,
This is great and I’ve set it up, its play on my tv yet my issue is plex doesn’t know anything is playing, why would this be?

I have an LG OLEDCX

Not sure what the issue might be, are you saying that while playing on that TV it doesn’t show any media in the Plex activity dashboard? I just used Plex Assistant to cast to a Chromecast, a Chrome browser, and the Windows app then checked the activity dashboard. All of the devices show there just fine.

1 Like