async def async_step_user(self, user_input=None):
    'Handle a flow initiated by the user.'
    errors = {}
    if (user_input is None):
        return (await self._show_setup_form())
    host = user_input.get(CONF_HOST, self.placeholders[CONF_HOST])
    port = self.placeholders[CONF_PORT]
    ssl = self.placeholders[CONF_SSL]
    username = user_input.get(CONF_USERNAME, self.placeholders[CONF_USERNAME])
    password = user_input[CONF_PASSWORD]
    if (not username):
        username = self.placeholders[CONF_USERNAME]
    try:
        api = (await self.hass.async_add_executor_job(get_api, password, host, username, port, ssl))
    except CannotLoginException:
        errors['base'] = 'config'
    if errors:
        return (await self._show_setup_form(user_input, errors))
    info = (await self.hass.async_add_executor_job(api.get_info))
    (await self.async_set_unique_id(info['SerialNumber'], raise_on_progress=False))
    self._abort_if_unique_id_configured()
    config_data = {CONF_USERNAME: username, CONF_PASSWORD: password, CONF_HOST: host, CONF_PORT: api.port, CONF_SSL: api.ssl}
    if ((info.get('ModelName') is not None) and (info.get('DeviceName') is not None)):
        name = f"{info['ModelName']} - {info['DeviceName']}"
    else:
        name = info.get('ModelName', DEFAULT_NAME)
    return self.async_create_entry(title=name, data=config_data)
Handle a flow initiated by the user.
async def async_step_user(self, user_input=None):
    
    errors = {}
    if (user_input is None):
        return (await self._show_setup_form())
    host = user_input.get(CONF_HOST, self.placeholders[CONF_HOST])
    port = self.placeholders[CONF_PORT]
    ssl = self.placeholders[CONF_SSL]
    username = user_input.get(CONF_USERNAME, self.placeholders[CONF_USERNAME])
    password = user_input[CONF_PASSWORD]
    if (not username):
        username = self.placeholders[CONF_USERNAME]
    try:
        api = (await self.hass.async_add_executor_job(get_api, password, host, username, port, ssl))
    except CannotLoginException:
        errors['base'] = 'config'
    if errors:
        return (await self._show_setup_form(user_input, errors))
    info = (await self.hass.async_add_executor_job(api.get_info))
    (await self.async_set_unique_id(info['SerialNumber'], raise_on_progress=False))
    self._abort_if_unique_id_configured()
    config_data = {CONF_USERNAME: username, CONF_PASSWORD: password, CONF_HOST: host, CONF_PORT: api.port, CONF_SSL: api.ssl}
    if ((info.get('ModelName') is not None) and (info.get('DeviceName') is not None)):
        name = f"{info['ModelName']} - {info['DeviceName']}"
    else:
        name = info.get('ModelName', DEFAULT_NAME)
    return self.async_create_entry(title=name, data=config_data)