❱ Plex Assistant

Hey man I just wanted to say this integration is awesome.

I tried playing around with python several times over the years, tried to use Phlex with moderate success till it stopped working, but this integration has been done right, well done and thank you

1 Like

Hi @mayker

what does this error mean? i receive it now when i restart HA :

2021-08-26 09:25:26 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Synology for plex_assistant
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/plex_assistant/__init__.py", line 79, in async_setup_entry
    pa = await hass.async_add_executor_job(pa_executor, server, list(start_script.keys()))
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/plex_assistant/__init__.py", line 75, in pa_executor
    get_devices(hass, _pa)
  File "/config/custom_components/plex_assistant/helpers.py", line 50, in get_devices
    for entity in list(hass.data["media_player"].entities):
KeyError: 'media_player'

EDIT:
seems already a bug report here:

EDIT 2
i may have found the culprit, but no idea to solve it
i yesterday installed a new media_player in config, if i comment it out, then plex assistant works
if i add the config back, plex assistant throws an error

media_player:
    - platform: linkplay
      host: !secret arylica50
      name: Luidspeker_Buiten
      volume_step: 5
      sources: 
        {} 

created also issue thread on that other component:

I apologize for any stupid questions. I’m new to Home Assistant (on a Home Assistant Blue) and don’t quite understand how to properly write and start a script for Plex Assistant. I have read the most relevant threads on the Home Assistant forum, but still don’t know exactly what to so.

I’ve created a script, “Welcome to Plex.” I set the Icon to “hass:cast” and Mode to “Single (default.) For the sequence, I try to call the service “media_player.play_media,” with the entity “Plex (Plex for Android (TV) - SHIELD Android TV)” as the target. I left Content ID and Content type blank. I want to wake the SHIELD and play a requested title in Plex—for content in either my Movies or Shows libraries. I want to make sure specifying the media_content_type and media_content_id allow me to start playback in either library.

I would also like to delay playback after waking the SHIELD (if Plex was unavailable), so my receiver can turn on. (I initially got Plex Assistant to work before, but I noticed it would transcode audio if I waked the SHIELD.) Can someone show me what have to write when I open “Edit in YAML” in Scripts on a web browser?

Lastly, I noticed if I attempted to use Plex Assistant via (Google Home) voice control while Plex was currently playing something, the SHIELD would back out of the content it was playing, but there would only be audio playback in the background. How could I write a script that stops playback in Plex if it is currently playing something before using the “media_player.play_media” service. I am hoping this would eliminate the audio-only background playback issue.

I apologize if these are stupid questions. Thanks in advance for your time and help.

Using control commands with and without keyword replacements through IFTTT runs into an error. Webhook gets sent to Home Assistant however does not run on Plex Assistant. Any insight here please?

Error executing service: <ServiceCall plex_assistant.command (c:5c408d90a04edce61f06496a11ec1e60): command=next episode> Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/core.py", line 1652, in catch_exceptions await coro_or_task File "/usr/src/homeassistant/homeassistant/core.py", line 1677, in _execute_service await self._hass.async_add_executor_job( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/plex_assistant/__init__.py", line 128, in handle_input remote_control(hass, zeroconf, command["control"], device, jump_amount) File "/config/custom_components/plex_assistant/helpers.py", line 127, in remote_control cast_next_prev(hass, zeroconf, plex_c, device, "next") File "/config/custom_components/plex_assistant/helpers.py", line 109, in cast_next_prev uuids=[uuid.UUID(entity._cast_info.uuid)], zeroconf_instance=zeroconf File "/usr/local/lib/python3.9/uuid.py", line 174, in __init__ hex = hex.replace('urn:', '').replace('uuid:', '') AttributeError: 'UUID' object has no attribute 'replace'

Using IFTTT
Installed using HACS
Raspberry Pi 3B+ Server

Plex assistant plays media fine, but does not skip, or go previous.
Have tried with and without keyword replacements, keyword replacement below
"next episode":"next", "previous episode":"previous"

Thanks for this integration @mayker .

I think followed the documentation closely, and everything works! :smile: so maybe I did read everything. but…

Just one thing, if i say “Okay google, tell plex TO play adele on study speaker” then it will play something else, currently it will play the 1975, which i think is linked to the last thing plex server played - unsure.

but if i remember not to say TO, so instead “Okay google, tell plex play adele on study speaker” then it does just that. Unfortunately sometimes google will add the “TO” word and I get the 1975 instead.

not seen anyone else mention this, any ideas? thanks again.

Hello,

@mayker
thank you for your nice integration.

i use alexa echos, i read in the last posts that you are working an a alexa Skill?
or gives a workaround without node-red?

i see someone postet a issue on github with the alexa integration support, but with node-red.
Enable Alexa Support · Issue #109 · maykar/plex_assistant (github.com)

but for me and my alexa system is this not useable.

edit
@trueppp

i answerd to your post on github with the node-red flow, i added the flow in node-red, but what do you mean with " publically avaiaible node-red https endpoint" in the skill?

no one?

use this no one with alexa echos and a skill?

Fix resume for movies, shows, episodes.
Use my fork of the repo: https://github.com/isorin/plex_assistant
The original repo is read-only now and doesn’t accept pull requests.

3 Likes

are you going to add it to HACS also ?

Is it still working? I tried to add plex_assistant from isorin’s fork but got this error :

Config flow could not be loaded: undefined

and here is the log :

Hi,

I have just upgraded to HA Core 2022.7, and plex assistant wouldn’t load anymore.
Log shows,

Setup failed for custom integration plex_assistant: Requirements for plex_assistant not found: [‘rapidfuzz==1.1.1’].

Which appeared after the upgrade and plex assistant doesn’t work at all.
Anybody seeing this issue?
Thanks.

Yes, it seems that Rapidfuzz v 1.1.1 is somewhat old. I checked the release notes for v2 (since it’s a major version bump) and didn’t find any breaking changes that were pertinent to Plex Assistant’s usage of the library. I was doing some testing yesterday and so far it seems that v2.0.8 is working fine. At some point today I was going to open a PR to @isorin’s repo to bump it.

In the interim, since this is a custom component, you can go into the custom_components/plex_assistant/manifest.json and manually change rapidfuzz==1.1.1 to rapidfuzz>=2.0.0 (or strict equal) and restart HA and it should work again.

1 Like

Thank you @breakthestatic

I have got it work with that manifest.json change.

Thanks for this fix, I had the same issue.

FYI - opened up a PR for this: https://github.com/isorin/plex_assistant/pull/1.

Thanks for getting this back up and running. Got this implemented tonight but I have significant latency between issuing the command and execution. I’d say 10-15 seconds +/- a few seconds.

I’m using a Pi 3b for HA, IFTTT, the commands are being issued to a Plex Client on a Shield Pro (wired), and my media library is about 30TB hosted locally on a Ubuntu server (with Plex Server).

The latency is consistent regardless of issuing a command like ‘pause’ or a command to play a specific media file. Any idea where the latency may be coming from?

Edit:. Wanted to clarify that even when issuing a service command from HA I get a significant 10-15 second delay before execution.

Thank you so much. this saved me potentially months of searching.

Has anyone else seen the changes coming for the Google Assistant IFTTT service? Looks like it will effectively break this integration since the new Google Assistant V2 IFTTT service only offers a scene activation trigger and, most importantly, doesn’t allow variable input. This means we’re effectively blocked from passing info like the media title, desired player, etc. from Google to HA. Not sure if there are any alternative services that could be used (or writing a custom assistant app - although even that seems like something google is going to shut down sooner than later - Google is shutting down Assistant's Conversational Actions in favor of App Actions for Android)

Edit:
I forgot that DialogFlow was an alternative option, but I think that is just the same thing as a Conversational Action (which is going away)

3 Likes

Such a shame. A lot of effort has gone into this piece of work and it’s exactly what I’m looking for (I have 4 Google Home Mini dotted around the house).
…but it looks like some moneygrabbers looking to push their own hardware on us, have kyboshed it.

Yup, looks like all methods have either come to an end or are about to be.