Skip to content

bambuconfig

Classes:

Name Description
BambuConfig

This is the main configuration class for BambuPrinter and is how it knows where to connect to a printer,

BambuConfig

Python
BambuConfig(
    hostname: str | None = None,
    access_code: str | None = None,
    serial_number: str | None = None,
    mqtt_port: int | None = 8883,
    mqtt_client_id: str | None = "studio_client_id:0c1f",
    mqtt_username: str | None = "bblp",
    watchdog_timeout: int | None = 30,
    external_chamber: bool | None = False,
    verbose: bool | None = False,
)

This is the main configuration class for BambuPrinter and is how it knows where to connect to a printer, what access code, and serial # to use. Further, it contains a number of printer behavioral settings that can be changed based on client needs. BambuConfig can also be used to change the log level of bambu-printer-manager's logging engine.

Parameters

  • hostname : Optional[str] = None
  • access_code : Optional[str] = None
  • serial_number : Optional[str] = None
  • mqtt_port : Optional[int] = 8883
  • mqtt_client_id : Optional[str] = "studio_client_id:0c1f"
  • mqtt_username : Optional[str] = "bblp"
  • watchdog_timeout : Optional[int] = 30
  • external_chamber : Optional[bool] = False
  • verbose : Optional[bool] = False

external_chamber can be used to tell BambuPrinter not to use any of the chamber temperature data received from the printer. This can be useful if you are using an external chamber temperature sensor / heater and want to inject the sensor value and target temperatures into BambuPrinter directly.

verbose triggers a global log level change (within the scope of bambu-printer-manager) based on its value. True will set a log level of DEBUG and False (the default) will set the log level to WARNING.

Attributes

  • All parameters listed above
  • _firmware_version : str - Reported printer firmware version
  • _ams_firmware_version : str - Reported AMS firmware version
  • _printer_model : bambutools.PrinterModel - Model # derived from serial #
  • _auto_recovery : bool - auto recovery from lost steps print option
  • _filament_tangle_detect : bool - detect spool tangles print option
  • _sound_enable : bool - printer speaker print option
  • _auto_switch_filament : bool - AMS auto switch filamement on runout print option
  • _startup_read_option : bool - AMS will automatically read RFID on boot
  • _tray_read_option : bool - AMS will automatically read RFID on tray/spool change
  • _calibrate_remain_flag : bool - AMS will calculate remaining amount of filament in spool (unverified)
  • _buildplate_marker_detector : bool - printer will attempt to validate build plate
Source code in src/bpm/bambuconfig.py
Python
def __init__(
    self,
    hostname: str | None = None,
    access_code: str | None = None,
    serial_number: str | None = None,
    mqtt_port: int | None = 8883,
    mqtt_client_id: str | None = "studio_client_id:0c1f",
    mqtt_username: str | None = "bblp",
    watchdog_timeout: int | None = 30,
    external_chamber: bool | None = False,
    verbose: bool | None = False,
):
    """
    Sets up all internal storage attributes for `BambuConfig`.

    Parameters
    ----------
    * hostname : Optional[str] = None
    * access_code : Optional[str] = None
    * serial_number : Optional[str] = None
    * mqtt_port : Optional[int] = 8883
    * mqtt_client_id : Optional[str] = "studio_client_id:0c1f"
    * mqtt_username : Optional[str] = "bblp"
    * watchdog_timeout : Optional[int] = 30
    * external_chamber : Optional[bool] = False
    * verbose : Optional[bool] = False

    `external_chamber` can be used to tell `BambuPrinter` not to use any of the chamber
    temperature data received from the printer.  This can be useful if you are using an
    external chamber temperature sensor / heater and want to inject the sensor value and
    target temperatures into `BambuPrinter` directly.

    `verbose` triggers a global log level change (within the scope of `bambu-printer-manager`)
    based on its value.  `True` will set a log level of `DEBUG` and `False` (the default) will
    set the log level to `WARNING`.

    Attributes
    ---------
    * All parameters listed above
    * _firmware_version : str - Reported printer firmware version
    * _ams_firmware_version : str - Reported AMS firmware version
    * _printer_model : bambutools.PrinterModel - Model # derived from serial #
    * _auto_recovery : bool - auto recovery from lost steps print option
    * _filament_tangle_detect : bool - detect spool tangles print option
    * _sound_enable : bool - printer speaker print option
    * _auto_switch_filament : bool - AMS auto switch filamement on runout print option
    * _startup_read_option : bool - AMS will automatically read RFID on boot
    * _tray_read_option : bool - AMS will automatically read RFID on tray/spool change
    * _calibrate_remain_flag : bool - AMS will calculate remaining amount of filament in spool (unverified)
    * _buildplate_marker_detector : bool - printer will attempt to validate build plate
    """

    self._hostname = hostname
    self._access_code = access_code
    self.serial_number = serial_number
    self._mqtt_port = mqtt_port
    self._mqtt_client_id = mqtt_client_id
    self._mqtt_username = mqtt_username
    self._watchdog_timeout = watchdog_timeout
    self._external_chamber = external_chamber
    self._verbose = verbose

    self._firmware_version = ""
    self._ams_firmware_version = ""
    self._printer_model = PrinterModel.UNKNOWN
    self._auto_recovery = True
    self._filament_tangle_detect = True
    self._sound_enable = True
    self._auto_switch_filament = True
    self._startup_read_option = True
    self._tray_read_option = True
    self._calibrate_remain_flag = True
    self._buildplate_marker_detector = True