{"id":41492428,"url":"https://github.com/drudge/bambulabs_api","last_synced_at":"2026-01-23T18:25:44.223Z","repository":{"id":330641840,"uuid":"1123426588","full_name":"drudge/bambulabs_api","owner":"drudge","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-03T21:50:13.000Z","size":318,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-07T05:51:39.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drudge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"torbenconto","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":"gh/torbenconto","custom":null}},"created_at":"2025-12-26T21:09:44.000Z","updated_at":"2026-01-03T21:50:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/drudge/bambulabs_api","commit_stats":null,"previous_names":["drudge/bambulabs_api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/drudge/bambulabs_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drudge%2Fbambulabs_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drudge%2Fbambulabs_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drudge%2Fbambulabs_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drudge%2Fbambulabs_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drudge","download_url":"https://codeload.github.com/drudge/bambulabs_api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drudge%2Fbambulabs_api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28697428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-23T18:25:43.478Z","updated_at":"2026-01-23T18:25:44.216Z","avatar_url":"https://github.com/drudge.png","language":"Go","funding_links":["https://github.com/sponsors/torbenconto","https://thanks.dev/gh/torbenconto"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"./assets/Logo-boxed.svg\" alt=\"Logo\"\u003e\n\n\u003ch1\u003eBambulabs API Golang Library\u003c/h1\u003e\n\u003c/div\u003e\n\n\u003e [!IMPORTANT]\n\u003e This library is still in development. Consider [starring the repository](https://docs.github.com/en/get-started/exploring-projects-on-github/saving-repositories-with-stars) to show your support.\n\nThis repository provides a **Golang** library to interface with **Bambulabs 3D printers** via network protocols. It allows easy integration of Bambulabs printers into your Go applications, providing access to printer data, control over printer features, and more.\n\nThis project does not support the bambulabs cloud api, but it's sister project [bambulabs_cloud_api](https://github.com/torbenconto/bambulabs_cloud_api) does.\n\u003cdiv align=\"center\"\u003e\n\n[![Star History Chart](https://api.star-history.com/svg?repos=torbenconto/bambulabs_api,torbenconto/bambulabs_cloud_api\u0026type=Date)](https://star-history.com/#torbenconto/bambulabs_api\u0026torbenconto/bambulabs_cloud_api\u0026Date)\n\u003c/div\u003e\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Connecting to a Printer](#connecting-to-a-printer)\n- [Managing Multiple Printers](#managing-multiple-printers)\n- [Camera Access](#camera-access)\n- [Basic Examples](#basic-examples)\n- [Development](#development)\n- [Contributing](#contributing)\n- [Links \u0026 Resources](#links--resources)\n- [License](#license)\n\n\n## Installation\n\nTo install the Bambulabs API Golang library, use the `go get` command:\n\n```bash\ngo get -u github.com/torbenconto/bambulabs_api\n```\n\n\n## Connecting to a Printer\n\nTo interact with a Bambulabs printer, you need the following details:\n\n- **IP Address**: The local IP address of the printer.\n- **Serial Number**: The unique serial number of the printer.\n- **Access Code**: A local access code for authentication.\n\nYou can find the **IP Address** and **Access Code** in the printer’s network settings. Please refer to the guides below for more detailed instructions:\n\n- [Find your printer's IP Address](https://intercom.help/octoeverywhere/en/articles/9034934-find-your-bambu-lab-printer-ip-address)\n- [Find your printer's Access Code](https://intercom.help/octoeverywhere/en/articles/9028357-find-your-bambu-lab-printer-access-code)\n- [Find your printer's Serial Number](https://wiki.bambulab.com/en/general/find-sn)\n\nOnce you have the necessary details, you can create and connect to the printer with the following code:\n\n```go\n// Replace the values below with the ones for your printer\nconfig := \u0026bambulabs_api.PrinterConfig{\n    Host:           \"192.168.1.200\",\n    AccessCode:   ACCESS_CODE,\n    SerialNumber: SERIAL_NUMBER,\n}\nprinter := bambulabs_api.NewPrinter(config)\nerr := printer.Connect()\nif err != nil {\n    panic(err)\n}\n```\n\nThe `Connect()` method establishes a connection through MQTT alongside opening an FTP connection to the printer. This allows you to interact with the printer and retrieve data.\nFor camera connections, see the [Camera Access](#camera-access) section.\n\n## Managing Multiple Printers\nThe PrinterPool is a concurrent, thread-safe structure designed to manage multiple printers in a pool. It allows you to interact with the printers by serial number, retrieve their status or data, and perform operations on them, all while handling multiple printers concurrently.\nTo begin using the PrinterPool, first create an instance of it:\n```go\npool := bambulabs_api.NewPrinterPool()\n```\nNext, add printers to the pool using the AddPrinter method and passing in a config:\n```go\nconfigs := []*PrinterConfig{\n    {Host: \"192.168.1.200\", SerialNumber: \"M123ALE29D\", AccessCode: \"ODJ2j3\"},\n    {Host: \"192.168.1.201\", SerialNumber: \"M123ALE29E\", AccessCode: \"LDAdj3\"},\n}\n\nfor _, config := range configs {\n    pool.AddPrinter(config)\n}\n```\n\nNext, connect to the printers using the built-in ConnectAll method:\n```go\nerr := pool.ConnectAll()\nif err != nil {\n    panic(err)\n}\n```\n\nOnce connected, you can interact with the printers in the pool using the various methods provided by the PrinterPool struct. For example, you can toggle the light on all printers in the pool:\n```go\nerr := pool.ExecuteAll(func(printer *Printer) error {\n\treturn printer.LightOn(light.ChamberLight)\n})\n\nif err != nil {\n    panic(err)\n}\n```\n\nYou can also retrieve the data of all printers in the pool:\n```go\ndata, err := pool.DataAll()\nif err != nil {\n    panic(err)\n}\n\nfor _, printerData := range data {\n    fmt.Println(printerData)\n}\n```\n\nFor operations on one printer in a pool, you can retrieve a printer by serial number using the At method:\n```go\nprinter, err := pool.At(\"M123ALE29D\")\nif err != nil {\n    panic(err)\n}\n```\n\nFinally, you can disconnect from all printers in the pool using the DisconnectAll method:\n```go\nerr := pool.DisconnectAll()\nif err != nil {\n    panic(err)\n}\n```\n\n\n## Camera Access\nThe library also provides access to the camera of a printer. Right now it only supports the Bambu Labs P and A series printers.\n\nWe have plans to add support for the X series printers in the near future through rtsps. The camera access is currently in development and may not be fully functional for all printer models.\n\nYou must connect to the camera using the ConnectCamera method. This will establish a connection to the camera and allow you to access its features.\n\n```go\nerr := printer.ConnectCamera()\nif err != nil {\n    panic(err)\n}\n```\n\nOnce connected, you can use the Camera struct to access the camera features. The Camera struct provides methods for taking snapshots, recording videos, and accessing the camera stream.\n\nYou can take a snapshot using the Capture method. This will capture a single frame from the camera and return it as a byte array.\n\n```go\nsnapshot, err := printer.CaptureCameraFrame()\nif err != nil {\n    panic(err)\n}\n```\n\nYou can also record a video using the StartCameraStream method. This will start recording a video from the camera and return a byte array containing the video data.\n\n```go\nvideo, err := printer.StartCameraStream()\nif err != nil {\n    panic(err)\n}\n```\n\nYou can stop the camera stream using the StopCameraStream method. This will stop the recording and return the video data as a byte array.\n\n```go\nerr := printer.StopCameraStream()\nif err != nil {\n    panic(err)\n}\n```\n\n\n## Basic Examples\n\nHere is a basic example of how to create a connection to a printer and interact with it. This example toggles the printer's light and retrieves some printer data:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/torbenconto/bambulabs_api\"\n\t\"github.com/torbenconto/bambulabs_api/light\"\n\t\"time\"\n\t\"net\"\n)\n\nfunc main() {\n\tconfig := \u0026bambulabs_api.PrinterConfig{\n\t\tHost:           \"192.168.1.200\",\n\t\tAccessCode:   \"00293KD0\",\n\t\tSerialNumber: \"AC1029391BH109\",\n\t}\n\n\t// Create printer object\n\tprinter := bambulabs_api.NewPrinter(config)\n\n\t// Connect to printer via MQTT\n\terr := printer.Connect()\n\tif err != nil {\n\t\tpanic(err)\n    }\n\n\t// Attempt to toggle light\n\terr = printer.LightOn(light.ChamberLight)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t\n\tfor {\n\t\ttime.Sleep(1 * time.Second)\n\n        data, err := printer.Data()\n\t\tif err != nil {\n\t\t\tpanic(err)\n        }\n\t\tif !data.IsEmpty() {\n\t\t\tfmt.Println(data)\n        }\n    }\n}\n```\n\nThis example establishes a printer pool with two printers, connects to them, toggles the light on both printers, and retrieves their data:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/torbenconto/bambulabs_api\"\n    \"github.com/torbenconto/bambulabs_api/light\"\n    \"net\"\n    \"time\"\n)\n\nfunc main() {\n    pool := bambulabs_api.NewPrinterPool()\n\n    configs := []*bambulabs_api.PrinterConfig{\n        {Host: \"192.168.1.200\", SerialNumber: \"M123ALE29D\", AccessCode: \"ODJ2j3\"},\n        {Host: \"192.168.1.201\", SerialNumber: \"M123ALE29E\", AccessCode: \"LDAdj3\"},\n    }\n\n    for _, config := range configs {\n        pool.AddPrinter(config)\n    }\n\n    err := pool.ConnectAll()\n    if err != nil {\n        panic(err)\n    }\n\n    err = pool.ExecuteAll(func(printer *bambulabs_api.Printer) error {\n\t\treturn printer.LightOn(light.ChamberLight)\n\t})\n\n    if err != nil {\n        panic(err)\n    }\n\n    for {\n        time.Sleep(1 * time.Second)\n\n        data, err := pool.DataAll()\n        if err != nil {\n            panic(err)\n        }\n\n        for _, printerData := range data {\n            fmt.Println(printerData)\n        }\n    }\n}\n```\n\n## Development\n\n### Current Status: FULL FUNCTIONALITY\nThe library is currently in a stable state with full functionality. All major features have been implemented and tested across various Bambulabs printer models. However, there may still be some edge cases or specific features that require further testing and validation. Contributions are welcome to improve functionality and expand coverage.\n\n## Cool projects using this library\n- [Bambu Lightshow](https://github.com/TrippHopkins/Bambu-Light-Show)\n\n## Contributing\n\nWe welcome contributions to improve this project! If you’d like to contribute, please follow these steps:\n\n1. Fork the repository\n2. Clone your fork\n3. Create a new branch for your feature or bug fix\n4. Write tests if applicable\n5. Submit a pull request with a detailed description of your changes\n\nPlease refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for more details on how to contribute.\n\n\n## Links \u0026 Resources\n\n- [Bambulab Official Website](https://www.bambulab.com)\n- [Bambulab Wiki](https://wiki.bambulab.com)\n- [Bambulab Support](https://support.bambulab.com)\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\nFeel free to join the community and connect with us for help, suggestions, or collaborations:  \n[Join the Discord!](https://discord.gg/7wmQ6kGBef)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrudge%2Fbambulabs_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrudge%2Fbambulabs_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrudge%2Fbambulabs_api/lists"}