@eberlin said in control multiple printer with node.js server:
I want to control my printer over the Internet.
I know that the duet3D firmware has method headers prepared to open TCP connections.
My problems is, I don't now how to implement them in cpp and how to receive any sended status message with my node. Js server
Two parts to this.
First, establishing a connection between the printer, which is an IP address on your private network, and your node.js on the public internet. There are MANY ways to do this SECURELY. Personally, I would run a reverse proxy... The details of setting this up are HEAVILY dependent your your LAN and Router setup, ISP, etc, etc. Therefore, you won't get that much help here on the Duet forum. There are many tutorials, or seek the help of someone who knows.
.
Second, how to have node.js talk to the printer. That is what is documented at chrishamm's github. It is all simple HTTP GET requests. That is the only thing the printer fully supports for control and status.
You can see this in action by entering a few of the commands in a browser. Something like:
http://192.168.86.100/rr_status?type=2
Will result in:
{"status":"I","coords":{"axesHomed":[1,1,1],"xyz":[0.000,0.000,622.124],"machine":[0.000,0.000,622.124],"extr":[4935.9]},"speeds":{"requested":0.0,"top":0.0},"currentTool":0,"params":{"atxPower":0,"fanPercent":[0,100,0,0,0,0,0,0,0],"fanNames":["","","","","","","","",""],"speedFactor":100.0,"extrFactors":[100.0],"babystep":0.000},"seq":93,"sensors":{"probeValue":0,"fanRPM":0},"temps":{"bed":{"current":21.0,"active":0.0,"state":2,"heater":0},"current":[21.0,19.9,2000.0,2000.0,2000.0,2000.0,2000.0,2000.0],"state":[2,2,0,0,0,0,0,0],"names":["","","","","","","",""],"tools":{"active":[[0.0]],"standby":[[0.0]]},"extra":[{"name":"MCU","temp":34.5}]},"time":1027270.0,"coldExtrudeTemp":160.0,"coldRetractTemp":90.0,"compensation":"Mesh","controllableFans":5,"tempLimit":290.0,"endstops":4088,"firmwareName":"RepRapFirmware for Duet 2 WiFi/Ethernet","geometry":"delta","axes":3,"axisNames":"XYZ","volumes":2,"mountedVolumes":1,"name":"Danal's BFD","probe":{"threshold":100,"height":-0.10,"type":5},"tools":[{"number":0,"heaters":[1],"drives":[0],"axisMap":[[0],[1]],"fans":1,"filament":"","offsets":[0.00,0.00,0.00]}],"mcutemp":{"min":32.5,"cur":34.5,"max":38.3},"vin":{"min":24.8,"cur":25.0,"max":25.3}}
The printer never "originates" anything. It MUST be "polled".