async def async_step_cloud(self, user_input=None):
    'Configure a xiaomi miio device through the Miio Cloud.'
    errors = {}
    if (user_input is not None):
        if user_input[CONF_MANUAL]:
            return (await self.async_step_manual())
        cloud_username = user_input.get(CONF_CLOUD_USERNAME)
        cloud_password = user_input.get(CONF_CLOUD_PASSWORD)
        cloud_country = user_input.get(CONF_CLOUD_COUNTRY)
        if ((not cloud_username) or (not cloud_password) or (not cloud_country)):
            errors['base'] = 'cloud_credentials_incomplete'
            return self.async_show_form(step_id='cloud', data_schema=DEVICE_CLOUD_CONFIG, errors=errors)
        miio_cloud = MiCloud(cloud_username, cloud_password)
        if (not (await self.hass.async_add_executor_job(miio_cloud.login))):
            errors['base'] = 'cloud_login_error'
            return self.async_show_form(step_id='cloud', data_schema=DEVICE_CLOUD_CONFIG, errors=errors)
        devices_raw = (await self.hass.async_add_executor_job(miio_cloud.get_devices, cloud_country))
        if (not devices_raw):
            errors['base'] = 'cloud_no_devices'
            return self.async_show_form(step_id='cloud', data_schema=DEVICE_CLOUD_CONFIG, errors=errors)
        self.cloud_devices = {}
        for device in devices_raw:
            parent_id = device.get('parent_id')
            if (not parent_id):
                name = device['name']
                model = device['model']
                list_name = f'{name} - {model}'
                self.cloud_devices[list_name] = device
        self.cloud_username = cloud_username
        self.cloud_password = cloud_password
        self.cloud_country = cloud_country
        if (self.host is not None):
            for device in self.cloud_devices.values():
                cloud_host = device.get('localip')
                if (cloud_host == self.host):
                    self.extract_cloud_info(device)
                    return (await self.async_step_connect())
        if (len(self.cloud_devices) == 1):
            self.extract_cloud_info(list(self.cloud_devices.values())[0])
            return (await self.async_step_connect())
        return (await self.async_step_select())
    return self.async_show_form(step_id='cloud', data_schema=DEVICE_CLOUD_CONFIG, errors=errors)
Configure a xiaomi miio device through the Miio Cloud.
async def async_step_cloud(self, user_input=None):
    
    errors = {}
    if (user_input is not None):
        if user_input[CONF_MANUAL]:
            return (await self.async_step_manual())
        cloud_username = user_input.get(CONF_CLOUD_USERNAME)
        cloud_password = user_input.get(CONF_CLOUD_PASSWORD)
        cloud_country = user_input.get(CONF_CLOUD_COUNTRY)
        if ((not cloud_username) or (not cloud_password) or (not cloud_country)):
            errors['base'] = 'cloud_credentials_incomplete'
            return self.async_show_form(step_id='cloud', data_schema=DEVICE_CLOUD_CONFIG, errors=errors)
        miio_cloud = MiCloud(cloud_username, cloud_password)
        if (not (await self.hass.async_add_executor_job(miio_cloud.login))):
            errors['base'] = 'cloud_login_error'
            return self.async_show_form(step_id='cloud', data_schema=DEVICE_CLOUD_CONFIG, errors=errors)
        devices_raw = (await self.hass.async_add_executor_job(miio_cloud.get_devices, cloud_country))
        if (not devices_raw):
            errors['base'] = 'cloud_no_devices'
            return self.async_show_form(step_id='cloud', data_schema=DEVICE_CLOUD_CONFIG, errors=errors)
        self.cloud_devices = {}
        for device in devices_raw:
            parent_id = device.get('parent_id')
            if (not parent_id):
                name = device['name']
                model = device['model']
                list_name = f'{name} - {model}'
                self.cloud_devices[list_name] = device
        self.cloud_username = cloud_username
        self.cloud_password = cloud_password
        self.cloud_country = cloud_country
        if (self.host is not None):
            for device in self.cloud_devices.values():
                cloud_host = device.get('localip')
                if (cloud_host == self.host):
                    self.extract_cloud_info(device)
                    return (await self.async_step_connect())
        if (len(self.cloud_devices) == 1):
            self.extract_cloud_info(list(self.cloud_devices.values())[0])
            return (await self.async_step_connect())
        return (await self.async_step_select())
    return self.async_show_form(step_id='cloud', data_schema=DEVICE_CLOUD_CONFIG, errors=errors)