
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
bambu-node
Advanced tools
A node.js library for connecting to and receiving data from Bambu Lab printers through their MQTT servers.
[!CAUTION]
🚧 This library is still in the making. PRs and other feature requests are welcome.
A node.js library for connecting to and receiving data from Bambu Lab printers through their MQTT servers.
client#executeCommand
waits until the command completion is
verified by the printer.Make sure you have the following installed:
[!CAUTION]
TypeScript is highly recommended for this package due to the type safety it provides. This is especially important in use cases like this project where the library communicates with external hardware which can very well come with property damage. And even with TypeScript, I am not liable for any such damages as stated in the license.
npm install bambu-node
import { BambuClient, Fan, UpdateFanCommand } from "bambu-node"
// define a printer connection
const client = new BambuClient({
host: "your_printers_ip",
accessToken: "your_printers_access_token",
serialNumber: "your_printers_sn",
})
// more about the available events below
client.on("message", (topic, key, data) => {
console.log(`New ${key} message!`, data)
})
client.on("printer:statusUpdate", (oldStatus, newStatus) => {
console.log(`The printer's status has changed from ${oldStatus} to ${newStatus}!`)
})
// connect to the printer
await client.connect()
// update the speed of the auxiliary fan to 100%
await client.executeCommand(new UpdateFanCommand({ fan: Fan.AUXILIARY_FAN, speed: 100 }))
// we don't want to do anything else => we close the connection
// (can be kept open indefinitely if needed)
await client.disconnect()
Unnamed things inside classes: Other classes that extend that class.
Every method, command and response is documented in JSDoc, so only events & utility classes are documented here.
BambuClient
BambuClient.connect()
BambuClient.disconnect()
BambuClient.subscribe(topic)
BambuClient.executeCommand(command)
message
rawMessage
client:connect
client:disconnect
printer:dataUpdate
printer:statusUpdate
job:update
job:start
job:pause
job:offlineRecovery
job:unpause
job:finish
Job
Job.update(data)
Job.data
AbstractCommand
GCodeCommand
GCodeFileCommand
GCodeLineCommand
GetVersionCommand
PushAllCommand
UpdateFanCommand
UpdateLightCommand
UpdateSpeedCommand
UpdateStateCommand
UpdateTempCommand
InfoMessageCommand
GetVersionResponse
McPrintMessageCommand
PushInfoResponse
PrintMessageCommand
GCodeFileResponse
GCodeLineResponse
ProjectFileResponse
PushAllResponse
PushStatusResponse
UpdateFanResponse
UpdateLightResponse
UpdateSpeedResponse
UpdateStateResponse
UpdateTempResponse
Responsible for managing the connection and messages to/from the printer.
rawMessage
Triggered whenever a new message is received from the MQTT broker.
message
Triggered whenever a new known message is received from the MQTT broker. It's already parsed and sent using its type.
client:connect
Triggered whenever the client connects to the printer. This will also trigger on a reconnect.
client:disconnect
Triggered whenever the client disconnects from the printer. This can be on purpose using
the client#disconnect
method or when the printer itself goes offline.
client:error
Triggered whenever the internal MQTT client encounters an error.
Examples include:
printer:dataUpdate
Triggered whenever new data is received from the printer and is merged into the data class field.
printer:statusUpdate
Triggered whenever the printer's status changes to a new status.
job:update
Triggered whenever the current Job's data gets updated.
job:start
Triggered whenever a new printing job starts.
job:pause
Triggered whenever the current print job is paused.
job:offlineRecovery
Triggered whenever the current print job was recovered after the printer came back online from an offline state.
job:unpause
Triggered whenever the current print job is resumed.
job:finish
Triggered whenever the current print job finishes.
Possible reasons:
SUCCESS
: Triggered whenever the current print job finishes without errors.FAILED
: Triggered whenever the current print job finishes without errors.UNEXPECTED
: Triggered whenever the current print job finishes unexpectedly. This is
only included as a proof of concept and is 99% bound to never happen.Responsible for managing the data about the current print job. It collects historical
data, error codes, etc. It is included in every event starting with job:
.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
FAQs
A node.js library for connecting to and receiving data from Bambu Lab printers through their MQTT servers.
The npm package bambu-node receives a total of 422 weekly downloads. As such, bambu-node popularity was classified as not popular.
We found that bambu-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.