❱ Plex Assistant

offtopic, but do you always need to re-enable the test/simulator on google console cloud when using the dialogflow? seems the “test” app is disabled always after 30 days …

this happened to me also when i was using google assistant in HA, thats why i swithed to nabucasa :slight_smile:

@iczster I couldn’t tell you, it all depends on how much work you are willing to put into it.

@pergola.fabio I actually haven’t noticed, but I only use dialogflow when I need to test it, otherwise I use IFTTT as it seems to be the best solution. It’s a shame they haven’t expanded the languages for it though.

Thanks for the help @mayker its really appreciated. Ive literally spent hours on this and really no clue why cast devices arent showing. I’ll probably just leave it now. Frustrating thing is this was all working like a dream for weeks.

Would you mind sharing the results from http://192.168.0.205:32400/clients?X-Plex-Token=MYTOKEN out of curiosity?

1 Like

Sure mate. Same output from local host and after ssh to docker container.

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<MediaContainer size="1">

<Server name="Office" host="192.168.0.248" address="192.168.0.248" port="32500" machineIdentifier="45F07ED8-8900-45D0-81DF-B17090B08B6A" version="7.1.1" protocol="plex" product="Plex for Apple TV" deviceClass="stb"protocolVersion="2" protocolCapabilities="playback,playqueues,timeline,provider-playback"/>

</MediaContainer>

I would think that this would be sufficient at least for the Office device and if your TV shows up in there when opened with the name of TV QE49Q7FAM the aliases below should work as well. As for the Laptop alias I would use that same URL to find its machineIdentifier and use that for the alias.

plex_assistant:
  url: 'http://192.168.0.205:32400'
  token: 'REDACTED'
  default_cast: Office
  tts_errors: true
  aliases:
    TV: TV QE49Q7FAM
    Laptop: LAPTOPSmachineIdentifier

This all assumes of course that the sensor is just having issues finding your devices for some reason. Disable the sensor and give the above config a go, if you’re still not having luck I would try the same config above (without machineIdentifier as that was just recently added) and downgrade Plex Assistant by one or two versions.

1 Like

Thanks @mayker

Same error:

## Log Details (WARNING)

Logger: custom_components.plex_assistant
Source: custom_components/plex_assistant/__init__.py:139 
Integration: Plex Assistant ([documentation](https://github.com/maykar/plex_assistant)) 
First occurred: 16:07:43 (1 occurrences) 
Last logged: 16:07:43

Cast device not found: "Office"

Same with the TV alias. Im going to try with version 1.4 and work upwards. Honestly some things really do drive you mad :smile:

@mayker Progress but no idea why :rofl: Version 1.4 is working mate so for some reason I have no clue about, it breaks for me in a later version :man_shrugging:

Legend. Thanks for all the help but not sure where it leaves me now with regards upgrades.

Well that at least offers some clue. Will look into it and let you know.

1 Like

Really appreciated pal. Im happy to test other versions but for now 1.4 is working.

I keep getting device not found but the sensor shows it there, any thoughts?
[custom_components.plex_assistant] Cast device not found: "Millies Tv"

Connected Devices:
  Cast Devices:
    - Parents TV
    - Theater Surround
    - Chromecast ULTRA
    - Theater TV
    - Living Room TV
    - Theater room speaker
    - Party Time
    - Whole Home
    - Upstairs
    - Josies Room speaker
    - James Room TV
    - Selling Room speaker
    - James Room speaker
    - James Room
    - Parents Bedroom display
    - Millies Room speaker
    - Bathroom TV
    - Living Room Sound Bar
    - Kitchen display
    - Office speaker
    - James Room clock
    - Millies TV
  Plex Clients: None
friendly_name: Plex Assistant Devices

I had the same issue @Webstas what version of plex assistant are you running?

@iczster i am running 0.1.7

1 Like

Downgrade to version 1.4 and try that @Webstas

New error @mayker least its in the logs now. Ive upgraded to latest version of HA still on 0.14 of PA

## Log Details (ERROR)

Logger: homeassistant.components.automation
Source: custom_components/plex_assistant/__init__.py:174 
Integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22)) 
First occurred: 11:12:04 (1 occurrences) 
Last logged: 11:12:04

Plex Assistant Automation: Error executing script. Unexpected error for call_service at pos 1: (400) bad_request; http://192.168.0.248:32500/player/playback/playMedia?address=192.168.0.205&commandID=1&containerKey=%2FplayQueues%2F11394%3Fwindow%3D100%26own%3D1&key=%2Flibrary%2Fmetadata%2F119622&machineIdentifier=2f1ad371d737eca8b433c53b38057fb0be38a48c&offset=0&port=32400&token=transient-<REDACTED>&type=video <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>HTTP Error 400</title></head><body><h1>HTTP Error 400: Error processing player command</h1><h3>[kRemoteControlRouterErrorDomain] The container '/playQueues/11394?window=100&own=1' couldn't be retrieved or is empty (1)</h3></body></html>

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 153, in _async_step self, f"_async_{cv.determine_script_action(self._action)}_step" File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 656, in _async_call_service_step *self._prep_call_service_step(), blocking=True, context=self._context File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1299, in _execute_service await self._hass.async_add_executor_job(handler.func, service_call) 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 174, in handle_input plex_c.playMedia(media) File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 499, in playMedia }, **params)) File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 208, in sendCommand return query(key, headers=headers) File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 169, in query raise BadRequest(message) plexapi.exceptions.BadRequest: (400) bad_request; http://192.168.0.248:32500/player/playback/playMedia?address=192.168.0.205&commandID=1&containerKey=%2FplayQueues%2F11394%3Fwindow%3D100%26own%3D1&key=%2Flibrary%2Fmetadata%2F119622&machineIdentifier=2f1ad371d737eca8b433c53b38057fb0be38a48c&offset=0&port=32400&token=transient-<REDACTED>&type=video <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>HTTP Error 400</title></head><body><h1>HTTP Error 400: Error processing player command</h1><h3>[kRemoteControlRouterErrorDomain] The container '/playQueues/11394?window=100&own=1' couldn't be retrieved or is empty (1)</h3></body></html>

Any ideas mate?

Fixed my own problem. Another weird one :grinning:

There must have been some recent changes in HA or Plex. Im running HA in docker. To resolve the issue I had to add the broadcast address of my container in the network configuration in Plex to allow without auth.

All works again now.

Hi, I’m having an issue - I have been successful in configuring plex assistant, but when I ask it to play anything, it starts the first video in my library for only a second, and then stops playback and shows a gray screen.

For example using the service tool, ‘command: play underwater on living room tv’ starts Plex on Living Room TV but it starts playing the first episode of Ozark (the first thing in my library), then abruptly stops. Any ideas?

Following is my configuration.yaml:


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

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
#automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

plex_assistant:
  url: 'http://192.168.86.2:32400'
  token: 'REDACTED'
  tts_errors: true
  default_cast: 'Living Room TV'
  language: 'en'
  
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 }}'

I’m hitting my head against a wall trying to figure out what I’m doing wrong. I keep getting an invalid config error for plex_assistant but my config seems to be correct. If I look in the command prompt I see it says plex_assistant is taking longer than 10 seconds and then it just errors out. Any thoughts?
This is my config:

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

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
#automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

plex_assistant:
  url: 'http://192.168.1.75:32400'
  token: 'redacted'
  language: 'en'
  tts_errors: true

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 }}'

wish there was a Kodi analog to this.
That aside this is pretty nice I used to use the IFTTT webhook for making calls to VoxCommando to do the same with Kodi.
May have to try this out this seems to have some of the richer commands set available.

Music would be nice. Since there is no native Plex integration, I got a lot of Google Home devices in the firesale few weeks back. My kids love music but I dont subscribe to of the available premium services so when they want a specific song request doesnt work. This could help w/ that if able to call on non video chromecast enabled devices.