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,

PrinterCapabilities

Hardware capabilities discovered during the initial handshake or telemetry analysis.

BambuConfig

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

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 : IP address or DNS name of the printer on the local subnet.
  • access_code : 8-character LAN-only access code for MQTT authentication.
  • serial_number : Unique hardware identifier used to derive the printer model.
  • mqtt_port : Network port for the SSL-encrypted MQTT broker (Default: 8883).
  • mqtt_client_id : Unique identifier used during the MQTT handshake protocol.
  • mqtt_username : Authentication username for the local MQTT broker (Default: 'bblp').
  • watchdog_timeout : Duration in seconds before a connection is flagged as stale.
  • external_chamber : If True, ignores internal CTC telemetry to allow manual sensor injection.
  • verbose : Controls log verbosity; True sets level to DEBUG, False to WARNING.
  • capabilities : Pre-defined or discovered hardware feature set.

Attributes

  • firmware_version : Semantic version string of the main printer firmware.
  • ams_firmware_version : Semantic version string of the primary AMS controller.
  • printer_model : Enum classification (e.g. A1, H2D) derived from the serial prefix.
  • auto_recovery : Firmware-level toggle for resuming prints after step-loss.
  • filament_tangle_detect : Master switch for AMS tension-based monitor logic.
  • sound_enable : Controls the machine's internal speaker for user notifications.
  • auto_switch_filament : Enables automatic AMS failover to redundant spools.
  • buildplate_marker_detector : Toggles ArUco scanning for build surface verification.
  • capabilities : Data structure containing all verified hardware features.

Attributes:

Name Type Description
access_code str

The 8-character security credential required for LAN-mode authentication and MQTT encryption.

ams_firmware_version str

The semantic version string of the primary AMS controller firmware discovered on the hardware bus.

auto_recovery bool

Firmware-level toggle for the automatic resumption of print jobs after a detected X/Y axis step-loss event.

auto_switch_filament bool

Enables automatic failover to a compatible filament spool in the AMS when the current source runs out.

buildplate_marker_detector bool

Toggles the AI vision ArUco marker scanning system used to verify build surface compatibility.

calibrate_remain_flag bool

Enablement for the spool-weight based estimation of the remaining filament length in the AMS.

capabilities PrinterCapabilities

Data structure containing the verified set of hardware features discovered during system analysis.

external_chamber bool

When enabled, tells the client to ignore internal CTC telemetry in favor of manually injected external thermal data.

filament_tangle_detect bool

Master switch for the AMS tension-monitoring logic used to detect mechanical resistance in the filament path.

firmware_version str

The semantic version string of the main Application Processor (AP) firmware executing on the printer.

hostname str

The network address (IP or FQDN) used to establish the MQTT connection with the printer.

mqtt_client_id str

Unique identifier for the MQTT session, used to manage state persistence and message routing.

mqtt_port int

The TCP port utilized for the SSL-encrypted MQTT broker communication (typically 8883).

mqtt_username str

The authentication username required by the printer-hosted MQTT broker (Default: 'bblp').

printer_model PrinterModel

Read-only classification of the printer hardware (e.g. A1, H2D) derived from the serial number prefix.

serial_number str

Unique hardware identifier. Setting this value automatically triggers a re-evaluation of the printer model classification.

sound_enable bool

Configuration for the machine's internal hardware speaker for audible notifications and AI alerts.

startup_read_option bool

Configures whether the AMS unit performs a full RFID scan of all slots upon printer power-on.

tray_read_option bool

Toggles the automatic RFID identification sequence when a new filament spool is inserted or detected.

verbose bool

Controls the global log verbosity for the library. Setting this value shifts the logger level between DEBUG and WARNING.

watchdog_timeout int

The interval in seconds before the communication channel is flagged as inactive and a reconnection is attempted.

Source code in src/bpm/bambuconfig.py
Python
def __init__(
    self,
    hostname: str,
    access_code: str,
    serial_number: str,
    mqtt_port: int = 8883,
    mqtt_client_id: str = "studio_client_id:0c1f",
    mqtt_username: str = "bblp",
    watchdog_timeout: int = 30,
    external_chamber: bool = False,
    verbose: bool = False,
    capabilities: PrinterCapabilities | None = None,
):
    """
    Initializes the configuration profile for the Bambu Lab printer client.

    Parameters
    ----------
    * hostname : IP address or DNS name of the printer on the local subnet.
    * access_code : 8-character LAN-only access code for MQTT authentication.
    * serial_number : Unique hardware identifier used to derive the printer model.
    * mqtt_port : Network port for the SSL-encrypted MQTT broker (Default: 8883).
    * mqtt_client_id : Unique identifier used during the MQTT handshake protocol.
    * mqtt_username : Authentication username for the local MQTT broker (Default: 'bblp').
    * watchdog_timeout : Duration in seconds before a connection is flagged as stale.
    * external_chamber : If True, ignores internal CTC telemetry to allow manual sensor injection.
    * verbose : Controls log verbosity; True sets level to DEBUG, False to WARNING.
    * capabilities : Pre-defined or discovered hardware feature set.

    Attributes
    ----------
    * firmware_version : Semantic version string of the main printer firmware.
    * ams_firmware_version : Semantic version string of the primary AMS controller.
    * printer_model : Enum classification (e.g. A1, H2D) derived from the serial prefix.
    * auto_recovery : Firmware-level toggle for resuming prints after step-loss.
    * filament_tangle_detect : Master switch for AMS tension-based monitor logic.
    * sound_enable : Controls the machine's internal speaker for user notifications.
    * auto_switch_filament : Enables automatic AMS failover to redundant spools.
    * buildplate_marker_detector : Toggles ArUco scanning for build surface verification.
    * capabilities : Data structure containing all verified hardware features.
    """

    self._hostname = hostname
    self._access_code = access_code
    self.serial_number = serial_number if serial_number else ""
    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

    if capabilities is None:
        capabilities = PrinterCapabilities()
    self._capabilities = capabilities

access_code property writable

Python
access_code: str

The 8-character security credential required for LAN-mode authentication and MQTT encryption.

ams_firmware_version property writable

Python
ams_firmware_version: str

The semantic version string of the primary AMS controller firmware discovered on the hardware bus.

auto_recovery property writable

Python
auto_recovery: bool

Firmware-level toggle for the automatic resumption of print jobs after a detected X/Y axis step-loss event.

auto_switch_filament property writable

Python
auto_switch_filament: bool

Enables automatic failover to a compatible filament spool in the AMS when the current source runs out.

buildplate_marker_detector property writable

Python
buildplate_marker_detector: bool

Toggles the AI vision ArUco marker scanning system used to verify build surface compatibility.

calibrate_remain_flag property writable

Python
calibrate_remain_flag: bool

Enablement for the spool-weight based estimation of the remaining filament length in the AMS.

capabilities property writable

Python
capabilities: PrinterCapabilities

Data structure containing the verified set of hardware features discovered during system analysis.

external_chamber property writable

Python
external_chamber: bool

When enabled, tells the client to ignore internal CTC telemetry in favor of manually injected external thermal data.

filament_tangle_detect property writable

Python
filament_tangle_detect: bool

Master switch for the AMS tension-monitoring logic used to detect mechanical resistance in the filament path.

firmware_version property writable

Python
firmware_version: str

The semantic version string of the main Application Processor (AP) firmware executing on the printer.

hostname property writable

Python
hostname: str

The network address (IP or FQDN) used to establish the MQTT connection with the printer.

mqtt_client_id property writable

Python
mqtt_client_id: str

Unique identifier for the MQTT session, used to manage state persistence and message routing.

mqtt_port property writable

Python
mqtt_port: int

The TCP port utilized for the SSL-encrypted MQTT broker communication (typically 8883).

mqtt_username property writable

Python
mqtt_username: str

The authentication username required by the printer-hosted MQTT broker (Default: 'bblp').

printer_model property

Python
printer_model: PrinterModel

Read-only classification of the printer hardware (e.g. A1, H2D) derived from the serial number prefix.

serial_number property writable

Python
serial_number: str

Unique hardware identifier. Setting this value automatically triggers a re-evaluation of the printer model classification.

sound_enable property writable

Python
sound_enable: bool

Configuration for the machine's internal hardware speaker for audible notifications and AI alerts.

startup_read_option property writable

Python
startup_read_option: bool

Configures whether the AMS unit performs a full RFID scan of all slots upon printer power-on.

tray_read_option property writable

Python
tray_read_option: bool

Toggles the automatic RFID identification sequence when a new filament spool is inserted or detected.

verbose property writable

Python
verbose: bool

Controls the global log verbosity for the library. Setting this value shifts the logger level between DEBUG and WARNING.

watchdog_timeout property writable

Python
watchdog_timeout: int

The interval in seconds before the communication channel is flagged as inactive and a reconnection is attempted.

PrinterCapabilities dataclass

Python
PrinterCapabilities(
    has_ams: bool = False,
    has_lidar: bool = False,
    has_camera: bool = False,
    has_dual_extruder: bool = False,
    has_air_filtration: bool = False,
    has_chamber_temp: bool = False,
    has_chamber_door_sensor: bool = False,
)

Hardware capabilities discovered during the initial handshake or telemetry analysis.

Attributes:

Name Type Description
has_air_filtration bool

Indicates the motorized airduct and filtration subsystem is physically installed.

has_ams bool

Indicates an active AMS unit is detected on the hardware bus via the ams block.

has_camera bool

Verified availability of the onboard AI camera module.

has_chamber_door_sensor bool

Verification that the front glass enclosure is equipped with a hall-effect sensor.

has_chamber_temp bool

Confirmed presence of the Chamber Thermal Controller (CTC) ambient sensor.

has_dual_extruder bool

Identifies the H2D dual-path architecture where independent hotend monitoring is required.

has_lidar bool

Confirmed presence of the Micro LiDAR sensor based on xcam telemetry existence.

has_air_filtration class-attribute instance-attribute

Python
has_air_filtration: bool = False

Indicates the motorized airduct and filtration subsystem is physically installed.

has_ams class-attribute instance-attribute

Python
has_ams: bool = False

Indicates an active AMS unit is detected on the hardware bus via the ams block.

has_camera class-attribute instance-attribute

Python
has_camera: bool = False

Verified availability of the onboard AI camera module.

has_chamber_door_sensor class-attribute instance-attribute

Python
has_chamber_door_sensor: bool = False

Verification that the front glass enclosure is equipped with a hall-effect sensor.

has_chamber_temp class-attribute instance-attribute

Python
has_chamber_temp: bool = False

Confirmed presence of the Chamber Thermal Controller (CTC) ambient sensor.

has_dual_extruder class-attribute instance-attribute

Python
has_dual_extruder: bool = False

Identifies the H2D dual-path architecture where independent hotend monitoring is required.

has_lidar class-attribute instance-attribute

Python
has_lidar: bool = False

Confirmed presence of the Micro LiDAR sensor based on xcam telemetry existence.