Files
InvenTree/docs/docs/plugins/mixins/machine.md
T
Oliver bd9c52eeaf Machine registry improvements (#10150)
* Add wrapper function for machine registry

* Decorate entrypoint functions

* Docstrings

* Fix for boolean setting

* Add playwright tests

* Use proper entrypoints

* Ensure settings are fetched correctly

* Prevent recursion of machine registry decorator

* Fix machine status display

* Enhanced warning msg

* Add simple machine sample printer

* Adds playwright tests for machine UI

* re-throw exception

* Define 'machine' plugin mixin class

* Adjust machine discovery

* Use plugin mixins for registering machine types and drivers

* Adjust unit test

* Remove plugin static files when deactivating

* Force machine reload when plugin registry changes

* Add plugins specific to testing framework

* Add test for plugin loading sequence

* Add session caching

- Significantly reduce DB hits

* Enhanced unit testing and test plugins

* Refactor unit tests

* Further unit test fixes

* Adjust instance rendering

* Display table of available drivers

* Cleanup

* ADjust unit test

* Tweak unit test

* Add docs on new mixin type

* Tweak machine overview docs

* Tweak playwright tests

* Additional unit test

* Add unit test for calling machine func

* Enhanced playwright tests

* Account for database not being ready
2025-08-20 23:00:39 +10:00

1.7 KiB

title
title
Machine Mixin

MachineDriverMixin

The MachineDriverMixin class is used to implement custom machine drivers (or machine types) in InvenTree.

InvenTree supports integration with external machines, through the use of plugin-supplied device drivers.

get_machine_drivers

To register custom machine driver(s), the get_machine_drivers method must be implemented. This method should return a list of machine driver classes that the plugin supports.

::: plugin.base.integration.MachineMixin.MachineDriverMixin.get_machine_drivers options: show_bases: False show_root_heading: False show_root_toc_entry: False summary: False members: [] extra: show_source: True

The default implementation returns an empty list, meaning no custom machine drivers are registered.

get_machine_types

To register custom machine type(s), the get_machine_types method must be implemented. This method should return a list of machine type classes that the plugin supports.

::: plugin.base.integration.MachineMixin.MachineDriverMixin.get_machine_types options: show_bases: False show_root_heading: False show_root_toc_entry: False summary: False members: [] extra: show_source: True

The default implementation returns an empty list, meaning no custom machine types are registered.

Sample Plugin

A sample plugin is provided which implements a simple label printing machine driver:

::: plugin.samples.machines.sample_printer.SamplePrinterMachine options: show_bases: False show_root_heading: False show_root_toc_entry: False show_source: True members: []