sounds like a bug
just change the readme :), dont make it optional
Nah, fix the bug
Edit: Fixed in 0.0.5
did some quick test, below is my code, my default cast device is the older samsung with plex client 'with the addon installed from FlexTV)
so if i say : ask plex assistant to play terminator on chromecast (i use dutch now)
2020-03-25 22:50:31 ERROR (MainThread) [homeassistant.helpers.script] Intent Script Plex: Error executing script. Unexpected error for call_service at pos 1: Unknown client name: Chromecast('192.168.0.122', port=8009, device=DeviceStatus(friendly_name='Chromecast', model_name='Chromecast', manufacturer='Unknown manufacturer', uuid=UUID('3a57f569-9922-56db-eebb-216d72324dcc'), cast_type='cast'))
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 168, in handle_input
plex_c = PA.server.client(cast)
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: Chromecast('192.168.0.122', port=8009, device=DeviceStatus(friendly_name='Chromecast', model_name='Chromecast', manufacturer='Unknown manufacturer', uuid=UUID('3a57f569-9922-56db-eebb-216d72324dcc'), cast_type='cast'))
2020-03-25 22:50:31 WARNING (MainThread) [homeassistant.components.dialogflow] Error handling Plex
if i say : ask plex assistant to play termnator (using default cast_device here, its my samsung loaded with Plexapp the FlexTV addon , plex is already started
2020-03-25 22:55:28 ERROR (SyncWorker_3) [plexapi] TV Samsung failed to subscribe
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/local/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f7f742bb790>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/timeline/subscribe?commandID=1&port=32400&protocol=http (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7f742bb790>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 479, in playMedia
self.sendCommand('timeline/subscribe', port=server_port, protocol='http')
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 204, in sendCommand
return query(key, headers=headers)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 161, in query
response = method(url, headers=headers, timeout=timeout, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 543, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/timeline/subscribe?commandID=1&port=32400&protocol=http (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7f742bb790>: Failed to establish a new connection: [Errno 111] Connection refused'))
2020-03-25 22:55:28 ERROR (MainThread) [homeassistant.helpers.script] Intent Script Plex: Error executing script. Unexpected error for call_service at pos 1: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/playback/playMedia?address=192.168.0.14&commandID=2&containerKey=/playQueues/3730%3Fwindow%3D100%26own%3D1&key=/library/metadata/3746&machineIdentifier=d0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d&offset=0&port=32400&token=transient-4306f020-e85f-4a71-b165-dc1fd66112ee&type=video (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7f712c8d10>: Failed to establish a new connection: [Errno 111] Connection refused'))
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/local/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f7f712c8d10>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/playback/playMedia?address=192.168.0.14&commandID=2&containerKey=/playQueues/3730%3Fwindow%3D100%26own%3D1&key=/library/metadata/3746&machineIdentifier=d0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d&offset=0&port=32400&token=transient-4306f020-e85f-4a71-b165-dc1fd66112ee&type=video (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7f712c8d10>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
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 169, in handle_input
plex_c.playMedia(media)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 496, in playMedia
}, **params))
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 204, in sendCommand
return query(key, headers=headers)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 161, in query
response = method(url, headers=headers, timeout=timeout, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 543, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/playback/playMedia?address=192.168.0.14&commandID=2&containerKey=/playQueues/3730%3Fwindow%3D100%26own%3D1&key=/library/metadata/3746&machineIdentifier=d0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d&offset=0&port=32400&token=transient-4306f020-e85f-4a71-b165-dc1fd66112ee&type=video (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7f712c8d10>: Failed to establish a new connection: [Errno 111] Connection refused'))
2020-03-25 22:55:28 WARNING (MainThread) [homeassistant.components.dialogflow] Error handling Plex
ow, this is my code :
plex_assistant:
url: !secret plex
token: !secret plex_token
default_cast: 'TV UE55H6400'
language: 'nl'
tts_errors: true
aliases:
Google: Google_Hub
Chromecast: Chromecast
also updated to 0.0.5, now recieve this :
2020-03-25 23:03:16 ERROR (MainThread) [homeassistant.setup] Setup failed for plex_assistant: unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 136, in _async_setup_component
component = integration.get_component()
File "/usr/src/homeassistant/homeassistant/loader.py", line 268, in get_component
cache[self.domain] = importlib.import_module(self.pkg_path)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 860, in get_code
File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/config/custom_components/plex_assistant/__init__.py", line 76
if aliases
^
SyntaxError: invalid syntax
Try the latest 0.0.6 and add this to your configuration.yaml:
logger:
logs:
custom_components.plex_assistant: debug
Then when in HA logs click “load full home assistant log”
And paste the contents from the [custom_components.plex_assistant] lines
For some reason in your setup it is detecting your chromecast as a plex device and your plex device (TV) is reporting a self assigned IP (like it hasn’t been turned on)
Seeing none of these issues on my side, but that doesn’t help much.
Flex TV addon is not needed for Plex Assistant
Ok, ,I’ll try tomorrow… For my Samsung TV, with flextv add-on, yeah, it always publish the 127.0.0.1 address, you see that that also in the xml logs I posted earlier a while ago…
Although it worked when I was using flextv before…
I mean by flextv add-on, that cast.bundle that I installed on my Plex server… So flextv was actually retrieving my Samsung TV as a cast device (if turned on and Plex must be started)
@mayker I have been taking a look at your latest code (0.0.6) and I think I could easily add support for music libraries. What is the best way to check with the Plex API if I get things right (e.g. that the libraries are called “music”, then “albums”, “tracks”). Also best way to debug the changes I make to the component?
PS. Sponsored you on GitHub
Very much appreciated. Thanks, John!
As far as Plex API resources, this project uses python-plexapi. Documentation for the audio portion (and the rest) can be found here.
The biggest hurdles you’ll run across are the speech recognition and fuzzy searching. I’ve made a few helper functions and things are fairly well organized, but they are kind of video specialized. Anything you do should also be trying to use the localization methods so that it can be translated.
As far as the best way get started, I have a seperate __init__.py
script that is stripped of anything Home Assistant specific so that I can just run everything from vscode and not have to worry about restarting, etc, and you can just feed it commands you want from the terminal.
Shoot me a direct message on here to remind me to send one over to you as I need to recreate one for the current release.
ok, wanted to test 0.0.6 ; bust still receive invalid syntax?
2020-03-26 08:24:30 ERROR (MainThread) [homeassistant.setup] Setup failed for plex_assistant: unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 136, in _async_setup_component
component = integration.get_component()
File "/usr/src/homeassistant/homeassistant/loader.py", line 268, in get_component
cache[self.domain] = importlib.import_module(self.pkg_path)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 860, in get_code
File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/config/custom_components/plex_assistant/__init__.py", line 76
if aliases
^
SyntaxError: invalid syntax
plex_assistant:
url: !secret plex
token: !secret plex_token
default_cast: 'TV UE55H6400'
language: 'nl'
tts_errors: true
aliases:
Google: Google_Hub
even if i comment out the config, like below, i recieve that error?
plex_assistant:
url: !secret plex
token: !secret plex_token
default_cast: 'TV UE55H6400'
language: 'nl'
tts_errors: true
# aliases:
# Google: 'Google_Hub'
ok, i commened out that IF aliasses in the __init_py file, now my config is loaded
seems my chromecast was fine, now it plays
now testing my samsung tv
EDIT: this thread is also interesting, also same error with a client named as 127.0.0.1 => they used now OpenPHT for it …
https://github.com/pkkid/python-plexapi/issues/70
EDIT2 : created a new issue thread here…
what i have found out, if i restart PMS server, then open the plex app on my samsung, then it works, but only the first attempt, it still throws the error, but it actually played the movie…
plex_assistant:
url: !secret plex
token: !secret plex_token
default_cast: 'TV Samsung'
language: 'nl'
tts_errors: true
if i start the plex app on my samsung tv, my samsung is listed as below :
<Device status="n/a" name="TV Samsung" app="Plex Client" uri="127.0.0.1:32400" type="Plex for Samsung" id="mtcjs3w774g7i"/>
so in dialogflow, i ask, 'Play Terminator" :> in dialoflow, i also receive an error “error handling intent”
here is debug as asked:
2020-03-26 09:34:59 DEBUG (SyncWorker_3) [custom_components.plex_assistant] {'media': 'terminator', 'device': 'TV Samsung', 'season': '', 'episode': '', 'latest': False, 'unwatched': False, 'ondeck': False, 'control': ''}
2020-03-26 09:35:02 DEBUG (SyncWorker_3) [custom_components.plex_assistant] Media: <Movie:3746:Terminator-Genisys>
2020-03-26 09:35:02 DEBUG (SyncWorker_3) [custom_components.plex_assistant] Client: TV Samsung
2020-03-26 09:35:02 ERROR (SyncWorker_3) [plexapi] TV Samsung failed to subscribe
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/local/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f2dbd448910>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/timeline/subscribe?commandID=1&port=32400&protocol=http (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2dbd448910>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 479, in playMedia
self.sendCommand('timeline/subscribe', port=server_port, protocol='http')
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 204, in sendCommand
return query(key, headers=headers)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 161, in query
response = method(url, headers=headers, timeout=timeout, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 543, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/timeline/subscribe?commandID=1&port=32400&protocol=http (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2dbd448910>: Failed to establish a new connection: [Errno 111] Connection refused'))
2020-03-26 09:35:03 ERROR (MainThread) [homeassistant.helpers.script] Intent Script Plex: Error executing script. Unexpected error for call_service at pos 1: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/playback/playMedia?address=192.168.0.14&commandID=2&containerKey=/playQueues/3737%3Fwindow%3D100%26own%3D1&key=/library/metadata/3746&machineIdentifier=d0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d&offset=0&port=32400&token=transient-2cbda68d-25c6-4b8e-8533-d217e83bcfe5&type=video (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2dbd4d5f50>: Failed to establish a new connection: [Errno 111] Connection refused'))
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/local/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f2dbd4d5f50>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/playback/playMedia?address=192.168.0.14&commandID=2&containerKey=/playQueues/3737%3Fwindow%3D100%26own%3D1&key=/library/metadata/3746&machineIdentifier=d0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d&offset=0&port=32400&token=transient-2cbda68d-25c6-4b8e-8533-d217e83bcfe5&type=video (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2dbd4d5f50>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
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 170, in handle_input
plex_c.playMedia(media)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 496, in playMedia
}, **params))
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 204, in sendCommand
return query(key, headers=headers)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 161, in query
response = method(url, headers=headers, timeout=timeout, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 543, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/playback/playMedia?address=192.168.0.14&commandID=2&containerKey=/playQueues/3737%3Fwindow%3D100%26own%3D1&key=/library/metadata/3746&machineIdentifier=d0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d&offset=0&port=32400&token=transient-2cbda68d-25c6-4b8e-8533-d217e83bcfe5&type=video (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f2dbd4d5f50>: Failed to establish a new connection: [Errno 111] Connection refused'))
2020-03-26 09:35:03 WARNING (MainThread) [homeassistant.components.dialogflow] Error handling Plex
EDIT3 , tried another cast.bundle on my samsung; this one … thats working, no idea whats the difference between those… allthough i now always receive error below, but the movie works
vs
2020-03-26 11:45:52 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
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 170, in handle_input
plex_c.playMedia(media)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 496, in playMedia
}, **params))
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 204, in sendCommand
return query(key, headers=headers)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 168, in query
return ElementTree.fromstring(data) if data.strip() else None
File "/usr/local/lib/python3.7/xml/etree/ElementTree.py", line 1316, in XML
return parser.close()
File "<string>", line None
xml.etree.ElementTree.ParseError: no element found: line 1, column 54
OK , my samsung TV works, except for the error above
now testing my google hub again, i now have back the indent issue/error, see error below
what is causing this?
2020-03-26 11:49:16 DEBUG (SyncWorker_3) [custom_components.plex_assistant] {'media': 'dory', 'device': 'google', 'season': '', 'episode': '', 'latest': False, 'unwatched': False, 'ondeck': False, 'control': ''}
2020-03-26 11:49:19 DEBUG (SyncWorker_3) [custom_components.plex_assistant] Media: <Movie:4088:Finding-Dory>
2020-03-26 11:49:19 DEBUG (SyncWorker_3) [custom_components.plex_assistant] Client: Chromecast('192.168.0.186', port=8009, device=DeviceStatus(friendly_name='Google Hub', model_name='Google Nest Hub Max', manufacturer='Unknown manufacturer', uuid=UUID('a97ff841-901e-fdb4-ad3a-af839a577c06'), cast_type='cast'))
2020-03-26 11:49:19 ERROR (MainThread) [homeassistant.helpers.script] Intent Script Plex: Error executing script. Unexpected error for call_service at pos 1: Unknown client name: Chromecast('192.168.0.186', port=8009, device=DeviceStatus(friendly_name='Google Hub', model_name='Google Nest Hub Max', manufacturer='Unknown manufacturer', uuid=UUID('a97ff841-901e-fdb4-ad3a-af839a577c06'), cast_type='cast'))
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 169, in handle_input
plex_c = PA.server.client(cast)
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: Chromecast('192.168.0.186', port=8009, device=DeviceStatus(friendly_name='Google Hub', model_name='Google Nest Hub Max', manufacturer='Unknown manufacturer', uuid=UUID('a97ff841-901e-fdb4-ad3a-af839a577c06'), cast_type='cast'))
2020-03-26 11:49:19 WARNING (MainThread) [homeassistant.components.dialogflow] Error handling Plex
As far as the line you commented out, there was indeed a typo that was in the Github release that wasn’t on my local machine. I’ve fixed that in the latest release, I’ve also added another device check that may solve your issues with your google device.
As far as the error from your plex app on your TV, it seems that the particular app you are using isn’t fully supported by plexapi as you’ve found out. I’ll keep an eye on the issue you posted and see if there is any development and if there’s anything I can do, but without a similar setup to test on there isn’t much I can do.
Ok, No problem… It works on the Samsung , I will just ignore the error message with logger… I will create an new issue for that on plexapi site, maybe it’s related to api… So ignore for now
The only issue left for me:
- The Google hub/Chromecast issue, with error in previous reply…
- Diagflow, it indeed ends the conversation now after the command… With that extra setting Allthough ,it’s still active in front of my Google hub, still a white screen with a message: Plex left the conversation…
Another thing I can’t test as I don’t have any Google displays. I’ll do some digging and see if I can find anything on it.
ok, 0.0.7 fixed aliasses
anyway, some more testing
-
dialogflow on google hub, the white screen with “plex left the conversation” is stuck for about 10-15 seconds, then it dissapears, and it stars playing movie…
-
tested again on my samung tv, wanted to show off for my kids , now with the older cast.bundle installed , again same error
not sure why it doesnt work, with flex.tv i never got issues see below -
question: i was testing on google hub, a movie called “rio” was playing, to pause it, should i say :
pause rio on the google hub
or
pause on the google hub ?
both cases, just started the movie again :
2020-03-26 21:26:21 DEBUG (SyncWorker_2) [custom_components.plex_assistant] {'media': 'rio', 'device': 'google hub', 'season': '', 'episode': '', 'latest': False, 'unwatched': False, 'ondeck': False, 'control': ''}
2020-03-26 21:26:24 DEBUG (SyncWorker_2) [custom_components.plex_assistant] Media: <Movie:7494:Rio>
2020-03-26 21:26:24 DEBUG (SyncWorker_2) [custom_components.plex_assistant] Cast: Google Hub
2020-03-26 21:26:53 DEBUG (SyncWorker_1) [custom_components.plex_assistant] {'media': 'pauzeer rio', 'device': 'google hub', 'season': '', 'episode': '', 'latest': False, 'unwatched': False, 'ondeck': False, 'control': ''}
2020-03-26 21:26:57 DEBUG (SyncWorker_1) [custom_components.plex_assistant] Media: <Movie:7494:Rio>
2020-03-26 21:26:57 DEBUG (SyncWorker_1) [custom_components.plex_assistant] Cast: Google Hub
2020-03-26 19:27:27 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet. Retrying in 30 seconds.
sessions.py", line 2020-03-26 19:29:16 DEBUG (SyncWorker_1) [custom_components.plex_assistant] {'media': 'frozen 2', 'device': 'TV Samsung', 'season': '', 'episode': '', 'latest': False, 'unwatched': False, 'ondeck': False, 'control': ''}
2020-03-26 19:29:20 DEBUG (SyncWorker_1) [custom_components.plex_assistant] Media: <Movie:8249:Frozen-2>
2020-03-26 19:29:20 DEBUG (SyncWorker_1) [custom_components.plex_assistant] Client: TV Samsung
2020-03-26 19:29:20 ERROR (SyncWorker_1) [plexapi] TV Samsung failed to subscribe
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/local/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fa94d1dbf10>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/timeline/subscribe?commandID=1&port=32400&protocol=http (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa94d1dbf10>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 479, in playMedia
self.sendCommand('timeline/subscribe', port=server_port, protocol='http')
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 204, in sendCommand
return query(key, headers=headers)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 161, in query
response = method(url, headers=headers, timeout=timeout, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 543, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/timeline/subscribe?commandID=1&port=32400&protocol=http (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa94d1dbf10>: Failed to establish a new connection: [Errno 111] Connection refused'))
2020-03-26 19:29:20 ERROR (MainThread) [homeassistant.helpers.script] Intent Script Plex: Error executing script. Unexpected error for call_service at pos 1: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/playback/playMedia?address=192.168.0.14&commandID=2&containerKey=/playQueues/3762%3Fwindow%3D100%26own%3D1&key=/library/metadata/8249&machineIdentifier=d0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d&offset=0&port=32400&token=transient-e1ef87cf-298f-4376-8879-3ed76d062990&type=video (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa94d10efd0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/local/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 184, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fa94d10efd0>: Failed to establish a new connection: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/playback/playMedia?address=192.168.0.14&commandID=2&containerKey=/playQueues/3762%3Fwindow%3D100%26own%3D1&key=/library/metadata/8249&machineIdentifier=d0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d&offset=0&port=32400&token=transient-e1ef87cf-298f-4376-8879-3ed76d062990&type=video (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa94d10efd0>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
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 174, in handle_input
plex_c.playMedia(media)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 496, in playMedia
}, **params))
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 204, in sendCommand
return query(key, headers=headers)
File "/usr/local/lib/python3.7/site-packages/plexapi/client.py", line 161, in query
response = method(url, headers=headers, timeout=timeout, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/543, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=32400): Max retries exceeded with url: /player/playback/playMedia?address=192.168.0.14&commandID=2&containerKey=/playQueues/3762%3Fwindow%3D100%26own%3D1&key=/library/metadata/8249&machineIdentifier=d0a25cbfa6fcc44d766dfea3abfc23b54c4caa5d&offset=0&port=32400&token=transient-e1ef87cf-298f-4376-8879-3ed76d062990&type=video (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa94d10efd0>: Failed to establish a new connection: [Errno 111] Connection refused'))
2020-03-26 19:29:20 WARNING (MainThread) [homeassistant.components.dialogflow] Error handling Plex
Anytime you see the host='127.0.0.1
it means plex and/or the cast.bundle plugin is reporting your tv’s IP as self assigned. Not sure what’s going on there, trying some things to hopefully replicate the issue.
For controls you should just be able to say say pause google hub
etc.