Where I've been and what I've been working on... OctoFarm!

Where I've been and what I've been working on... OctoFarm!

So I've not done an update here in some time, and I truly doubt anyone is wondering at all why... But heck! I feel I should give some explanation and it affords me a perfect setup to segue into my latest and most time consuming project OctoFarm!

I have had other projects on the go which will be getting written up here soon as I can but recently the majority of my spare personal time has been thrown into my project called OctoFarm.

Without saying its name for a 3rd time... What is it!?

As you all know I use an open source application package called Octoprint for my 3d Printers setup. Octoprint is basically a web interface that allows control and management of a 3D printer through its USB ports, it can be set up and run on pretty much any hardware imaginable like RPi Zero, B2+ and later revisions. I currently run mine on an old Core i3 server with Ubuntu and let me tell you, I'll never be going back to sneaker netting my files to the printer again. However, whilst freaking awesome and getting better with every release it has one shortcoming for someone like me with multiple printers. It only allows you to control a single printer at any given time. You can have multiple printers connected and select a single one to print from, you can do a setup similar to mine where you have multiple Octoprint instances running on the same machine or you can have multiple Pi type devices connected to multiple machines but they all require you to access each instance through different browser tabs. Which admittedly is no problem bar laziness on my part with only 3 instances and machines running, but can become tiresome and problematic when having 5 or more.

So I started working on OctoFarm to create a single interface that unified all of those separate instances together utilizing Octoprints API access. Obviously... Being lazy as I am, I wondered if anyone else had actually begun this work first and the offerings out there specifically for Octoprint are either very old, or begun and abandoned projects with complex setup procedures. The one I initially used to get myself started was called PrinterView. Which was great albeit having it's bugs and other issues it allowed me to monitor my printers in a single interface. I liked his idea, it was just  a simple "index.html" file that you could open in chrome and begin adding printers too and monitoring from a single interface. You could also put it on a web server and have a single point of access for multiple devices.

So 8 months ago now my project began by changing up the style with a darker theme and adding in some different metrics and attempting to improve the layout. Work was slow at the start because I am not a seasoned JavaScript developer by any means and I've never even touched an API before working on this project but it has been a very fun learning project so far. It's improved my JavaScript knowledge a hell of a lot just by thinking "How do I do such and such..." and setting out to figure out other problems like the glaring CPU/Memory issues I'd introduced from the original project by creating event listeners on an element and never removing the original element or making multiple pointless API calls when they're just not needed.

On the 14/09/2019 I released version 0.92.2 which was a combined effort from my coding, and the wonderful bug checking help from a man named Derek who runs the website https://www.3dprinteddebris.com/ and a very large Octoprint connected printer farm. The project would not be at this stage without his help at all, and I wouldn't have figured out half the issues without him due to my limited access to printers. He's given me donations, pointed out bugs and also suggested some awesome workflow ideas and features that I hope have helped him manage his farm better. Massive thanks to this dude!

The feature set at 0.92.2 was as follows:

  • Connect to multiple printers
  • Currently only supports single extruder statistics
  • Check the status of your printers current job
  • Start/Pause/Restart/Resume/Cancel a print
  • Add your own background URL or File location
  • Browser your local Octoprint files, Folders and Sub Folders supported
  • Search through your Octoprint files
  • Upload files to root of Octoprint, or a folder
  • Create a folder on Octoprint
  • Select a file for printing
  • List View & Camera View
  • Printer control: hotend/bed temp, extruder, axis moving with step rate, feed rate and flow rate.
  • Import and Export of printer list

It worked wonderfully, with some little annoyances due to how I'd added my code. None of this became apparent due to my lack of JavaScript experience and little understanding of the original code base and its flow. I basically just added IF, ELSE statements everywhere with some additional variables in the mix to hold some printer metrics.

After this I'd gotten a bit hubris and decided to move further with the features and attempted to release version 0.93.1 which included:

  • Bug Fix - Camera View received incorrect padding
  • Bug Fix - Deleting a folder would cause console error. Deleting a file will remove the line now - skipping the need to refresh, folder deletes will refresh the list.
  • Bug Fix - When file selected time remaining would show as 00:00:00, now removed. *Enhancement - Time remaining now in human-readable format for Dashboard "Time Left" and File's List "Print Time"
  • New Feature - Setting to hide offline printers from the list/dash views. New setting added for each.
  • New Feature - New Tuning Menu, allows for changing temperature/flow and feed rates on the fly.
  • Enhancement - Settings view redone, click a header to reveal setting.
  • Enhancement - Steps for printer control defaults to 10
  • Enhancement - Moved printer setup options Add/Remove/Import/Export into their own menu option.
  • Enhancement - Monitoring tab not required until printers actually added. Hidden until there is at least 1 printer. Removed when printers < 1.
  • Enhancement - Updated dash cards display.
  • Bug Fix - Fixed issue with bootbox displays taking ages to show.
  • Bug Fix - Settings check would fail if saved storage was missing previously updated setting causing system to lock.
  • Bug Fix - Update status didn't check whether the panel existed on dashboard causing unneeded errors.
  • Bug Fix - Temp was checked for whilst offline, causing console errors.
  • Enhancement - Added overview panel to the dashboard view displaying how many printers online, offline, printing and complete.

This release didn't go very well, as it introduced just as many bugs as I'd fixed with it. There was also the big issue that every change to the stored variables required the user to Export and Import their printer list again to "activate" the new feature set and clear all the old variables. This had happened a few releases before, but I thought I was aware of the reasoning and I pretty much wasn't after trying some hacky fixes.

So this is where the project is currently at... After all this I decided it was time to re-work the entire thing from the ground up! I didn't like how printer management was handled, I didn't like how it constantly polled for offline printers, I didn't like how the dashboard wasn't a dashboard and I didn't like how unrefined it actually was. It looked like a script kiddies project and it pretty much was at this point.

So I've begun now working on version 0.98 which will be the groundwork to eventually release version 1.0... Which by that time I expect it to be a fully furnished release and no bugs for the initial feature set. I'm well on the way with it, but I have changed the workflow from the original quite a lot due to basically the knowledge and awareness I never previously had. I'm also well aware of some requested features I could never figure out how to "hack" onto the old code.

It's currently at the state where you can add/edit printers and click some setting stuff on and off, but heck, it's already a larger improvement to the mess I'd made with the older versions. I've included a gallery below of some current screenshots to wet some appetites, but it may take some time to get this newer version feature proficient and bug free. So far I've already improved the Import/Export options, as well as the adding and removing of printers. This new layout gave me some extra features too, like being able to see all your printers in an editable list. From this point it will generate a full database of printer lists and stats before even moving on to the API calls to get job statistics and everything else. I will also be incorporating workers, which are something new I'm just learning about for JavaScript making it somewhat multi-threaded, which will bring greater benefits to the entire workflow when switching between the dash and the various monitoring screens.

Hopefully this will be a much improved version, and allow for easier adoption of new feature sets in the future, before, as I've said, the code base was becoming an unmanageable mess and it isn't even that big compared to the projects out there. Anyway, thanks for taking the time to read and I will do another post when the project is ready to go. If you'd like to use it in its current state you can access it on my git here: https://git.notexpectedyet.com/NotExpectedYet/OctoFarm/releases. I recommend sticking with version 0.92.2 but you can try 0.93.1 without much issue setting it up from scratch. It takes some work to get your original printer list back into that version sadly.

Check out the preview for version 1.0