'Initialize the sensor.'

def __init__(self, name, plex_url, plex_user, plex_password, plex_server):

    from plexapi.utils import NA
    from plexapi.myplex import MyPlexAccount
    from plexapi.server import PlexServer
    self._na_type = NA
    self._name = name
    self._state = 0
    self._now_playing = []
    if (plex_user and plex_password):
        user = MyPlexAccount.signin(plex_user, plex_password)
        server = (plex_server if plex_server else user.resources()[0].name)
        self._server = user.resource(server).connect()
    else:
        self._server = PlexServer(plex_url)
