maykar / plex_assistant

❱ Plex Assistant is a Home Assistant integration for casting Plex media to Google devices, Sonos devices, and Plex clients with Google Assistant, HA's conversation integration, and more.
MIT License
278 stars 61 forks source link

Sensor picks up on some devices as having no name #27

Closed KevinX8 closed 4 years ago

KevinX8 commented 4 years ago

For both my PS4 Pro and Philips Smart TV the included sensor sees them as having no name and are just shown as device1, ,device2 with the middle being what I assume the TV is supposed to be. Using the device id's provided by the plex server intergration also does not work so I have no way of addressing my devices. I am able to address my pc successfully, however multiple instances of chrome all show up as chrome on the sensor. Config as 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: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor:
- platform: plex_assistant
plex_assistant:
  url: 'http://192.168.1.69:32400'
  token: '*****'
  default_cast: 'Downstairs TV'
  language: 'en'
  tts_errors: true
  aliases:
    Downstairs TV: plex_plex_for_playstation_4_playstation_4_pro
    Upstairs PC: Chrome
    PS4: plex_plex_for_playstation_4_playstation_4_pro
    PS 4: plex_plex_for_playstation_4_playstation_4_pro
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 }}'
maykar commented 4 years ago

Is this with the Plex apps open on the devices in question? Some devices they don't report info unless it's open on the device, in these cases the app would need to be open before using Plex Assistant as there is no way launch them automatically.

maykar commented 4 years ago

Also, what do you see when you go to PLEX-IP-AND-PORT/clients?X-Plex-Token=YOUR-PLEX-TOKEN?

Censor results as needed, I'm mostly interested in seeing what is in the "name" field

KevinX8 commented 4 years ago

Strangely enough with the sensor turned on I get a 404 but with it off I get results, I am unable to test my TV right now but I will see if it works when I get the chance. Also on an unrelated note the sensor caused my home assisstant instance to crash when left turned on so I was forced to turn it off for now.(It crashed after a few hours or so of just staying turned on). And yes I was testing with the TV app opened and same for the PS4 app, they were both showing up in my Home Assistant devices via the plex media server extension. I think using the machine Identifier field would be better as it seems to be unique for every device addressing the issue with multiple chrome instances and lack of names, I will update this issue once I get the chance to test my TV again.

maykar commented 4 years ago

I'll have an update for the sensor soon as I noticed the same issue, but please keep me updated. Machine identifier is something I'm already working in as I was messing with your issue, so using an alias with a machine identifier is definitely in the future.

maykar commented 4 years ago

When the Plex API URL above does work, do the devices display an empty name field?

maykar commented 4 years ago

Still testing this a bit more and want to get some other changes in before next release, but here's what the new sensor would show (clients are listed by title, with machine id and device type below):

Unnecessarily censored image: image

KevinX8 commented 4 years ago

finally got a chance to test it, image I just get a normal name for my PS4 strangely enough, not sure why the sensor didn't pick up on it properly.

maykar commented 4 years ago

Updated the companion sensor, it's still advisable to disable it when not needed to cut down on API calls. You can also now use machine ID in the aliases.

Let me know if it helps.