Bambu Lab X1 X1C MQTT

@WolfwithSword Im updating paths in: GetPreviewImage, Check for existing image, Write Image, Write XML, Fetch 3MF File (Py). I tried adding the inject node and it named it timestamp? Clicked on the button and got a success message but it didnt seem to do anything, i also tried copying the inject node from the bottom section and got the same thing. I also noticed the “store” error on the side again.

Yeah by default it injects a timestamp that doesn’t matter, it will just trigger the flow to run.

Not sure why it wouldn’t be doing anything the… You deployed before clicking right? Do you have all the palette dependencies (like the python one?)

If you copy “List 3MF Files (Py)” completely out of the group, put an inject leading only into it, then add a debug node coming out of the copied List function (open it, select “whole msg” instead of payload object), what comes out of it?

@WolfwithSword Maybe im looking in the wrong area but nothing appears to be happening when i click the button.

I have deployed and
I have all of the listed palettes installed and verified their version numbers are what you suggested.

Also, once or maybe twice when i clicked it i threw a 502 error and node-red was dead. Looking in the logs i saw this:

22 Feb 16:35:24 - [warn] Unknown context store 'true' specified. Using default store.
connection released
connection released
22 Feb 16:37:54 - [red] Uncaught Exception:
22 Feb 16:37:54 - [error] Error: spawn python3 ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
[16:37:55] INFO: Service Node-RED exited with code 1 (by signal 0)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service nginx: stopping
[16:37:55] INFO: Service NGINX exited with code 0 (by signal 0)

Hmm, seems like it had an error spawning the python script.

Open one of the python functions and check the settings

image

I wonder if the Addon for NodeRed has python in a different path or something… I don’t know if you’re able to go to the terminal/console of NodeRed or not but that would help verify a lot of things.

So I’m working on a way to extend the NodeRed HA stuff to detect the filament type that’s currently in use.

If you have an AMS and it’s using one of its trays it’s simple. But if using an external spool on the X1(C), well, it doesn’t have the vt_tray attribute like the P1P has so nothing gets configured for it. So my only approach is to use the FTPS method to fetch the 3mf file, extract the xml and read the filament types from the list and choose majority.

For P1P, I know it has vt_tray but I do not know if this gets filled in the MQTT data with colour and tray_type attributes when configured via bambu studio. If anyone can confirm that would be great, or if anyone has ideas for detecting filament type in use. I am planning to make it easy to automate controlling a bento-box based on filament type being used.

@WolfwithSword took me a minute but i figured out how to get into the nodered container, is there something you want me to look at for the potential python issue from yesterday?

Yep, try to find the python path if you can - it’s the only thing I can think of that can cause that issue, if the path is different than the one defined in the screenshot I attached.

So this is interesting, i have the palettes you said to install installed. When i run a python3 --version in the container though it says python not found. Also not seeing anything python related under /usr/bin or /usr/local/bin

Found this addon-node-red/DOCS.md at 16f2930c32e7faeb1493b6677597e9ecc0d3f743 · hassio-addons/addon-node-red · GitHub

Should add python (or python3) to the system_packages per this doc and it should be available then maybe?

@WolfwithSword ok, adding python3 to the system_packages resolved that. One other issue now is that the grafana dashboard is calculating costs incorrectly. My energy rate from HASS is pulling correctly but its doing some sort of math in grafana incorrectly. My energy rate is .075 kWh yet its saying that a print consuming 46 wH = $.0000345 whereas is should be .00345. Looks like some of the math all around on this is off by a couple decimal places for me.

In the descriptions of stuff I have it saying to put in your energy rate as cents per kwh. For example, my energy rate is 11.61, which is cents per kwh. Multiplied by the kwh of a print (ex, 0.083 kwh, which is 83wh) gets me the correct number ($0.0096363). The calc essentially becomes (energy_rate * kwh) / 100)

I’m assuming you have your energy rate in dollars, which is $0.075 per kwh? Change it to cents per kwh, so 7.5, then that should make the numbers correct.

Also thanks for confirming the system package workaround, I’ll add that to the guide later!

Also FYI - the calc is happening in a generated column in the DB as well, hence the importance of the sensor being in cents per kwh. If you have other stuff relying on it being in dollars per kwh, I’d recommend making a template sensor in HA that just multiplies that sensor by 100 and using it instead.

Hello,

Bambulab P1P received today.

i have tried to import the node red workflow, and is ok, but I Can´t be able to connect printer and Home assistant, It´s always connecting status but nothing happen.

I have configured S/N, user mqtt and user BBLP with lan Code,

Please, maybe i´m missing something

My P1P its not working. No connection

Any incompatibility?

P1P MQTT stuff is still using the old system where it has no auth and uses port 1883 instead of 8883. The node-red flow is experimental with the P1P as I can’t test it (don’t have the printer) and a lot of things are different with how it reports status messages.

To try to get it to work, try disabling TLS, changing the port to 1883, and disabling tls.

Then in security tab, delete both the user and password.

You can get to this settings by double clicking on one of the MQTT IN purple nodes for the Bambu printer, then clicking the pencil edit icon next to the Server name in the first field. image

This is how the P1P can currently connect I believe, but it will likely change to follow the X1C method probably on a future firmware update. This is one of the reasons the P1P support is experimental with my flows unfortunately, the other being the difference in messages - I hope to make that part equal soon with a few future updates.

1 Like

ohhh, thaks a lot, now it´s working.

No works for people like you, taking time to help anonymous like me.

Appreciated so much.

I will be attend to the next versions

1 Like

Is there a significant difference between what information you can get from the X1C and the P1P over mqtt?

@WolfwithSword Thank you for all your work. At last I can get information from my P1P :slight_smile:

1 Like

Kindof. The X1C releases a status update report once a second of every public sensor in addition to miscellaneous messages that randomly come around. The P1P has the same miscellaneous messages (verbose debug data mostly), but also the “same” status report… except it’s trimmed to only sensors that have changed since last push/report. There is a way to force it to push all with a published command but I would use it sparingly due to potential overload of the processor.

So the P1P does have all the same sensors as the X1C (even chamber temp, yet it makes no sense to use unless you enclose it), but it comes in small blurbs so it’s important to retain statuses and request a full update intermittently.

Although, the P1P has an additional field, vt_tray, which the X1C does not have, as it’s for the config for the external spool. I wish the X1C had it :laughing:

So yeah, same info, just acquired/published differently, and some things are different due to their use really.

1 Like

Loving the layout! Glad to know the P1P actually works with the flow/guide changes I made, after manual changes are done for the MQTT auth. Hopefully when the P1P adds it in a firmware update one day (if it does) then both will work with the same flow without manual changes.

1 Like

Trying to fetch print preview from P1P and thinking of ftp connection flow. As I understand flow is hardcoded to connect to ftp only with tls?
Second case is that I cant reach ftp connection to P1P with Total Commander. No matter if I try tls or unsecure ftp. Any tips how to connect to ftp on P1P?