Metadata-Version: 2.5
Name: trytond_print3d_prusa
Version: 8.0.0.1
Summary: PrusaLink connector module of the print3d 3D printing management group
Author: Clemens Hupka
Maintainer-email: Clemens Hupka <clemens.hupka@backend.at>
License-Expression: GPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
Keywords: 3d printing,connector,g-code,prusa,prusalink,tryton
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Topic :: Office/Business
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: trytond-print3d<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Description-Content-Type: text/x-rst

PrusaLink Connector and G-code Files
====================================

The ``print3d_prusa`` module holds the Prusa side of a print3d deployment:
the connector of the PrusaLink local API of an MK4, a MK3.9, an XL, a MINI+
or a CORE One, and the book of the g-code files that connector wrote to the
storages of those machines.  It extends the registry of the printers of the
``print3d`` core with the connector of the machine and with what the machine
reports about itself, and it drives the print the machine runs, writes a
g-code file to it and preheats it.

Features
--------

- **Local API connector**: the connector of the module drives a Prusa printer
  over the ``/api`` and ``/api/v1`` endpoints of its PrusaLink, which is the
  firmware of the machine and the PrusaLink of a Raspberry Pi at a machine
  alike.  It reads the state, the job, the temperatures, the filament and
  the storages back into the core and it drives the print job of the
  machine.  The connector is named in the ``connector`` selection of a
  printer and registered in the registry of the group, so the registry of
  the printers never depends on the module that talks to them.
- **API key authentication**: the local API authenticates with the API key
  of the machine, sent in the ``X-Api-Key`` header.  The key is read from
  the credential store of the group, which encrypts it at rest, so the
  module carries no secret of its own and a printer that carries no key is
  refused rather than read anonymously.
- **Printer data**: the firmware, the type of the machine, its serial, the
  diameter of its nozzle, whether it is fitted with a multi material unit
  and the filament it reports are kept on the printer, where the maintenance
  of the fleet and the operator read them.  A value the machine did not
  report leaves the last known value in place, so a deployment that does not
  answer an endpoint is not read as a machine without one.
- **Print control**: *Pause*, *Resume* and *Stop* drive the print the
  machine runs through the job endpoint, and *Preheat* sets the target
  temperature of the nozzle and of the bed from the targets the printer
  carries.  The preheat endpoints are answered by the PrusaLink of a
  Raspberry Pi and not by the firmware of the machine; a machine that
  refuses them is reported rather than left looking as if it had taken the
  target (issue #1182).
- **G-code files**: the module keeps the book of the files it wrote to a
  printer - one ``print3d.prusa.file`` per file, with the name the printer
  knows it by, the storage it was written to and the state the printer
  reported it in.  An operator sees what a machine holds without reading the
  machine, a print is started by naming a file the fleet booked, and a file
  is dropped from the printer and from the book in one action.
- **Upload**: *Upload G-code* writes a file to the storage of a printer,
  raw, the way the API takes it.  The storage is the one the printer
  reports for itself unless the operator names another, the printer starts
  the print as soon as the file is written when it is asked to, and a name
  that carries a path is refused before the request is built.
- **State reconciliation**: a reading of the printer moves the file the
  machine names to *printing* and the file it has left behind to *done*.  A
  print that is paused is the same print of the same file, and a file the
  machine told nothing about is left as it was written, because what the
  book says is what the printer said.
- **Storages**: the storages of the machine - the internal one and the USB
  drive - are read with whether each of them is available and whether it is
  read only, so a file is written to a storage the machine itself reports.

Dependencies
------------

- Tryton modules: ``ir``, ``res``, ``print3d``.

``print3d`` is required because the connector implements the connector
framework of the core, because the module extends the registry of the
printers of the core, and because the HTTP transport, the credential store
and the reading of the fleet are the ones of the core.  The filament stock
of the group is deliberately not a dependency: the PrusaLink API reports the
filament a machine is fed with and does not name a spool of the stock, so
what the machine reports is kept on the printer and never written into the
stock of a spool.

Models
------

- ``print3d.printer`` (extended): the printer of the core, with the
  connector of its local API, what the machine reports about itself, the
  targets of the preheat, the files the module wrote to it and the actions
  that drive it.
- ``print3d.prusa.file``: one g-code file the module wrote to a printer,
  with the name the printer knows it by, the storage it was written to and
  the state the printer reported it in.

Security
--------

- ``group_print3d_prusa``: the read-only group.  It browses the printers of
  the module and the g-code they hold but does not drive them.
- ``group_print3d_prusa_admin``: full control over the module, including the
  registration of the printers of the fleet and the actions that drive them.
- The administration of the deployment (``res.group_admin``) is offered the
  screens and the actions as well, but not the write permissions of the
  module.

Documentation
-------------

The full documentation of the module is in ``doc/index.rst``, under
*PrusaLink Connector and G-code Files*.
