'Initialize the scanner.'

def __init__(self, config):

    self.host = config[CONF_HOST]
    self.username = config[CONF_USERNAME]
    self.password = config.get(CONF_PASSWORD, '')
    self.ssh_key = config.get('ssh_key', config.get('pub_key', ''))
    self.protocol = config[CONF_PROTOCOL]
    self.mode = config[CONF_MODE]
    self.port = config[CONF_PORT]
    if (self.protocol == 'ssh'):
        if (not (self.ssh_key or self.password)):
            _LOGGER.error('No    password    or    private    key    specified')
            self.success_init = False
            return
        self.connection = SshConnection(self.host, self.port, self.username, self.password, self.ssh_key, (self.mode == 'ap'))
    else:
        if (not self.password):
            _LOGGER.error('No    password    specified')
            self.success_init = False
            return
        self.connection = TelnetConnection(self.host, self.port, self.username, self.password, (self.mode == 'ap'))
    self.last_results = {}
    data = self.get_asuswrt_data()
    self.success_init = (data is not None)
