Skip to content

Plex sensor not working when using username/password #11581

@arsaboo

Description

@arsaboo

Home Assistant release (hass --version): 0.60.1

Python release (python3 --version): 3.6.2

Component/platform: Plex Sensor

Description of problem: Looks like it is an upstream issue, but leaving the issue open for others until it is fixed. Also, only those using username/password will be affected. See the logs below.

2018-01-11 15:57:28 ERROR (SyncWorker_32) [urllib3.connection] Certificate did not match expected hostname: my.plexapp.com. Certificate: {'subject': ((('businessCategory', 'Private Organization'),), (('jurisdictionCountryName', 'CH'),), (('serialNumber', 'CH15040047209'),), (('countryName', 'CH'),), (('localityName', 'Stans'),), (('organizationName', 'Plex GmbH'),), (('commonName', 'plex.tv'),)), 'issuer': ((('countryName', 'US'),), (('organizationName', 'DigiCert Inc'),), (('organizationalUnitName', 'www.digicert.com'),), (('commonName', 'DigiCert SHA2 Extended Validation Server CA'),)), 'version': 3, 'serialNumber': '07AC7078181A3691747A52E310A90002', 'notBefore': 'Dec 15 00:00:00 2017 GMT', 'notAfter': 'Dec 19 12:00:00 2019 GMT', 'subjectAltName': (('DNS', 'plex.tv'), ('DNS', 'www.plex.tv')), 'OCSP': ('http://ocsp.digicert.com',), 'caIssuers': ('http://cacerts.digicert.com/DigiCertSHA2ExtendedValidationServerCA.crt',), 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g2.crl', 'http://crl4.digicert.com/sha2-ev-server-g2.crl')}
2018-01-11 15:57:28 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform plex
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 850, in _validate_conn
    conn.connect()
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connection.py", line 346, in connect
    _match_hostname(cert, self.assert_hostname or hostname)
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connection.py", line 356, in _match_hostname
    match_hostname(cert, asserted_hostname)
  File "/usr/lib/python3.6/ssl.py", line 327, in match_hostname
    % (hostname, ', '.join(map(repr, dnsnames))))
ssl.CertificateError: hostname 'my.plexapp.com' doesn't match either of 'plex.tv', 'www.plex.tv'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='my.plexapp.com', port=443): Max retries exceeded with url: /users/sign_in.xml (Caused by SSLError(CertificateError("hostname 'my.plexapp.com' doesn't match either of 'plex.tv', 'www.plex.tv'",),))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 171, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/plex.py", line 63, in setup_platform
    plex_token)], True)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/plex.py", line 86, in __init__
    user = MyPlexAccount(plex_user, plex_password)
  File "/srv/homeassistant/lib/python3.6/site-packages/plexapi/myplex.py", line 79, in __init__
    data, initpath = self._signin(username, password, timeout)
  File "/srv/homeassistant/lib/python3.6/site-packages/plexapi/myplex.py", line 87, in _signin
    data = self.query(self.SIGNIN, method=self._session.post, auth=(username, password), timeout=timeout)
  File "/srv/homeassistant/lib/python3.6/site-packages/plexapi/myplex.py", line 152, in query
    response = method(url, headers=headers, timeout=timeout, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 555, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='my.plexapp.com', port=443): Max retries exceeded with url: /users/sign_in.xml (Caused by SSLError(CertificateError("hostname 'my.plexapp.com' doesn't match either of 'plex.tv', 'www.plex.tv'",),))

Expected: Plex sensor should work :)

Config:

  - platform: plex
    name: PlexSpy
    host: 192.168.2.212
    port: 32400
    username: !secret plex_user
    password: !secret plex_password

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions