def __init__(self, hass, name, host, port, username=None, password=None, turn_off_action=None):
    'Initialize the Kodi device.'
    import jsonrpc_async
    self.hass = hass
    self._name = name
    kwargs = {'timeout': DEFAULT_TIMEOUT, 'session': async_get_clientsession(hass)}
    if (username is not None):
        kwargs['auth'] = aiohttp.BasicAuth(username, password)
        image_auth_string = '{}:{}@'.format(username, password)
    else:
        image_auth_string = ''
    self._http_url = 'http://{}:{}/jsonrpc'.format(host, port)
    self._image_url = 'http://{}{}:{}/image'.format(image_auth_string, host, port)
    self._server = jsonrpc_async.Server(self._http_url, **kwargs)
    self._turn_off_action = turn_off_action
    self._players = list()
    self._properties = None
    self._item = None
    self._app_properties = None
Initialize the Kodi device.
def __init__(self, hass, name, host, port, username=None, password=None, turn_off_action=None):
    
    import jsonrpc_async
    self.hass = hass
    self._name = name
    kwargs = {'timeout': DEFAULT_TIMEOUT, 'session': async_get_clientsession(hass)}
    if (username is not None):
        kwargs['auth'] = aiohttp.BasicAuth(username, password)
        image_auth_string = '{}:{}@'.format(username, password)
    else:
        image_auth_string = 
    self._http_url = 'http://{}:{}/jsonrpc'.format(host, port)
    self._image_url = 'http://{}{}:{}/image'.format(image_auth_string, host, port)
    self._server = jsonrpc_async.Server(self._http_url, **kwargs)
    self._turn_off_action = turn_off_action
    self._players = list()
    self._properties = None
    self._item = None
    self._app_properties = None