def METHOD_NAME(self):
    current_devices = self._config.devices
    def get_device_state(id_):
        for dev in current_devices:
            if dev.id == id_:
                return dev.enabled
        return False
    try:
        conn = self._connectionFactory.ensure_connection(self._config)
        devices = conn.get_devices()
    except Exception:
        logger.exception("Failed to connect to tiktoch server please check settings and try again")
        QMessageBox.critical(
            self, "Connection failed", "Failed to connect to tiktoch server please check settings and try again"
        )
        return
    new_devices = []
    for id_, name in devices:
        state = get_device_state(id_)
        new_devices.append(types.Device(id=id_, name=name, enabled=state))
    self._config = self._config.evolve(devices=new_devices)
    self._updateFieldsFromConfig()
    self.gotDevices.emit()