❱ Plex Assistant

hows everyone finding the speed of this, mine seems to take about 10secs to load anything, is this normal?

where is your lag? is it 10 sec before it actually starts receiving the command? cause then its maybe an delayed iftt issue
or is it actually takes 10 sec after the cast command is received and its loading the movie?

IFTTT and the size of your library will have an effect on speed. Working on stuff now that should speed up library lookups and I’m writing up instructions to set this up with DialogFlow which should be faster than IFTTT.

This typically takes anywhere from 3 secs to 10 secs for me depending what command I give and IFTTT lag.

1 Like

hmm, updated to 107.6 , now receive error below :

2020-03-24 15:53:45 ERROR (MainThread) [homeassistant.setup] Setup failed for plex_assistant: Requirements for plex_assistant not found: [‘python-Levenshtein==0.12.0’].

2020-03-24 15:53:45 ERROR (SyncWorker_3) [homeassistant.util.package] Unable to install package python-Levenshtein==0.12.0: ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8fkqotcp/python-Levenshtein/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8fkqotcp/python-Levenshtein/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-hk8umumg
       cwd: /tmp/pip-install-8fkqotcp/python-Levenshtein/
  Complete output (31 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/Levenshtein
  copying Levenshtein/StringMatcher.py -> build/lib.linux-x86_64-3.7/Levenshtein
  copying Levenshtein/__init__.py -> build/lib.linux-x86_64-3.7/Levenshtein
  running egg_info
  writing python_Levenshtein.egg-info/PKG-INFO
  writing dependency_links to python_Levenshtein.egg-info/dependency_links.txt
  writing entry points to python_Levenshtein.egg-info/entry_points.txt
  writing namespace_packages to python_Levenshtein.egg-info/namespace_packages.txt
  writing requirements to python_Levenshtein.egg-info/requires.txt
  writing top-level names to python_Levenshtein.egg-info/top_level.txt
  reading manifest file 'python_Levenshtein.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*pyc' found anywhere in distribution
  warning: no previously-included files matching '*so' found anywhere in distribution
  warning: no previously-included files matching '.project' found anywhere in distribution
  warning: no previously-included files matching '.pydevproject' found anywhere in distribution
  writing manifest file 'python_Levenshtein.egg-info/SOURCES.txt'
  copying Levenshtein/_levenshtein.c -> build/lib.linux-x86_64-3.7/Levenshtein
  copying Levenshtein/_levenshtein.h -> build/lib.linux-x86_64-3.7/Levenshtein
  running build_ext
  building 'Levenshtein._levenshtein' extension
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/Levenshtein
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.7m -c Levenshtein/_levenshtein.c -o build/temp.linux-x86_64-3.7/Levenshtein/_levenshtein.o
  unable to execute 'gcc': No such file or directory
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for python-Levenshtein
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8fkqotcp/python-Levenshtein/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8fkqotcp/python-Levenshtein/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-90zn9u7d/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/python-Levenshtein
         cwd: /tmp/pip-install-8fkqotcp/python-Levenshtein/
    Complete output (31 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/Levenshtein
    copying Levenshtein/StringMatcher.py -> build/lib.linux-x86_64-3.7/Levenshtein
    copying Levenshtein/__init__.py -> build/lib.linux-x86_64-3.7/Levenshtein
    running egg_info
    writing python_Levenshtein.egg-info/PKG-INFO
    writing dependency_links to python_Levenshtein.egg-info/dependency_links.txt
    writing entry points to python_Levenshtein.egg-info/entry_points.txt
    writing namespace_packages to python_Levenshtein.egg-info/namespace_packages.txt
    writing requirements to python_Levenshtein.egg-info/requires.txt
    writing top-level names to python_Levenshtein.egg-info/top_level.txt
    reading manifest file 'python_Levenshtein.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files matching '*pyc' found anywhere in distribution
    warning: no previously-included files matching '*so' found anywhere in distribution
    warning: no previously-included files matching '.project' found anywhere in distribution
    warning: no previously-included files matching '.pydevproject' found anywhere in distribution
    writing manifest file 'python_Levenshtein.egg-info/SOURCES.txt'
    copying Levenshtein/_levenshtein.c -> build/lib.linux-x86_64-3.7/Levenshtein
    copying Levenshtein/_levenshtein.h -> build/lib.linux-x86_64-3.7/Levenshtein
    running build_ext
    building 'Levenshtein._levenshtein' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/Levenshtein
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.7m -c Levenshtein/_levenshtein.c -o build/temp.linux-x86_64-3.7/Levenshtein/_levenshtein.o
    unable to execute 'gcc': No such file or directory
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8fkqotcp/python-Levenshtein/setup.py'"'"'; __file__='"'"'/tmp/pip-install-8fkqotcp/python-Levenshtein/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-90zn9u7d/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/python-Levenshtein Check the logs for full command output.

Levenshtein isn’t really required and I’ll have a new update up soon that removes it. For now, if you go into the manifest.json and delete the line "python-Levenshtein==0.12.0" it should load again.

ah ok :slight_smile:
but any idea why its now throwing that error anyway ?

Missing compiler that was installed before, but after update would need reinstalled. If you do a search on the forums or HA github issues for unable to execute 'gcc' you’ll be able to find more info. Also see the last paragraph on this page:

ah ok, strange why i receive that error , i run HassOS so not sure how or why there is no compiler anyway… :slight_smile:
anwyay, removed that line fro manifest and its up and running again

also i installed every build from 107.0 to 107.5 , didnt saw it before, only on 107.6 :slight_smile:

With great enthusiasm I installed this component, reading the GitHub repo page as I went along.

Then I got to the text “Music isn’t built in yet” and my heart sank :cry:

Would it be difficult for the component to be extended to cover music libraries? I have both Tidal and Plex music libraries. As Tidal do not provide an integration for Google Assistant, this would be a good work around.

Also, bugs / points to note on movie playback:

  • There is no way to control the film once it is playing on the connected Chromecast. For me, the movie playback does not even show up in the Google Home app so I can stop it streaming.

  • To stop the film, I did try “Hey Google tell Plex to stop”. After a very, very long wait, it did stop streaming the film, but it then started to auto-play (i.e. play some random film from my collection).

  • To pause the film, I tried “Hey Google tell Plex to pause”. Again, after a very, very long wait, it did pause the film, but then AGAIN it started to auto-play some random film from my collection. Odd behavior!

  • I requested a movie that was in Plex server shared with me by a friend. However, that film was not found. No feedback came through the screen or Google Assistant, so error reporting seems to be missing. Certainly Google Assistant / IFTTT restates what I have asked it to do, but does not tell me that no matches were found.

  • If found I could stop playback from the Plex dashboard on my server console, but that is rather pointless for a voice controlled app.

  • I tried using the native Plex app on my Samsung TV and although that has a specific device name in HA, the playback still went to the Chromecast device rather than the Plex app.

Given that the native Plex app on my Samsung and LG TVs offers control features (i.e. pause), this voice control does not have any advantages :thinking:

So how about music playback? Is that easy to do?

This is essentially the very first version of this component.

Most of what you’re trying to do isn’t currently supported, in fact everything you’ve listed isn’t supported yet and is stated as such in the readme.

The only commands you can currently use are the ones listed in the commands section of the readme. Since, usually, you can then just say “hey google stop” or “hey google play” once it starts playing on a chromecast device, device control wasn’t something I was originally going to add. Since I’m expanding this past google devices it will be.

The upcoming update will add:

  • Playback controls, right now you’re essentially just telling it to “stop” and it goes looking for media closest to the word “stop”.
  • Support for libraries other than default (not sure about shared libraries)
  • Non-chromecast players: any plex client, app etc
  • Error reporting (in HA log and spoken on selected cast device)

And a fair bit more. As far as music playback, that’s something I’ll look into adding, but since I don’t use plex for music it might be a little bit.

Then just use that. Again, this is the first version of this component.

Update 0.0.4

  • Adds 2 supported languages: Dutch and Swedish (big thanks to @pergola.fabio and @kernehed)
  • Updated readme with instructions on how to use DialogFlow instead of IFTTT
  • Added ability to cast to any Plex client/app
  • Added “aliases” for cases where you can’t rename a device. This will allow you to say “downstairs tv” or whatever you’d like for a device with a name like “TV_098749”.
  • Adds controls: play, pause, stop, jump forward, jump back
  • Added “next” as an alternative keyword for “unwatched”
  • Added support for all video libraries (haven’t tested shared yet, let me know if it works as I don’t use shared libraries. If they don’t please add a feature request for it.)
  • Error reporting to HA logs and spoken on cast device
  • No longer have to say “on the” for cast device, you can simply say “on” as well. Both “play friends on the downstairs tv” and “play friends on downstairs tv” will work.

Check the readme for the updated info. More to come soon.

cool , looking forward to the plex client/app feature

in my case , my cast device name of my samsung = TV UE55H6400 ?
i can make an alias for that …

  aliases:
    Name you want to use: TV UE55H6400

Should do it

ok, thnx

have you actually tried the dialogflow app? for me it works

but when i am in to the plex dialogflow, with the works like “talk to plex”, or “ask plex to” … then you enter the “plex” assistant app
but how to get out? :slight_smile: because everything i say there like, “leave plex” , is passed as a command :slight_smile:

If you just say exit it will leave. I’m sure there’s got to be a setting in dialog flow somewhere where it auto exits after one command. Will look into it.

yeah, the “auto exit” should be usefull

because when you use a google hub, if i used dialogflow, the actually movie that was casting to the hub, was in the background… the conversation with “plex” was stuck in foreground … so i was not able to watch the movie on my hub … i needed to click on the X in right corner… i didnt test “exit” :wink:

Found it, will add this to the readme as well. On the “intents” page of dialogflow expand “Responses” and turn on “Set this intent as end of conversation”

cool, perfect

i hope i can try out this week! nice update!

you sure aliasses is optional? if i dont define it like example below, i receive error:
if i uncomment them, then no error

2020-03-25 21:25:47 ERROR (MainThread) [homeassistant.setup] Error during setup of component plex_assistant
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 174, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/plex_assistant/__init__.py", line 76, in setup
    PA.alias_names = list(aliases.keys())
AttributeError: 'NoneType' object has no attribute 'keys'
plex_assistant:
  url: !secret plex
  token: !secret plex_token
  default_cast: 'TV UE55H6400'
  language: 'nl'
  tts_errors: true
  # aliases:
    # Google: Google_Hub
    # Chromecast: Chromecast