[BETA TESTER NEEDED] "bambu-lab-observer" command line binary

Hello,

I’ve started a small program allowing to receive & decode Bambu Lab X1C events sent through MQTT (also working with latest firmwares / the ones with TLS activated).

For now, there is only one feature allowing to build a continuous list / summary of what is printed, openable under EXCEL (or anything else), in order to track what you have printed, when, and how many minutes / hours have been taken for each print. Extra features could be added in the future (i would like also to track the amount of filament being consumed, if possible).

I would be interested to have a few beta testers :

  • To validate that this program is working for other peoples than me
  • To see if you are encountering some MQTT events that i’ve not detected yet in my usage (these messages would be printed in logs as “unknown event”, if this is ever happening)
  • And of course to give me any feedback regarding that tooling, in case you would have some ideas for extra features to be implemented.

Example of the continuously generated CSV content :

(the CSV can be edited / altered anytime)

Binaries are there : https://github.com/SR-G/bambu-lab-observer/releases/download/1.0.0-SNAPSHOT/bambu-lab-observer-1.0.0-SNAPSHOT.zip

It is working on any platform (linux, windows, macos, and i386/amd64) (however only tested on my side on linux) :


(docker image is ready but not published yet)

Documentation is rather trivial, one just has to configure the JSON configuration file (for example to be hosted in the same folder than the binary - as the examples included in the .ZIP distribution) :

image

(“BambuLabsIP” field is mandatory - and this should work with several printers, and also is (for recent firmware) the “MQTTPassword” field - all other fields are optional (and are explained in the (draft) documentation here : GitHub - SR-G/bambu-lab-observer: Bambu Lab observer, receiving events from Bambu Lab printers and building a .CSV file listing all printed timings)

Example of logs at runtime :

2023-02-06 20:10:28    INFO  configuration.go:43 Will use configuration file provided through --config parameter, path is [../resources/configuration/bambu-lab-observer.json]
2023-02-06 20:10:28    INFO  configuration.go:65 Configuration file found under [../resources/configuration/bambu-lab-observer.json], now reading content
2023-02-06 20:10:28    INFO  bambu-lab-observer.go:100 Application [bambu-lab-observer], version [1.0.0-SNAPSHOT], built on [2023-02-06T13:55:44Z]
2023-02-06 20:10:28    INFO  bambu-lab-observer.go:101 Configured policy about detecting beginning of prints [FIRST_MESSAGE_TIMESTAMP]
2023-02-06 20:10:28    INFO  bambu-lab-observer.go:69 Starting events processor
2023-02-06 20:10:28    INFO  bambu-lab-observer.go:75 Starting MQTT receiver
2023-02-06 20:10:28    INFO  events_processor.go:205 Starting events processor
2023-02-06 20:10:28    INFO  events_processor.go:209 Dump of all events avativated - to be dumped inside folder [../resources/events/campaigns/2023-02-06/]
2023-02-06 20:10:28    INFO  mqtt_connector.go:61 Starting MQTTConnector on broker [tcp://192.168.8.130:1883], with clientId [bambu-lab-observer-192.168.8.130-XSxupcexAanpTPOJ]
2023-02-06 20:10:28    INFO  mqtt_connector.go:78 Trying to connect on [tcp://192.168.8.130:1883], retry interval [0] sec
2023-02-06 20:10:28    INFO  mqtt_connector.go:96 MQTTConnector connected to the broker [tcp://192.168.8.130:1883]
2023-02-06 20:10:28    INFO  mqtt_connector.go:104 About to (re-)subscribe to all configured subscription topics
2023-02-06 20:10:28    INFO  mqtt_connector.go:108 Now subscribing to topic [device/+/report]
2023-02-06 20:10:28 WARNING  events_processor.go:66 Discarded content #1 (IDLE) (and next events) : {Command:push_status GCodeStartTime:0 GCodeState:IDLE MCPercent:0 MCRemainingTime:0 MCPrintStage:1 PrintName: PrintErrorCode:0 SequenceID:2021}
2023-02-06 20:10:52 WARNING  events_processor.go:69 Discarded content #2 (PREPARE) : {Command:push_status GCodeStartTime:0 GCodeState:PREPARE MCPercent:0 MCRemainingTime:0 MCPrintStage:1 PrintName:sharpening-angle-gauge_plate_1 PrintErrorCode:0 SequenceID:2021}
2023-02-06 20:10:53    INFO  events_processor.go:233 Status [START DETECTED] (0%), model [sharpening-angle-gauge_plate_1] from printer [00M00A261900054] (print duration : 0 seconds)
2023-02-06 20:11:57    INFO  events_processor.go:241 Status [PRINT IN PROGRESS] (1%), model [sharpening-angle-gauge_plate_1] from printer [00M00A261900054] (print duration : 1 minute 4 seconds) (remaining : 30 minutes)
2023-02-06 20:13:36    INFO  events_processor.go:241 Status [PRINT IN PROGRESS] (16%), model [sharpening-angle-gauge_plate_1] from printer [00M00A261900054] (print duration : 2 minutes 43 seconds) (remaining : 25 minutes)
2023-02-06 20:14:16    INFO  events_processor.go:241 Status [PRINT IN PROGRESS] (17%), model [sharpening-angle-gauge_plate_1] from printer [00M00A261900054] (print duration : 3 minutes 23 seconds) (remaining : 25 minutes)
2023-02-06 20:18:13    INFO  events_processor.go:241 Status [PRINT IN PROGRESS] (18%), model [sharpening-angle-gauge_plate_1] from printer [00M00A261900054] (print duration : 7 minutes 20 seconds) (remaining : 25 minutes)
(...)
2023-02-06 21:57:54    INFO  events_processor.go:241 Status [PRINT IN PROGRESS] (98%), model [sharpening-angle-gauge_plate_2] from printer [00M00A261900054] (print duration : 48 minutes 32 seconds) (remaining : 0 seconds)
2023-02-06 21:58:23    INFO  events_processor.go:241 Status [PRINT IN PROGRESS] (99%), model [sharpening-angle-gauge_plate_2] from printer [00M00A261900054] (print duration : 49 minutes 1 second) (remaining : 0 seconds)
2023-02-06 21:59:14    INFO  events_processor.go:235 Status [END DETECTED] (100%), model [sharpening-angle-gauge_plate_2] from printer [00M00A261900054] (print duration : 49 minutes 52 seconds)
2023-02-06 21:59:14    INFO  events_processor.go:57 Removed entry for source IP [192.168.8.130], number of remaining entries [0]

For now it’s only a command line version (easy to be launched anywhere, like a NAS, or somewhere in a docker image, whatever).

It’s a first quick draft (in GOLANG) and works fine on my side - feel free to give me any feedbacks if you see some usage (or forecasted usage) for that kind of tooling.

6 Likes

Hello SR-G,
Thank you for making this available. I’m not much of a tech guy but it was pretty simple to get this up and running and start to keep track of prints. I just started using this morning but I have some initial feedback that hopefully is helpful to you.

We currently have 5 printers that we would like to keep track of, I seemed to have luck adding multiple IPs but I was unsure how to add the corresponding passwords for each. I may have been missing some syntax but just separating by a comma gave me an error.

Second, I sent a print but canceled before the printer had finished heating up. I saw a few lines pop up in the command line, but the CSV file didn’t update. Some time later I sent another print but its “start time” dated back to when I sent the first print. It also counted an error which I assume had to do with the canceled print.

Thanks again for making this available.

For the first point - indeed, my bad, i haven’t thought that the password would (of course) be different for each printer when i added TLS…

This is now corrected in latest binary (still under : https://github.com/SR-G/bambu-lab-observer/releases/download/1.0.0-SNAPSHOT/bambu-lab-observer-1.0.0-SNAPSHOT.zip)

Be careful that the configuration has changed, it should now be something like this (online doc also updated) :

(and for now it’s mandatory to put for newer firmwares “TLS” : true and “MQTTLogin” : “bblp” - no default values)

For the second topic, indeed, i have never cancelled any print, so i’m not surprised by this behavior (same object being printed = not detected as a new print), but i would have to try that situation to see what can be done / what are the exact messages generated by the printer at that time (as i never encountered them).

wow, as a data analyst trying to start my own 3d printing business this sounds cool! Once Im finished with my play with the new toy and start attempting to make money id love to join.

1 Like

I’d love to join as well. I’m going to set up a Raspberry Pi to do the capture, since I can ensure that’s on all the time.

1 Like

There is indeed some ARM (32bits) and ARM64 (64bits) that i hope should be working fine on a raspberry, but i had no chance to test anything on any kind of ARM platform like raspberry - feel free to report if this is working or not !

Check out this exporter that I made!

1 Like

I have got this running on Raspberry Pi. Terminal output is sort of working with errors and warnings, but no csv output, Although this could be my error

Which kind of errors have you encountered ?
Just FYI / just in case, the .CSV is generated only after one print is finished (nothing before at this time).
I’m still using this small tool all the time on my side (however on AMD64 and not ARM, but i would not expect any differences at running time and related to the hardware architecture).

Well that explains the csv file and after further investigation i thing my errors are cased by x1c requests to a p1p.

2023-08-04 12:28:21 WARNING events_processor.go:180 Discarded content #4 (SOME BLANK DATA) : {Command:push_status GCodeStartTime: GCodeState: MCPercent:0 MCRemainingTime:0 MCPrintStage:0 PrintName: PrintErrorCode: SequenceID:8736}
2023-08-04 12:28:21 ERROR events_processor.go:227 Error detected [] :
{“print”:{“nozzle_temper”:221.5,“wifi_signal”:“-29dBm”,“mc_print_line_number”:“155296”,“command”:“push_status”,“msg”:1,“sequence_id”:“8736”}}
2023-08-04 12:28:21 INFO events_processor.go:233 Status [START DETECTED] (89%), model [] from printer [01S00C350500371] (print duration : 0 seconds)

Yeah in the code, at this time (mainly to help me debugging what is happening), the tool is :

  • receiving all events sent by the printer (through MQTT)
  • taking in account all the needed ones (the ones about START, STOP, real printing errors, … of prints => in order to have the data to fulfil the .CSV)
  • silently ignoring all the “known events” (useless for that tools)
  • displaying “as errors” the events that are unknown by this tool (in case of new events, …)
  • in some very specific situations (and i think this is what your log is about) rejecting some events that are “wrong” at printer side - this is especially happening when launching a second print after a first one (or after a print that has been cancelled, …), as the printer is at that time sending some messages that are sometimes inconsistent (with still some values from previous print)

Wait - are you using latest firmware, by any chance ?
I juste launched a peint tonight, and something has changed since last firmware, i think (i also have many errors now). Have to check.

Is this tool closed source?

1 Like

Consider drawing differentiators between your project and https://mqtt-explorer.com/
I think MQTT explorer aligns more closely to data “discovery”

No, it’s just that the code is not pushed yet in github (until a bit more stabiliser) - but it will be fully open-source.

So definitely what you have encountered is coming from the changes inside the latest firmware 1.06.00 (until yesterday, i hadn’t upgraded yet on my side so hadn’t detected the issue).

I have created a new version 1.0.1-SNAPSHOT of the tool that is now working with recent firmware.

2023-08-05 14:06:25    INFO  configuration.go:63 Will use configuration file provided through --config parameter, path is [../resources/configuration/bambu-lab-observer.json]
2023-08-05 14:06:25    INFO  configuration.go:85 Configuration file found under [../resources/configuration/bambu-lab-observer.json], now reading content
2023-08-05 14:06:25    INFO  bambu-lab-observer.go:100 Application [bambu-lab-observer], version [1.0.0-SNAPSHOT], built on [2023-08-04T21:44:15Z]
2023-08-05 14:06:25    INFO  bambu-lab-observer.go:101 Configured policy about detecting beginning of prints [FIRST_MESSAGE_TIMESTAMP]
2023-08-05 14:06:25    INFO  bambu-lab-observer.go:69 Starting events processor
2023-08-05 14:06:25    INFO  bambu-lab-observer.go:75 Starting MQTT receiver
2023-08-05 14:06:25    INFO  mqtt_connector.go:64 Starting MQTTConnector on broker [tls://192.168.8.130:8883], with clientId [bambu-lab-observer-192.168.8.130-LPCcKkjJSzlxNcpz], username [bblp], password [********] (with TLS)
2023-08-05 14:06:25    INFO  mqtt_receiver.go:111 Printer [192.168.8.131] is disabled, skipping it
2023-08-05 14:06:25    INFO  mqtt_receiver.go:111 Printer [192.168.8.132] is disabled, skipping it
2023-08-05 14:06:25    INFO  mqtt_connector.go:84 Trying to connect on [tls://192.168.8.130:8883], retry interval [0] sec
2023-08-05 14:06:25    INFO  events_processor.go:312 Starting events processor
2023-08-05 14:06:25    INFO  events_processor.go:316 Dump of all events acvtivated - to be dumped inside folder [../resources/events/campaigns/2023-08-05/]
2023-08-05 14:06:25    INFO  mqtt_connector.go:102 MQTTConnector connected to the broker [tls://192.168.8.130:8883]
2023-08-05 14:06:25    INFO  mqtt_connector.go:110 About to (re-)subscribe to all configured subscription topics
2023-08-05 14:06:25    INFO  mqtt_connector.go:114 Now subscribing to topic [device/+/report]
2023-08-05 14:08:05    INFO  events_processor.go:352 Status [START DETECTED] (0%), model [gridfinity-pocket-knife-holder_plate_2] from printer [00M00A261900054] (print duration : 0 seconds)
2023-08-05 14:10:25    INFO  events_processor.go:360 Status [PRINT IN PROGRESS] (5%), model [gridfinity-pocket-knife-holder_plate_2] from printer [00M00A261900054] (print duration : 2 minutes 20 seconds) (remaining : 1 hour 18 minutes)
2023-08-05 14:10:49    INFO  events_processor.go:360 Status [PRINT IN PROGRESS] (6%), model [gridfinity-pocket-knife-holder_plate_2] from printer [00M00A261900054] (print duration : 2 minutes 44 seconds) (remaining : 1 hour 17 minutes)
2023-08-05 14:16:26    INFO  events_processor.go:360 Status [PRINT IN PROGRESS] (8%), model [gridfinity-pocket-knife-holder_plate_2] from printer [00M00A261900054] (print duration : 8 minutes 21 seconds) (remaining : 1 hour 16 minutes)
2023-08-05 14:16:43    INFO  events_processor.go:360 Status [PRINT IN PROGRESS] (9%), model [gridfinity-pocket-knife-holder_plate_2] from printer [00M00A261900054] (print duration : 8 minutes 38 seconds) (remaining : 1 hour 15 minutes)
2023-08-05 14:17:32    INFO  events_processor.go:360 Status [PRINT IN PROGRESS] (10%), model [gridfinity-pocket-knife-holder_plate_2] from printer [00M00A261900054] (print duration : 9 minutes 27 seconds) (remaining : 1 hour 14 minutes)
2023-08-05 14:18:23    INFO  events_processor.go:360 Status [PRINT IN PROGRESS] (11%), model [gridfinity-pocket-knife-holder_plate_2] from printer [00M00A261900054] (print duration : 10 minutes 18 seconds) (remaining : 1 hour 13 minutes)

Still downloadable from GITHUB (you need to be logged in GITHUB to see pre-releases) :

Hello,
thanks for your tool. I’ve just intalled it now, and, here are unknown messages.

{
    "print": {
        "ams_id": 0,
        "command": "ams_filament_setting",
        "nozzle_temp_max": 280,
        "nozzle_temp_min": 240,
        "result": "success",
        "sequence_id": "20055",
        "setting_id": "GFSB99",
        "tray_color": "FFFFFFFF",
        "tray_id": 1,
        "tray_info_idx": "GFB99",
        "tray_type": "ABS"
    }
}


{
    "print": {
        "cali_idx": -1,
        "command": "extrusion_cali_sel",
        "filament_id": "GFB99",
        "nozzle_diameter": "0.4",
        "result": "success",
        "sequence_id": "20056",
        "tray_id": 1
    }
}


{
    "print": {
        "command": "ams_control",
        "param": "resume",
        "reason": "SUCCESS",
        "result": "SUCCESS",
        "sequence_id": "7"
    }
}

{
    "print": {
        "command": "clean_print_error",
        "print_error": 0,
        "reason": "SUCCESS",
        "result": "SUCCESS",
        "sequence_id": "20085",
        "subtask_id": "38149048"
    }
}

Christophe

1 Like

Thanks Christophe, i’ll add them.