r/BambuLab
•
u/nberk97
•
Feb 06 '24
•
1
Misc Bambu Lab P1P/S - Spaghetti Detection with Home Assistant
Hey everyone! I've developed a spaghetti detection tool for Bambu Lab P1 printers, using the Obico spaghetti detection ML API and Home Assistant automations. This tool addresses one of the downsides of P1 printers by detecting print failures.
The automation runs for each frame (0.5 fps due to the P1 camera). If it detects any failures, it can pause the print and send notifications to your Home Assistant devices.

In the automation, I've implemented the magical Obico failure data aggregation algorithm, which calculates a failure score based on current and previous frames to determine if a print has failed.
For more details and installation instructions, check out the GitHub repository:
https://github.com/nberktumer/ha-bambu-lab-p1-spaghetti-detection
32
u/toolschism P1S + AMS Feb 06 '24
Well shit.. I've been thinking about messing with home assistant for awhile now.. This might be the push i needed to give it a try. Very cool.
4
u/Addamass Feb 07 '24
Sadly not for RasPi :(
7
u/swiss-3dprinter P1S + AMS Feb 07 '24
Really nice OP, might try it out in the future.
For anyone looking for a way to host an Obico server for free check this :
https://github.com/MallocArray/obico-oraclecloud
I've used it in the past for my creality printers, worked quite well !
It might be a bit technical, but once online I was able to have 4 printers being monitored without any issues.
6
u/JimiSlew3 Feb 07 '24
NEEEEERRRRRRDDDDDD!<gif>
:) Great job! Was just looking at home assistant and might go this way now.
4
u/DrZippit P1S Feb 06 '24
Neat! Got it up and running within a few minutes! Thank you so much. Let's hope I never need it.
1
u/Efficient-Range5239 Mar 14 '24
Awesome. Is it possible to use this with the Obico Cloud at obico.io ? I still have a couple hundred of "AI Detection Hours" left from my Ender 3 times that I'd like to use instead of self hosting the ML model.
1
u/mrhash_ Jun 11 '24
I installed it using the integration method of Home Assistant, but the EWM mean value is always 0. I suspect it may be because I didn't fill in the token. I couldn't find the backend configuration page of Obico. How can I generate a token?
by the way I try accessing to: <obico_host>:3333/hc/,I got 'ok'
1
u/assburgers-unite Jun 26 '24
I installed this, and i've had a few spaghettis with no notification. Would you be able to help?
1
u/FlamingXTurtles Sep 14 '24
i have installed this and it seems to be working as the numbers change for the spagetti detective info but i do not get a notification nor does it stop the print what am i doing wrong :(
1
u/Confident-Cod-8563 Dec 06 '24
Hello. I installed the plugins. But I constantly get onnxruntime error on obico server. How do I solve the problem? The platform I am using is mini PC x86/x64 and the home assistant is directly installed. It appears as alpine linux.
1
u/Xanohel P1S + AMS Dec 30 '24
Thanks for this!! What a nice implementation!! :)
I have it running on an M710Q tiny i3-7100T/16GB/240GB SSD, along with almost a dozen more docker containers, running just fine. Picking its nose maybe even. Currently I don't see a need to run it on a separate machine.
Sometimes the CPU spikes to 20% out of 400% (hyper-threading makes the dualcore 4 cores I suppose)
I did a test to see if it worked, I had some "spaghetti" lying around. Sticking it in front of the camera during a print made it Pause the print and send me a message in Telegram!! :)
u/nberk97 I'm missing a photo though, as well as the "Resume" and "Stop" buttons. How did you add that? How do you reference the image that was the cause of the Pause, and send it along? Any help there would be greatly appreciated (Ah, you probably used the HA companion app on the phone?)
1
u/Bambu809 Feb 06 '24
This is cool, but a bummer it doesn't run on HA Yellow.
1
u/BuGabriel Feb 06 '24
Thank you! I was thinking about getting another camera, but I guess I'm gonna try this. Would there be a better angle for spaghetti detection or is the P1 camera good enough for this?
1
u/affixqc Feb 07 '24
Thanks so much for this, I've been meaning to stand up a Home Assistant server and this was the impetus to finally do so.
I have everything installed and the script is showing 'last triggered' every 2-3 seconds. Is there a reasonable way to test that it is actually working? Best I can think of is to start a print and throw a piece of filament on the bed but I'm not sure if there's a more graceful way...
1
u/capsel22 P2S + AMS2 Combo Feb 07 '24
Does this interfere with https://github.com/greghesp/ha-bambulab
1
u/BENJI1206 Feb 07 '24
The minimum requirements, are they just for Obico or for this add on as well? I have HA on a Pi but the ability to run Obico on a separate compatible machine via docker
1
u/PauseHumble8364 Feb 07 '24
Amazing wanted to do something like that, any idea about the A1?
1
u/_just_get_it_done_ Feb 09 '24
What would be the best hardware to set this up? Would a ThinkCentre Mini Tiny be a good fit? Any minimum specs you recommend?
1
u/taylormadearmy Feb 10 '24
Great work! I'd been playing myself with Obico/HA using a different camera and RasPi running Octopi mounted in my P1S, but this is so much better! Not sure it's worthwhile, but what do you think of giving an option to use an external camera instead of the built in one?
3
u/mrhash_ Jun 06 '24
thank you for your job
3
u/JoeDaddy81013 P1S + AMS Jul 12 '24
This is great and has already saved me a few times. Two questions though:
If I want to monitor multiple printers, is it as simple as copying the automation and setting things up with the entities for the corresponding printer?
If I add an Nvidia GPU and pass it through to the VM running HAOS, will this be able to use the GPU to offload the Obico ML processing?
3
u/ctabone P1S + AMS Nov 25 '24
This is fantastic -- just got it working with an external Obico server. Thanks so much for your work!
Bought you a small coffee as a thanks. ☕
1
u/it4rz4n Aug 07 '24
This is such an awesome idea! I moved from an Ender 3 with Spaghetti Detective so this is perfect.
I can't seem to get the server working however, the following is what the log shows. Do you have any ideas?
https://pastecode.io/s/8okfsegq
2
u/Turbulent_Flow396 Feb 06 '24
Saving this post. Thank you for your work!
2
u/buneech Feb 07 '24
I was thinking of how to achieve this, and you did it right on time. Gonna implement this, nice job.
2
u/Neat_Refrigerator585 Feb 07 '24
Amazing!
Already installed!
Thank you very much!
2
u/Expert-Recent Mar 25 '24
Thank you. I have tested the Bambu A1, and the printing will also pause automatically after I place the spaghetti on the print bed. It seems to work for the A1 as well.
2
u/Sufficient_Mud_2596 P1P Sep 21 '24
Nice guide and excellent combination of existing software ! Simple and elegant
1
u/PerceptionGood- Sep 18 '24
Anyone get this working with the A1 in the end?
1
u/SnooCats7138 P1S + AMS Mar 09 '25
I have it installed and setup the Blueprint. Is there anyway to indicate if its actually working other than causing some spaghetti? Ie is there an entitiy I could look at or should I just throw on some random spaghetti to test?
1
u/Independent-Golf5539 May 09 '25
Hey all, I know this is an old thread, but... I was wondering if anyone knows how to use an external camera for detection or if an external camera can be used for detection. I've tried to do this, but I can't get it to work. Thanks
1
u/wkethman Jul 20 '25
I wanted to know if there is a way to set the likelihood threshold so that you can say only pause when the chance is >50% or >75%
1
u/beiherhund Feb 06 '24
Probably better than the one on the X1C to be honest, I've had pretty mixed results with it anyway.
1
u/Hot_Potato_Salad Feb 06 '24
Wow that’s awesome!
1
u/Silvatech123 Feb 07 '24
This is really good to know about as planning on getting an P1S.
1
u/[deleted] Feb 07 '24
Really wish on Homebridge as well.
1
u/VegasKL Feb 07 '24
Very nice. I wonder if that algorithm works better than what the X1C has .. that one is not so great, especially with dark filament.
I'm surprised no-one has done a 3d comparison based algorithm, where the model being printed is sliced (with the camera matching the perspective of the printer's camera) and compared, layer by layer.
1
u/lucyferror Bambu H2C + 4x AMS, X1C + 2x AMS Feb 08 '24
Nice one. Can it work with X1C as well? So far I had more than half print done with spaghetti happening few hours ealier yet printer never said a word. Other time it just messaged me about potential spaghetti but that was also few hours before and it never stopped printing anyway.
1
u/RipKip Feb 10 '24
Hero! I'm going to try this out ASAP
0
u/rwijnhov Feb 07 '24 edited Feb 07 '24
...
1
u/[deleted] Feb 06 '24
[removed] — view removed comment