Plugin Development Request - M503 results via API

Looking to hire someone to write a plugin (if possible) that exposes a REST API call that when invoked issues an M503 command and returns the terminal results. If interested, please contact me.



Interesting. I don't think this would be too difficult to accomplish actually but curious why the need for REST API? I initially thought that the Marlin EEPROM Editor might have that, but looking at the code it's doing it all on the javascript side.

Quick question, if you type the command below in the terminal tab do you recv test back? Makes the creation of the API method a little easier and can reduce the complexity of coding requirements.

M118 test


Yes, receive test as in your photo.

To your earlier question - I want to be able to make the REST API call automatically from my print farm software for each of the printers in the farm in order to collect information.

My background is in Windows software development, and although I could probably figure out how to write the plugin, it would take some time and therefore better to enlist the help of someone from the community who has experience writing them.

This might be something that I can add to the Marlin EEPROM editor in the future, since I plan to store the results on the server to make it a bit nicer to use. At the moment, it is all loaded in the client.

Charlie, thanks for the information and keep me posted. I'm looking for a short term solution but am open to switching over to a standard plugin in the future if it becomes available.

1 Like

Well, I'm pretty sure I have the experience and an idea on how to achieve the end goal. I'll give it a go today/tonight and provide an update here. API would return nothing if printing, possibly a different status code, because you don't want to send the command during that process I wouldn't think. If not printing it will return a json object representing the results.

1 Like

Thanks. That's perfect. Appreciate the help, and happy to support you via your Patron page.

So I think the hard part is going to be putting this into a usable json object. Need to figure out how to convert this response data...

Send: M503
Recv: echo:  G21    ; Units in mm (mm)
Recv: echo:  M149 C ; Units in Celsius
Recv: echo:; Filament settings: Disabled
Recv: echo:  M200 S0 D1.75
Recv: echo:; Steps per unit:
Recv: echo: M92 X80.00 Y80.00 Z400.00 E419.00
Recv: echo:; Maximum feedrates (units/s):
Recv: echo:  M203 X500.00 Y500.00 Z10.00 E50.00
Recv: echo:; Maximum Acceleration (units/s2):
Recv: echo:  M201 X500.00 Y500.00 Z100.00 E1000.00
Recv: echo:; Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>
Recv: echo:  M204 P500.00 R1000.00 T500.00
Recv: echo:; Advanced: B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate> J<junc_dev>
Recv: echo:  M205 B20000.00 S0.00 T0.00 J0.01
Recv: echo:; Home offset:
Recv: echo:  M206 X0.00 Y0.00 Z0.00
Recv: echo:; Unified Bed Leveling:
Recv: echo:  M420 S0 Z0.00
Recv: Unified Bed Leveling System v1.01 inactive
Recv: echo:; Active Mesh Slot: 0
Recv: echo:; EEPROM can hold 7 meshes.
Recv: echo:; Material heatup parameters:
Recv: echo:  M145 S0 H180 B70 F0
Recv: echo:  M145 S1 H240 B110 F0
Recv: echo:; PID settings:
Recv: echo:  M301 P17.87 I1.50 D53.06
Recv: echo:  M304 P426.68 I78.92 D576.71
Recv: echo:; Z-Probe Offset (mm):
Recv: echo:  M851 X-43.00 Y2.00 Z-2.65
Recv: echo:; Stepper driver current:
Recv: echo:  M906 X950 Y950 Z950
Recv: echo:  M906 T0 E950
Recv: echo:; StallGuard threshold:
Recv: echo:  M914 X8 Y8
Recv: echo:; Driver stepping mode:
Recv: echo:  M569 S1 X Y Z
Recv: echo:  M569 S1 T0 E
Recv: echo:; Filament load/unload lengths:
Recv: echo:  M603 L0.00 U100.00
Recv: ok P15 B15

At initial glance I think that removing any comment lines would make sense, so lines like Recv: echo:; Filament settings: Disabled would just not be included at all? Then the remaining lines like Recv: echo: M200 S0 D1.75 would be converted to an object property like {M200: "S0 D1.75"}? So your larger json object would be something like this...

  M149: 'C',
  M200: `S0 D1.75`,
  M92: `X80.00 Y80.00 Z400.00 E419.00`,
  M203: 'X500.00 Y500.00 Z10.00 E50.00',
  M201: 'X500.00 Y500.00 Z100.00 E1000.00',
  M204: 'P500.00 R1000.00 T500.00',
  M205: 'B20000.00 S0.00 T0.00 J0.01',
  M206: 'X0.00 Y0.00 Z0.00',
  M420: 'S0 Z0.00',

but then I just noticed as typing this that might not work because of the duplicate M145 for preheats, so maybe more like this?

    M145: {
        S0: 'H180 B70 F0',
        S1: 'H240 B110 F0'


For my purpose - no need to parse the terminal results - simply passing them back as is is fine as I'll be parsing it all out on my end.

Below is what I get when I issue M503 (just as FYI).

Send: M503
Recv: echo: G21 ; (mm)
Recv: echo:Filament settings: Disabled
Recv: echo: M200 D1.75
Recv: echo: M200 D0
Recv: echo:Steps per unit:
Recv: echo: M92 X80.10 Y80.17 Z400.00 E140.00
Recv: echo:Maximum feedrates (units/s):
Recv: echo: M203 X500.00 Y500.00 Z10.00 E25.00
Recv: echo:Maximum Acceleration (units/s2):
Recv: echo: M201 X750 Y750 Z100 E25
Recv: echo:Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>
Recv: echo: M204 P300.00 R1000.00 T300.00
Recv: echo:Advanced: Q<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate> X<max_x_jerk> Y<max_y_jerk> Z<max_z_jerk> E<max_e_jerk>
Recv: echo: M205 Q20000 S0.00 T0.00 X8.00 Y8.00 Z0.40 E5.00
Recv: echo:Home offset:
Recv: echo: M206 X-1.50 Y-5.50 Z0.00
Recv: echo:Auto Bed Leveling:
Recv: echo: M420 S1 Z0.00
Recv: echo: G29 W I0 J0 Z0.03450
Recv: echo: G29 W I1 J0 Z0.00800
Recv: echo: G29 W I2 J0 Z-0.07950
Recv: echo: G29 W I3 J0 Z0.00850
Recv: echo: G29 W I0 J1 Z-0.01400
Recv: echo: G29 W I1 J1 Z-0.02700
Recv: echo: G29 W I2 J1 Z-0.11400
Recv: echo: G29 W I3 J1 Z-0.04700
Recv: echo: G29 W I0 J2 Z-0.06000
Recv: echo: G29 W I1 J2 Z-0.06800
Recv: echo: G29 W I2 J2 Z-0.17550
Recv: echo: G29 W I3 J2 Z-0.09850
Recv: echo: G29 W I0 J3 Z0.07650
Recv: echo: G29 W I1 J3 Z0.07400
Recv: echo: G29 W I2 J3 Z-0.01000
Recv: echo: G29 W I3 J3 Z0.03200
Recv: echo:PID settings:
Recv: echo: M301 P20.84 I1.96 D55.47
Recv: echo: M304 P690.34 I111.47 D1068.83
Recv: echo:Retract: S F<units/m> Z
Recv: echo: M207 S3.00 W13.00 F2700.00 Z0.00
Recv: echo:Recover: S F<units/m>
Recv: echo: M208 S0.00 W0.00 F480.00
Recv: echo:Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover
Recv: echo: M209 S0
Recv: echo:Z-Probe Offset (mm):
Recv: echo: M851 Z-1.30
Recv: echo:Filament load/unload lengths:
Recv: echo: M603 L430.00 U430.00
Recv: ok P15 B3

Ok, cool. That will make it very easy then.

So would this return data work for you or do you want anything else cleaned pre-flight, like the echo:

    "data": ["echo:  G21    ; Units in mm (mm)", "echo:  M149 C ; Units in Celsius", "", "echo:; Filament settings: Disabled", "echo:  M200 S0 D1.75", "echo:; Steps per unit:", "echo: M92 X80.00 Y80.00 Z400.00 E419.00", "echo:; Maximum feedrates (units/s):", "echo:  M203 X500.00 Y500.00 Z10.00 E50.00", "echo:; Maximum Acceleration (units/s2):", "echo:  M201 X500.00 Y500.00 Z100.00 E1000.00", "echo:; Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>", "echo:  M204 P500.00 R1000.00 T500.00", "echo:; Advanced: B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate> J<junc_dev>", "echo:  M205 B20000.00 S0.00 T0.00 J0.01", "echo:; Home offset:", "echo:  M206 X0.00 Y0.00 Z0.00", "echo:; Unified Bed Leveling:", "echo:  M420 S0 Z0.00", "", "Unified Bed Leveling System v1.01 inactive", "", "echo:; Active Mesh Slot: 0", "echo:; EEPROM can hold 7 meshes.", "", "echo:; Material heatup parameters:", "echo:  M145 S0 H180 B70 F0", "echo:  M145 S1 H240 B110 F0", "echo:; PID settings:", "echo:  M301 P17.87 I1.50 D53.06", "echo:  M304 P426.68 I78.92 D576.71", "echo:; Z-Probe Offset (mm):", "echo:  M851 X-43.00 Y2.00 Z-2.65", "echo:; Stepper driver current:", "echo:  M906 X950 Y950 Z950", "echo:  M906 T0 E950", "", "echo:; StallGuard threshold:", "echo:  M914 X8 Y8", "echo:; Driver stepping mode:", "echo:  M569 S1 X Y Z", "echo:  M569 S1 T0 E", "echo:; Filament load/unload lengths:", "echo:  M603 L0.00 U100.00"]

If that works for you I have the plugin ready.

Thanks. That looks good. What would the REST call/url look like?

Cool, here's the plugin. It's a pure API get request to the endpoint URL

Apologies for the slight delay in getting back to you. Just installed and ran on first printer in the farm - worked great. Will install on the remainder of the farm to test out.

@jneilliii I've been able to leverage your API call across my farm to produce an automated daily report of bed level status which we will use to target printer maintenance for the day, and to monitor situations where a particular printer has recurring bed level issues.

I've uploaded an example of the report.

Thanks again for all your help. I'll be sending a "thank you" to your Patreon account.

That's awesome, glad it worked out for you and thanks for the tip.