maybe i can try this one, maybe it will report the correct plugin
hmm, not sure how to proceed with that flexconnect, dont think it will work i think its created for flex.tv
It’s important to note here, especially since the plexapi issue you posted on github mentions it, plexapi does not use and is not affiliated with any of these plugins that you’re using. Back before I added support for plex devices I had you check what was being reported by that plugin as well as what plexapi was reporting. They were both giving self assigned IPs back then as well.
Also, as I mentioned in an earlier comment, this project doesn’t need or use any of those plugins and Flex TV isn’t in a working state (which is why I created this component to begin with) so that is all likely a dead end.
thats too bad, thats why i wanted to use this component for , for my samsung
anywa, some further testing, i remove the cast.bundle plugin, seems its not needed after all? if run code below, it fires the movie…
seems to be working without the plugin ? i tought the plugin was needed to make my samsung a cast device … this was needed for Flex.TV …
EDIT: nevermind, turned off and turned tv on again, again same issue, updated ticket here:
strange, ok, gonna do some more testing
for client in plex.clients():
print(client.title)
film = plex.library.section('Movies').get('Terminator Genisys')
client = plex.client("TV Samsung")
client.playMedia(film)
EDITED POST
Problem 1 : Aliasses
running 0.0.8 , but still having issues with aliasses
errors below are from :
play terminator on google hub => succes
play terminator on google => fails
stop terminator on google => fails
stop terminator on google hub => success
plex_assistant:
url: !secret plex
token: !secret plex_token
default_cast: 'TV Samsung'
language: 'nl'
tts_errors: true
aliases:
Google: 'Google_Hub'
2020-03-28 08:46:26 DEBUG (SyncWorker_2) [custom_components.plex_assistant] {'media': 'terminator', 'device': 'google hub', 'season': '', 'episode': '', 'latest': False, 'unwatched': False, 'ondeck': False, 'control': ''}
2020-03-28 08:46:29 DEBUG (SyncWorker_2) [custom_components.plex_assistant] Media: <Movie:3746:Terminator-Genisys>
2020-03-28 08:46:29 DEBUG (SyncWorker_2) [custom_components.plex_assistant] Cast: Google Hub
2020-03-28 08:46:46 DEBUG (SyncWorker_0) [custom_components.plex_assistant] {'media': 'terminator', 'device': 'google', 'season': '', 'episode': '', 'latest': False, 'unwatched': False, 'ondeck': False, 'control': ''}
2020-03-28 08:46:50 DEBUG (SyncWorker_0) [custom_components.plex_assistant] Media: <Movie:3746:Terminator-Genisys>
2020-03-28 08:46:50 DEBUG (SyncWorker_0) [custom_components.plex_assistant] Client: Google_Hub
2020-03-28 08:46:50 ERROR (MainThread) [homeassistant.helpers.script] Intent Script Plex: Error executing script. Unexpected error for call_service at pos 1: Unknown client name: Google_Hub
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 138, in _async_step
self, f"_async_{cv.determine_script_action(self._action)}_step"
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 233, in _async_call_service_step
context=self._context,
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 101, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context
File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1261, 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 167, in handle_input
PA.server.client(cast).proxyThroughServer()
File "/usr/local/lib/python3.7/site-packages/plexapi/server.py", line 255, in client
raise NotFound('Unknown client name: %s' % name)
plexapi.exceptions.NotFound: Unknown client name: Google_Hub
2020-03-28 08:46:50 WARNING (MainThread) [homeassistant.components.dialogflow] Error handling Plex
2020-03-28 08:47:13 DEBUG (SyncWorker_4) [custom_components.plex_assistant] {'media': 'terminator', 'device': 'google hub', 'season': '', 'episode': '', 'latest': False, 'unwatched': False, 'ondeck': False, 'control': ''}
2020-03-28 08:47:16 DEBUG (SyncWorker_4) [custom_components.plex_assistant] Media: <Movie:3746:Terminator-Genisys>
2020-03-28 08:47:16 DEBUG (SyncWorker_4) [custom_components.plex_assistant] Cast: Google Hub
2020-03-28 08:47:34 DEBUG (SyncWorker_2) [custom_components.plex_assistant] {'media': 'terminator', 'device': 'google', 'season': '', 'episode': '', 'latest': False, 'unwatched': False, 'ondeck': False, 'control': ''}
2020-03-28 08:47:37 DEBUG (SyncWorker_2) [custom_components.plex_assistant] Media: <Movie:3746:Terminator-Genisys>
2020-03-28 08:47:37 DEBUG (SyncWorker_2) [custom_components.plex_assistant] Client: Google_Hub
2020-03-28 08:47:37 ERROR (MainThread) [homeassistant.helpers.script] Intent Script Plex: Error executing script. Unexpected error for call_service at pos 1: Unknown client name: Google_Hub
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 138, in _async_step
self, f"_async_{cv.determine_script_action(self._action)}_step"
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 233, in _async_call_service_step
context=self._context,
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 101, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context
File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1261, 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 167, in handle_input
PA.server.client(cast).proxyThroughServer()
File "/usr/local/lib/python3.7/site-packages/plexapi/server.py", line 255, in client
raise NotFound('Unknown client name: %s' % name)
plexapi.exceptions.NotFound: Unknown client name: Google_Hub
2020-03-28 08:47:37 WARNING (MainThread) [homeassistant.components.dialogflow] Error handling Plex
2020-03-28 08:48:36 ERROR (MainThread) [homeassistant.helpers.script] Intent Script Plex: Error executing script. Unexpected error for call_service at pos 1: Unknown client name: Google_Hub
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 138, in _async_step
self, f"_async_{cv.determine_script_action(self._action)}_step"
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 233, in _async_call_service_step
context=self._context,
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 101, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context
File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1261, 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 125, in handle_input
PA.server.client(cast).proxyThroughServer()
File "/usr/local/lib/python3.7/site-packages/plexapi/server.py", line 255, in client
raise NotFound('Unknown client name: %s' % name)
plexapi.exceptions.NotFound: Unknown client name: Google_Hub
2020-03-28 08:48:36 WARNING (MainThread) [homeassistant.components.dialogflow] Error handling Plex
Problem 2 : Samsung TV
ok, got some response from that github : https://github.com/pkkid/python-plexapi/issues/439
Seems when devices reports the incorrect IP (127…0.0.1) , like samsung tv or a chrome browser, you need to add : client.proxyThroughServer()
so i tried below code with .py and i all test cases i was able to start a movie on my samsung device
can you add this line to your custom too so i can test it? or can you tell where i need to add it? so i can load it without you releasing a new version ?
thnx!
film = plex.library.section('Movies').get('Terminator')
client = plex.client("TV Samsung")
client.proxyThroughServer() #without this one, 95% of cases it didnt work
client.playMedia(film)
Problem 3 : Conflciting with official PLEX
i was testing the plex HA integration, and i never succeeded to play a movie from a script like below, i always got as error : media not found
Until i removed your custom component, and did a rebuild of my HassOS
plex:
alias: TEST PLEX
sequence:
- service: media_player.play_media
data:
entity_id: media_player.plex_plex_for_samsung_tv_samsung
media_content_type: VIDEO
media_content_id: "{ \"library_name\": \"Movies\", \"video_name\": \"Aladdin\", \"shuffle\": 0 }"
i think it has todo that your component installed another version of plexapi ? i think it over installed the one from HA itself
in your manifest its :
#"git+https://github.com/pkkid/python-plexapi.git@c3e16b2d369968433048ae9a5678294041eb084d#plexapi==9.9.9
isnt that wrong? should that not be like plexapi=3.3.0 ?
now stopped testing, didnt test your component yet with a modified plexapi=3.3.0 , not sure if it would resolve my problem 3 , maybe also problem 1/2
This already exists in Plex Assistant
I’m using a specific commit of plex-api ahead of 3.3.0 that hasn’t been released yet. It solved some specific issues with the current 3.3.0. Some things have changed with Plex Assistant since then and that specific commit may no longer be needed, but I will give it a test.
I haven’t had a chance to really play with this project in a bit, Custom Header has been the priority. Things with CH seem to be settling down and I’ll be back on this soon.
You aren’t the only one having issues with aliases and I’m looking into it. It seems that when using aliases google devices are sometimes reported as plex clients or vice versa.
hmm, the need to test again
strange, my samsung wasnt working
With plex-api 3.3.0 I was having issues controlling plex clients, which is one of the reasons I was using the unreleased branch.
Hi @mayker, I’ve requested a new official release of plexapi
which will include the player control fixes you’re referring to. When that’s available would you be able to update your custom component to require the same version used by the built-in Plex integration? It’s a bit confusing when issue reports (or unexpected fixes!) are caused by a shared dependency version conflict.
Everything would be in the exact same state if they release the updated version. I would still be requesting a version ahead of HA’s until HA updates to use the new version as well.
Once there’s a new plexapi
release I’ll handle that part
Sounds good, thank you. Sorry if I caused a headache . Let me know when things are set and I’ll update.
i want to learn about this stuff too
lets say, a new plexapi is released with new features , ex 1.1
so Ha updates with PR to 1.1 , and cause of new features its not compatible with 1.0 anymore
so when custom still points to 1.0, there will be a conflict…
When this happens, is it needed that ALL custom components that make use of 1.0 should update their manifest.json/requirements? is there no other way?
example: that the custom checks for a version… if not installed … install… plexapi:latetst …
@mayker, already got a chance to look at the alias problem?
anyway, back to testing
i can confirm now, that if this custom component is loaded with the specific plexapi , the play script doesnt work anymore
so when no custom component is loaded, i receive error below
when i uninstall custom and do a rebuild of core, so plexapi 3.3.0 is loaded again, the script below works
so custom component (plexapi version) breaks the official plex integration
a_test_plex3:
alias: 1 TEST PLEX3
sequence:
- service: media_player.play_media
data:
entity_id: media_player.plex_plex_for_samsung_tv_ue32h5500
media_content_type: VIDEO
media_content_id: "{ \"library_name\": \"Kids\", \"video_name\": \"Cars\" }"
2020-04-02 09:23:48 ERROR (MainThread) [homeassistant.components.script] 1 TEST PLEX3: Error executing script. Unexpected error for call_service at pos 1: 'PlayQueue' object has no attribute 'listType'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 138, in _async_step
self, f"_async_{cv.determine_script_action(self._action)}_step"
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 233, in _async_call_service_step
context=self._context,
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 101, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context
File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1257, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 198, in handle_service
self._platforms.values(), func, call, required_features
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 402, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 599, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 433, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 599, in async_play_media
ft.partial(self.play_media, media_type, media_id, **kwargs)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/plex/media_player.py", line 594, in play_media
self.device.playMedia(playqueue)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 472, in playMedia
elif media.listType == "audio":
AttributeError: 'PlayQueue' object has no attribute 'listType'
2020-04-02 09:23:49 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139992469781648] 'PlayQueue' object has no attribute 'listType'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
connection.context(msg),
File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1257, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 207, in service_handler
await script.async_turn_on(variables=service.data, context=service.context)
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 284, in async_turn_on
await self.script.async_run(kwargs.get(ATTR_VARIABLES), context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 693, in async_run
await run.async_run()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 444, in async_run
await self._async_run()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 460, in _async_run
await self._async_step(not propagate_exceptions)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 138, in _async_step
self, f"_async_{cv.determine_script_action(self._action)}_step"
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 233, in _async_call_service_step
context=self._context,
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 101, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context
File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1257, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 198, in handle_service
self._platforms.values(), func, call, required_features
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 402, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 599, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 433, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 599, in async_play_media
ft.partial(self.play_media, media_type, media_id, **kwargs)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/plex/media_player.py", line 594, in play_media
self.device.playMedia(playqueue)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 472, in playMedia
elif media.listType == "audio":
AttributeError: 'PlayQueue' object has no attribute 'listType'
@mayker Thanks for creating this component seems like a great way to hook up Plex. Sadly i’m having trouble getting any cast devices found though. Simply met with this error.
Log Details (WARNING)
Logger: custom_components.plex_assistant
Source: custom_components/plex_assistant/__init__.py:117
First occurred: 12:43:39 PM (1 occurrences)
Last logged: 12:43:39 PM
Cast device not found.
My Config:
plex_assistant:
url: 'http://myip:32400'
token: 'mytoken'
default_cast: 'Jonathan TV'
language: 'en'
tts_errors: true
The default cast device is a gen 1 chromecast with friendly name set to ‘Jonathan TV’, have tried a few variations on the name i.e. anything related to the device in either Hass or Google Home.
It is integrated through the automatic discovery Google Cast integration within Hass settings, does it require manual setup of the devices perhaps?
Is there a way to enable or view more detailed logging?
@mayker if the only problem you were having with 3.3.0 was in relation to PlexClient.playMedia()
calls failing, I found a surprisingly trivial workaround: https://github.com/home-assistant/core/pull/33542.
I’ll give it a test as soon as I am able, thanks!
This component currently uses the name of the Google Device, not the friendly name set in HA. You can check the name of the device in the google home app and if need be use the alias feature to call it what you like (though some are having issues with that feature atm)
Thanks for the report, @pergola.fabio. This looks like an issue in plexapi
. I’ve created a PR for a fix that works for me locally running the bleeding edge plexapi
against HA: https://github.com/pkkid/python-plexapi/pull/446.