Hi all,
Im just trying to learn Node-Red here and having a hard time getting started. I am reading a bunch and will get there sooner or later but could use a little help on a simple workflow.
I have a Bambu Lab X1C 3D printer and all I want to do is connect to it, and have certain Topics show up on my MQTT Broker so I can see them and then get them in my HomeSeer as a device where I can then query them via Alexa voice commands. I know my printer has a bunch of values but just starting off with a simple connection to the printer and then somehow passing this to the Broker would be awesome and it would give me something to see visually while I continue my learning.
Ive got the MQTT IN network node (connected to my printer) in my flow and it shows connected to my printer. I have it connected to a Function node on input and the other side connects to both a MQTT Out network node (connected to the Broker) and a Debug node which is set to show in the Debug window. Like mentioned, both MQTT in and MQTT out nodes show connected in my work flow and have been deployed. Shouldn't I see traffic from my printer on the Broker as well as see the printer traffic in the debug window? Well I dont...lol
The MQTT-in node status shows it is connected to an mqtt broker.
If this broker is really running on the printer, set the node's topic to # and use a debug node directly on the mqtt-in output.
Set the debug node to show the entire message object.
Restart the printer.
Do you see any MQTT traffic?
What topics and values do you see?
You could replace your function node with a single switch node like this, which might be a more reliable test than msg.payload.print !== undefined
Unless there is an mqtt broker running on your printer, the mqtt-in node cannot connect to the printer. So is it connected to a separate mqtt broker somewhere else or is it connected to the printer? (I saw a suggestion online that a Bambu printer can run an mqtt broker)
You did not say if you see any mqtt traffic when you subscribe to topic '#'.
Just looked at some of postings on the web..people say the port number for the printer is 8883 (not 1883).
As @xx_Nexus_xx said, I'd use MQTT-Explorer to see what you are getting from the printer and go from there.
Hey Guys, sorry as I probably explained my issues badly. Here's another attempt using a picture that hopefully explains it better.
The Broker is running in a separate box and has a debug tool to see MQTT messages/traffic coming into it. This traffic would also include seeing anything from the printer as it connects to this box as well.
I probably don't understand Node-Red like I should and my workflow is probably wrong but my first design makes since in that I get my printer connected to the Broker (MQTT in) as well as the use a MQTT out node connected to the Broker. I also want a Debug node so I can see messages and help me troubleshoot the workflow. So the thought on my workflow in the picture is that when my printer starts to print, the Broker will receive messages/topics. If I can get this far it will help me understand the workflow as I read up a bit more
Also this is a view of the terminal window on the Broker. I do see some messages but none that make since like temperature, layer number, etc....You know, 3D Printer stuff.
IF your printer IP address is 192.168.1.234 AND you have an mqtt-in node pointing to 192.168.1.234 AND the node status says Connected THEN You have an mqtt broker running on your printer.
In that case you do not need another MQTT broker.
The printer presumably publishes messages to [it's internal] mqtt broker.
Your mqtt-in node can subscribe to these messages and pass them to a debug or other functions.
Since we have no hint of what topics it will use, I suggested subscribing to everything using the wildcard # and a debug node to display them.
Since you seem to be focussed more on restating your problem than on an interactive discussion I don't think I can offer any more help.
Only the values showing in MQTT Explorer will be visible to Node-red as well. The explorer will show all TOPICS and Values, so you can choose properly. If the Explorere is not showing the PRINTER information, than your setup between the BROKER and your PRINTER is not correct. You need to get this working before you can proceed with Node-Red
It is important that you understand how MQTT, Publisher and Subscriber are working
Your Scenario:
Your Printer is primarily a Publisher , sending TOPICS and Values to the broker
The Broker is to receive all the TOPICS and Values and will maintain a repository, so other Subscribers can request these values
Node-Red is a Subscriber, you have to configure the Node-In to a BROKER and requesting a topic.In your example the TOPIC should be MQTT/Statistics/# (see @jbudd )
Which is running its own broker. Unless you are "republishing" everything from the printer to another broker, the mqtt-in can be configured to connect to the printer ip directly.
However, it is not as straight forward as bambulab "likes" to do things differently.
The printer broker will remain quiet, unless you first subscribe to a specific topic: