'Update method for Plex sensor.'

@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):

    sessions = self._server.sessions()
    now_playing = []
    for sess in sessions:
        user = (sess.username if (sess.username is not self._na_type) else '')
        title = (sess.title if (sess.title is not self._na_type) else '')
        year = (sess.year if (sess.year is not self._na_type) else '')
        now_playing.append((user, '{0}    ({1})'.format(title, year)))
    self._state = len(sessions)
    self._now_playing = now_playing
