Plex Sensor stopped working since updating to 66.1

I’ve had the Plex sensor set up for quite a few version now, but since updating from 64.x to 66.1, the sensor has stopped working. With the config I had prior to v66, the sensor showed up after HA update but the number of viewers never updated when something was playing on the server.

Config prior to v66 (working on pre-66.1):

- platform: plex
  host: 192.168.0.75
  port: 32400
  token: XXXXXXXXXXX

Error when Plex is actually playing:

Log Details (ERROR)
    Mon Apr 23 2018 22:22:51 GMT+1000 (AEST)

    Update for sensor.miniplex fails
    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 204, in async_update_ha_state
        yield from self.async_device_update()
      File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
        yield from self.hass.async_add_job(self.update)
      File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/usr/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 319, in wrapper
        result = method(*args, **kwargs)
      File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/plex.py", line 131, in update
        season_episode += " · E{1}".format(sess.index)
    IndexError: tuple index out of range

I thought I’d go with as little info as possible, since most values are optional, so after changing to:

- platform: plex
  host: 192.168.0.75

I get the following error messages:

Log Details (WARNING)
Mon Apr 23 2018 21:55:10 GMT+1000 (AEST)

BadRequest (401) unauthorized http://192.168.0.75:32400/; <html><head><script>window.location = window.location.href.match(/(^.+\/)[^\/]*$/)[1] + 'web/index.html';</script><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>


Log Details (ERROR)
Mon Apr 23 2018 21:55:10 GMT+1000 (AEST)

(401) unauthorized; http://192.168.0.75:32400/ <html><head><script>window.location = window.location.href.match(/(^.+\/)[^\/]*$/)[1] + 'web/index.html';</script><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>

I’ve also tried the following, but there’s no sensor popping up, or any error messages:

- platform: plex

What’s changed? What’s the fix? Help!

Upgrading to the latest version of HA, 0.67 will resolve this issue.

https://github.com/home-assistant/home-assistant/pull/13659

Thanks, that did it!