Fabman & Octoprint Integration

Hi,

as you know from our meeting, we have some progress on Fabman integration to Octoprint. Currently we can apply this “hack” (https://github.com/rplnt/octoprint-fabman-auth) which change the way Octoprint (OP) check if the user can login or not. There will be a change in the main logon function in the next release of OP (1.3.5) and it will be possible to make custom plugin with this feature, so we wont need to hack it with every OP release.

We want ask, what progress do you have with sending data to Fabman DB (FM) by API? We have some ideas about what we want to send to FM DB, and it would be great if we could test it somewhere. Also, do you have any plans to make some testing DB where it could be possible to test some functions and don’t mess with real data? That would be superb and we could make some new progress on this.

We also have “roadmap” for FM & OP integration and we can share it with you if you are interested.

Let us know and we can write down some more info.

That’s all for now.

Miroslav
Core Team FabLab Brno

1 Like

what progress do you have with sending data to Fabman DB (FM) by API?

We’re planning to offer three additional API endpoints (as we briefly discussed during the meeting):

  1. An endpoint to tell Fabman that a member wants to start a machine.
    • If the member is allowed to use the machine, Fabman will start a corresponding activity log record and show the machine as “busy”.
    • if the member is not allowed to use the machine at that particular time, it will return a 403 error with a detailed reason why the member isn’t allowed.
  2. An endpoint to tell Fabman that a machine was stopped. This will close corresponding activity log record and create appropriate charges (if necessary).
  3. An endpoint to attach arbitrary key-value metadata to any existing log record. You could use this to keep track of details about a 3D print job, machine runtime information, etc.

Do you need anything else?

We’re currently putting the finishing touches on a big, big update. As soon as it’s out the door, we’ll start working on those endpoints – I’ll let you know when it’s available.

Do you have any plans to make some testing DB where it could be possible to test some functions and don’t mess with real data?

You can simply sign up for an additional Fabman account and fill it with test data. Send us a message with your account details if the trial period is not long enough for your tests.

We also have “roadmap” for FM & OP integration and we can share it with you if you are interested.

Yes, please! :pray: I’m very interested in what you’ve planned. You can either post it in the forum or send us an email, whatever you prefer.

Yes, please!

Really rough roadmap:

  1. Modify original login script for Octoprint so users can logon with credentials from FM
  2. Make this a plugin so Octoprint update will not brake it
  3. Make request to Octoprint developer so uploaded prints have in OP tag with user ID from FM
  4. Make changes in history plugin (save percentage info of failed prints - price for not finished prints)
  5. Connect information about print history from OP to FM or other DB
  6. Connect OP & FM so information from running print (+ preview of print) can be displayed in user profile
  7. Write login information to DB so if anyone is loged on to OP can not login to another printer (One printer per user ) - maybe make this rule just in some hoursc (printers are not so busy on weekends )

Point 1 is done, 2 is (I hope) in progress, anything else is meantime in dreams. Whole idea is replace Fabman with Octoprint. I did not contact OP developer with questions what we want to do, but I will in very near future.

You can simply sign up for an additional Fabman account and fill it with test data. Send us a message with your account details if the trial period is not long enough for your tests.

Ok, that woul be enough for testing. Is it possible to copy our DB so we will have more data to test?

We’re planning to offer three additional API endpoints

Points 1 & 2 will be same as information which we can take from OP (if I understad it right), but we can combine it with this informaton and if Fabman receive start or stop it can “allow/disable” use for other user. Point 3 will be very helpfull as we can you use it with storing informations to DB (print time, progress, filament use, etc.).

We’re currently putting the finishing touches on a big, big update

Any sneak peak what is coming? Just between us, of course :wink: .

Thank you for the update.

We have no built-in way to migrate data between accounts, but you can easily use our API to fetch some/all members or equipment from one account and POST them to another.


:wink:

1 Like

Hey Miroslav,
the new APIs are finally here! As I explained for your coffee machine, you can use the new bridge API to better integrate with Octoprint’s login system.

Once you’ve done that, you can use the new activity log metadata to implement point 5 and 6 of your roadmap: Attach any print details to the activity log to keep track of material usage, print duration, …
We originally planned to allow only key-value pairs, but @roland convinced me it would be useful to support full JSON as metadata – so we did. I hope you like it. :wink:

Unfortunately, the activity log (and therefore the metadata) is only visible in the admin app for now – normal members can’t see it yet. But were planning to add the activity log (and much more) to the member portal in the foreseeable future.

Let me know if you have any questions.

1 Like

Hi Miroslav,

We are about to use your Fabman plugin at Happylab to connect our Prusa printers via OctoPrint to Fabman. Thank you for your work - it seems to be exaclty what we need!

I managed to install the plugin an to login with my Fabman username/password. Unfortunately, when I do this, the Upload button disappears and the Print icon for already uploaded GCODE files (uploaded by a local user) are greyed out. So, when I’m logged in as a Fabman user I cannot upload any print job.

image

As a local user, everything works fine.
Have you got any idea how to fix this?

Thanks in advance,
Roland

I think I found out, what the problem is:
It seems that if restrictAccess is set to true in config.yaml, it will only check whether the user has attended a training that includes this machine. But it does not check, whether a training for this machine is needed at all. So, even if the machine’s option “traning required” is not set or the user has admin permissions, it does not get the octoprint user-role anyway - and therefore the user is not able to upload/print.

Hello @roland :slight_smile:,

we are glad that somebody trying to use this but to be honest I did not write that code and we abandoned this road quite some time ago so I really can not tell you where the problem is, but I know that there were some security changes in Octoprint server since we used it.

We switched our project to FM bridge in printer as we thought that there will be quite problem to teach users how to use it as some of our members (older ones) do not know how to operate computer so we choose safer way.

Sorry that I could not help you more.