notifications upon start/pause/finish of print
-
@nxt-1 That's bit odd according to the previous post it should be either one of those two URLs.
@stuartofmt / @chrishamm any idea why either doesn't work?
-
@torin It's
/machine/status
, not/machine/system
. Support forrr_
requests will come in v3.5. -
@chrishamm Awesome, thanks for the great spot, not sure how I missed it.
@Nxt-1 would you mind giving it another go please? also api_version not needed anymore, software will try to detect it automatically.
-
@torin
/machine/status
does give me a wall of json output .curl -v http://localhost:8080/machine/status * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8080 (#0) > GET /machine/status HTTP/1.1 > Host: localhost:8080 > User-Agent: curl/7.58.0 > Accept: */* > < HTTP/1.1 200 OK < Content-Length: 14094 < Content-Type: application/json < Date: Wed, 20 Jul 2022 13:45:18 GMT < Server: Kestrel < {"boards":[{"accelerometer":null,"bootloaderFileName":null,"canAddress":0,"closedLoop":null,"directDisplay":null,"firmwareDate":"2022-06-01","firmwareFileName":"Duet3Firmware_MB6HC.bin","firmwareName":"RepRapFirmware for Duet 3 MB6HC","firmwareVersion":"3.4.1","iapFileNameSBC":"Duet3_SBCiap32_MB6HC.bin","iapFileNameSD":"Duet3_SDiap32_MB6HC.bin","maxHeaters":32,"maxMotors":6,"mcuTemp":{"current":44,"min":39.8,"max":50.4},"name":"Duet 3 MB6HC","shortName":"MB6HC","state":"unknown","supports12864":false,"supportsDirectDisplay":false,"uniqueId":"08DJM-9P63L-DJMSS-6JKD0-3S06T-9AF79","v12":{"current":12.3,"min":12.2,"max":12.4},"vIn":{"current":32.1,"min":31.9,"max":32.3}}],"directories":{"filaments":"0:/filaments/","firmware":"0:/firmware/","gCodes":"0:/gcodes/","macros":"0:/macros/","menu":"0:/menu/","scans":"0:/scans/","system":"0:/sys","web":"0:/www/"},"fans":[{"actualValue":0,"blip":0.1,"frequency":2000,"max":0.7,"min":0,"name":"Compressor","requestedValue":0,"rpm":-1,"thermostatic":{"heaters":[],"highTemperature":null,"lowTemperature":null}},{"actualValue":1,"blip":0.1,"frequency":25000,"max":1,"min":0,"name":"Duet","requestedValue":1,"rpm":2039,"thermostatic":{"heaters":[],"highTemperature":null,"lowTemperature":null}},{"actualValue":1,"blip":0.1,"frequency":25000,"max":1,"min":0,"name":"Pump","requestedValue":1,"rpm":4539,"thermostatic":{"heaters":[],"highTemperature":null,"lowTemperature":null}}],"global":{},"heat":{"bedHeaters":[0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],"chamberHeaters":[-1,-1,-1,-1],"coldExtrudeTemperature":160,"coldRetractTemperature":90,"heaters":[{"active":0,"avgPwm":0,"current":33.6,"max":150,"min":-273.1,"model":{"coolingExp":1.4,"coolingRate":0.138,"deadTime":19.5,"enabled":true,"fanCoolingRate":0,"heatingRate":0.577,"inverted":false,"maxPwm":1,"pid":{"d":0.849,"i":0.0008,"overridden":false,"p":0.06221,"used":true},"standardVoltage":0},"monitors":[{"action":1,"condition":"tooHigh","limit":150},{"action":0,"condition":"disabled","limit":0},{"action":0,"condition":"disabled","limit":0}],"sensor":0,"standby":0,"state":"off"},{"active":0,"avgPwm":0,"current":29.2,"max":285,"min":-273.1,"model":{"coolingExp":1.4,"coolingRate":0.319,"deadTime":5.4,"enabled":true,"fanCoolingRate":0.038,"heatingRate":1.825,"inverted":false,"maxPwm":1,"pid":{"d":0.268,"i":0.0029,"overridden":false,"p":0.07116,"used":true},"standardVoltage":32.1},"monitors":[{"action":0,"condition":"tooHigh","limit":285},{"action":0,"condition":"disabled","limit":0},{"action":0,"condition":"disabled","limit":0}],"sensor":1,"standby":0,"state":"off"}]},"httpEndpoints":[],"inputs":[{"axesRelative":false,"compatibility":"RepRapFirmware","distanceUnit":"mm","drivesRelative":true,"feedRate":50,"inMacro":false,"macroRestartable":false,"name":"HTTP","stackDepth":0,"state":"idle","lineNumber":0,"volumetric":false},{"axesRelative":false,"compatibility":"Marlin","distanceUnit":"mm","drivesRelative":true,"feedRate":50,"inMacro":false,"macroRestartable":false,"name":"Telnet","stackDepth":0,"state":"idle","lineNumber":0,"volumetric":false},{"axesRelative":false,"compatibility":"RepRapFirmware","distanceUnit":"mm","drivesRelative":true,"feedRate":10.5,"inMacro":false,"macroRestartable":false,"name":"File","stackDepth":0,"state":"idle","lineNumber":270768,"volumetric":false},{"axesRelative":false,"compatibility":"Marlin","distanceUnit":"mm","drivesRelative":true,"feedRate":50,"inMacro":false,"macroRestartable":false,"name":"USB","stackDepth":0,"state":"idle","lineNumber":0,"volumetric":false},{"axesRelative":false,"compatibility":"RepRapFirmware","distanceUnit":"mm","drivesRelative":true,"feedRate":50,"inMacro":false,"macroRestartable":false,"name":"Aux","stackDepth":0,"state":"reading","lineNumber":7,"volumetric":false},{"axesRelative":false,"compatibility":"RepRapFirmware","distanceUnit":"mm","drivesRelative":true,"feedRate":50,"inMacro":false,"macroRestartable":false,"name":"Trigger","stackDepth":0,"state":"idle","lineNumber":0,"volumetric":false},{"axesRelative":false,"compatibility":"RepRapFirmware","distanceUnit":"mm","drivesRelative":true,"feedRate":50,"inMacro":false,"macroRestartable":false,"name":"Queue","stackDepth":0,"state":"idle","lineNumber":270768,"volumetric":false},{"axesRelative":false,"compatibility":"RepRapFirmware","distanceUnit":"mm","drivesRelative":true,"feedRate":50,"inMacro":false,"macroRestartable":false,"name":"LCD","stackDepth":0,"state":"idle","lineNumber":0,"volumetric":false},{"axesRelative":false,"compatibility":"RepRapFirmware","distanceUnit":"mm","drivesRelative":true,"feedRate":50,"inMacro":false,"macroRestartable":false,"name":"SBC","stackDepth":0,"state":"idle","lineNumber":0,"volumetric":false},{"axesRelative":false,"compatibility":"RepRapFirmware","distanceUnit":"mm","drivesRelative":true,"feedRate":50,"inMacro":false,"macroRestartable":false,"name":"Daemon","stackDepth":0,"state":"idle","lineNumber":0,"volumetric":false},{"axesRelative":false,"compatibility":"RepRapFirmware","distanceUnit":"mm","drivesRelative":true,"feedRate":50,"inMacro":false,"macroRestartable":false,"name":"Aux2","stackDepth":0,"state":"idle","lineNumber":0,"volumetric":false},{"axesRelative":false,"compatibility":"RepRapFirmware","distanceUnit":"mm","drivesRelative":true,"feedRate":50,"inMacro":false,"macroRestartable":false,"name":"Autopause","stackDepth":0,"state":"idle","lineNumber":0,"volumetric":false}],"job":{"build":null,"duration":null,"file":{"filament":[7056],"fileName":null,"generatedBy":"Simplify3D(R) Version 4.1.2","height":33.1,"lastModified":"2022-07-17T15:13:52","layerHeight":0.2,"numLayers":165,"printTime":7380,"simulatedTime":4309,"size":7460736,"thumbnails":[]},"filePosition":7460476,"lastDuration":4298,"lastFileName":"0:/gcodes/LampAdapter.gcode","lastFileAborted":false,"lastFileCancelled":false,"lastFileSimulated":false,"layer":null,"layers":[],"layerTime":null,"pauseDuration":null,"rawExtrusion":null,"timesLeft":{"filament":null,"file":null,"slicer":null},"warmUpDuration":null},"limits":{"axes":15,"axesPlusExtruders":25,"bedHeaters":12,"boards":21,"chamberHeaters":4,"drivers":26,"driversPerAxis":8,"extruders":16,"extrudersPerTool":10,"fans":20,"gpInPorts":32,"gpOutPorts":32,"heaters":32,"heatersPerTool":20,"monitorsPerHeater":3,"restorePoints":6,"sensors":56,"spindles":4,"tools":50,"trackedObjects":40,"triggers":32,"volumes":1,"workplaces":9,"zProbeProgramBytes":8,"zProbes":4},"messages":[],"move":{"axes":[{"acceleration":1000,"babystep":0,"current":2400,"drivers":["0.2"],"homed":false,"jerk":400,"letter":"X","machinePosition":-5.392,"max":200,"maxProbed":false,"microstepping":{"interpolated":true,"value":16},"min":-200,"minProbed":false,"percentCurrent":100,"percentStstCurrent":71,"speed":10000,"stepsPerMm":160,"userPosition":-5.365,"visible":true,"workplaceOffsets":[0,0,0,0,0,0,0,0,0]},{"acceleration":1000,"babystep":0,"current":2400,"drivers":["0.1"],"homed":false,"jerk":400,"letter":"Y","machinePosition":-24.104,"max":200,"maxProbed":false,"microstepping":{"interpolated":true,"value":16},"min":-200,"minProbed":false,"percentCurrent":100,"percentStstCurrent":71,"speed":10000,"stepsPerMm":160,"userPosition":-23.984,"visible":true,"workplaceOffsets":[0,0,0,0,0,0,0,0,0]},{"acceleration":1000,"babystep":0,"current":2400,"drivers":["0.0"],"homed":false,"jerk":400,"letter":"Z","machinePosition":133.866,"max":770.05,"maxProbed":false,"microstepping":{"interpolated":true,"value":16},"min":0,"minProbed":false,"percentCurrent":100,"percentStstCurrent":71,"speed":10000,"stepsPerMm":160,"userPosition":133.2,"visible":true,"workplaceOffsets":[0,0,0,0,0,0,0,0,0]}],"calibration":{"final":{"deviation":0.037,"mean":0},"initial":{"deviation":0.038,"mean":-0.033},"numFactors":8},"compensation":{"fadeHeight":null,"file":null,"liveGrid":null,"meshDeviation":null,"probeGrid":{"axes":["X","Y"],"maxs":[188.8,188.8],"mins":[-188.7,-188.7],"radius":190,"spacings":[41.9,41.9]},"skew":{"compensateXY":true,"tanXY":0,"tanXZ":0,"tanYZ":0},"type":"none"},"currentMove":{"acceleration":0,"deceleration":0,"laserPwm":null,"requestedSpeed":0,"topSpeed":0},"extruders":[{"acceleration":3000,"current":750,"driver":"0.3","filament":"","factor":1,"jerk":2000,"microstepping":{"interpolated":true,"value":16},"nonlinear":{"a":0,"b":0,"upperLimit":0.2},"percentCurrent":100,"percentStstCurrent":71,"position":7053.9,"pressureAdvance":0.14,"rawPosition":7054.8,"speed":10000,"stepsPerMm":414}],"idle":{"factor":0.6,"timeout":30},"kinematics":{"deltaRadius":231.522,"homedHeight":770.057,"printRadius":200,"towers":[{"angleCorrection":-0.02,"diagonal":501.3,"endstopAdjustment":0.413,"xPos":-200.544,"yPos":-115.692},{"angleCorrection":-0.091,"diagonal":501.3,"endstopAdjustment":-0.814,"xPos":200.319,"yPos":-116.08},{"angleCorrection":0,"diagonal":501.3,"endstopAdjustment":0.402,"xPos":0,"yPos":231.522}],"xTilt":-0.009,"yTilt":0.003,"name":"delta","segmentation":null},"limitAxes":true,"noMovesBeforeHoming":true,"printingAcceleration":20000,"queue":[{"gracePeriod":0.01,"length":60},{"gracePeriod":0.01,"length":5}],"rotation":{"angle":0,"centre":[0,0]},"shaping":{"amplitudes":[],"damping":0.1,"durations":[],"frequency":40,"minAcceleration":0,"type":"none"},"speedFactor":1,"travelAcceleration":20000,"virtualEPos":0,"workplaceNumber":0},"network":{"corsSite":null,"hostname":"server","interfaces":[{"activeProtocols":[],"actualIP":null,"configuredIP":null,"dnsServer":"127.0.0.53","firmwareVersion":null,"gateway":null,"mac":"AE:A2:57:DA:70:FA","numReconnects":null,"signal":null,"speed":0,"state":"disabled","subnet":null,"type":"lan"},{"activeProtocols":[],"actualIP":null,"configuredIP":null,"dnsServer":"127.0.0.53","firmwareVersion":null,"gateway":null,"mac":"48:B0:2D:3D:3E:E4","numReconnects":null,"signal":null,"speed":10,"state":"disabled","subnet":null,"type":"lan"},{"activeProtocols":[],"actualIP":null,"configuredIP":null,"dnsServer":"127.0.0.53","firmwareVersion":null,"gateway":null,"mac":"A6:73:89:4F:B4:35","numReconnects":null,"signal":null,"speed":0,"state":"disabled","subnet":null,"type":"lan"},{"activeProtocols":[],"actualIP":null,"configuredIP":null,"dnsServer":"127.0.0.53","firmwareVersion":null,"gateway":null,"mac":"A6:73:89:4F:B4:35","numReconnects":null,"signal":null,"speed":0,"state":"disabled","subnet":null,"type":"lan"},{"activeProtocols":[],"actualIP":null,"configuredIP":null,"dnsServer":"127.0.0.53","firmwareVersion":null,"gateway":null,"mac":"A6:73:89:4F:B4:37","numReconnects":null,"signal":null,"speed":0,"state":"disabled","subnet":null,"type":"lan"},{"activeProtocols":[],"actualIP":"172.17.0.1","configuredIP":"172.17.0.1","dnsServer":"127.0.0.53","firmwareVersion":null,"gateway":null,"mac":"02:42:A8:9B:B4:7D","numReconnects":null,"signal":null,"speed":0,"state":"disabled","subnet":"255.255.0.0","type":"lan"},{"activeProtocols":[],"actualIP":"192.168.178.22","configuredIP":"192.168.178.22","dnsServer":"127.0.0.53","firmwareVersion":null,"gateway":"192.168.178.1","mac":"58:96:1D:13:6F:0A","numReconnects":null,"signal":-71,"speed":0,"state":"active","subnet":"255.255.255.0","type":"wifi"}],"name":"server"},"plugins":{},"scanner":{"progress":0,"status":"D"},"sensors":{"analog":[{"lastReading":33.6,"name":"Bed","type":"thermistor"},{"lastReading":29.2,"name":"Hotend","type":"thermistor"}],"endstops":[{"highEnd":true,"triggered":false,"type":"inputPin"},{"highEnd":true,"triggered":false,"type":"inputPin"},{"highEnd":true,"triggered":false,"type":"inputPin"}],"filamentMonitors":[],"gpIn":[],"probes":[{"calibrationTemperature":25,"deployedByUser":false,"disablesHeaters":false,"diveHeight":5,"lastStopHeight":-0.116,"maxProbeCount":10,"offsets":[0,0,0.1],"recoveryTime":0.5,"speeds":[1000,1000],"temperatureCoefficients":[0,0],"threshold":100,"tolerance":0.03,"travelSpeed":10000,"triggerHeight":-0.1,"type":8,"value":[0]}]},"spindles":[{"active":0,"canReverse":false,"current":0,"frequency":0,"min":60,"max":10000,"state":"unconfigured"},{"active":0,"canReverse":false,"current":0,"frequency":0,"min":60,"max":10000,"state":"unconfigured"},{"active":0,"canReverse":false,"current":0,"frequency":0,"min":60,"max":10000,"state":"unconfigured"},{"active":0,"canReverse":false,"current":0,"frequency":0,"min":60,"max":10000,"state":"unconfigured"}],"state":{"atxPower":null,"atxPowerPort":null,"beep":null,"currentTool":0,"deferredPowerDown":null,"displayMessage":"","dsfVersion":"3.4.1","dsfPluginSupport":true,"dsfRootPluginSupport":false,"gpOut":[],"laserPwm":null,"logFile":null,"logLevel":"off","messageBox":null,"machineMode":"FFF","macroRestarted":false,"msUpTime":230,"nextTool":0,"pluginsStarted":false,"powerFailScript":"","previousTool":-1,"restorePoints":[{"coords":[0,0,0],"extruderPos":0,"fanPwm":0,"feedRate":50,"ioBits":0,"laserPwm":null,"spindleSpeeds":[],"toolNumber":-1},{"coords":[0,0,0],"extruderPos":0,"fanPwm":0,"feedRate":50,"ioBits":0,"laserPwm":null,"spindleSpeeds":[],"toolNumber":-1},{"coords":[0,0,238.806],"extruderPos":0,"fanPwm":0,"feedRate":50,"ioBits":0,"laserPwm":null,"spindleSpeeds":[],"toolNumber":-1},{"coords":[0,0,0],"extruderPos":0,"fanPwm":0,"feedRate":50,"ioBits":0,"laserPwm":null,"spindleSpeeds":[],"toolNumber":-1},{"coords":[0,0,0],"extruderPos":0,"fanPwm":0,"feedRate":50,"ioBits":0,"laserPwm":null,"spindleSpeeds":[],"toolNumber":-1},{"coords":[0,0,0],"extruderPos":0,"fanPwm":0,"feedRate":* Connection #0 to host localhost left intact 50,"ioBits":0,"laserPwm":null,"spindleSpeeds":[],"toolNumber":-1}],"status":"idle","thisInput":null,"time":"2022-07-20T15:44:46","upTime":4052689},"tools":[{"active":[0],"axes":[[0],[1]],"extruders":[0],"fans":[0],"feedForward":[0],"filamentExtruder":0,"heaters":[1],"isRetracted":false,"mix":[1],"name":"Hotend","number":0,"offsets":[0,0,0],"offsetsProbed":0,"retraction":{"extraRestart":0,"length":0.9,"speed":45,"unretractSpeed":45,"zHop":0.1},"spindle":-1,"spindleRpm":0,"standby":[0],"state":"active"}],"userSessions":[{"accessLevel":"readWrite","id":33,"origin":"94.105.126.101","originId":-1,"sessionType":"http"}],"volumes":[{"capacity":236242378752,"freeSpace":220662013952,"mounted":true,"name":null,"openFiles":null,"partitionSize":236242378752,"path":"/","speed":null}]}
However launching the updated executable I get continous json errors:
(I am running rrf 3.4.1 fyi)./reprap_notify_linux_arm64 2022/07/20 15:48:57 Detecting API version... 2022/07/20 15:48:57 Detected firmware revision 2 2022/07/20 15:48:57 Error parsing JSON: unexpected end of JSON input 2022/07/20 15:48:57 Error parsing JSON: unexpected end of JSON input
-
@nxt-1 Interesting, can you provide me full curl of:
curl -v 'http://localhost:8080/rr_status?type=3' curl -v http://localhost:8080/rr_fileinfo (those two below probably will not work) curl -v 'http://localhost:8080/rr_model?key=job' curl -v 'http://localhost:8080/rr_model?key=state'
-
@torin said in notifications upon start/pause/finish of print:
@nxt-1 Interesting, can you provide me full curl of:
curl -v 'http://localhost:8080/rr_status?type=3' curl -v http://localhost:8080/rr_fileinfo (those two below probably will not work) curl -v 'http://localhost:8080/rr_model?key=job' curl -v 'http://localhost:8080/rr_model?key=state'
curl -v 'http://localhost:8080/rr_status?type=3'
-> 404
curl -v http://localhost:8080/rr_fileinfo
-> 404
curl -v 'http://localhost:8080/rr_model?key=job'
-> 404
curl -v 'http://localhost:8080/rr_model?key=state'
-> 404Which makes sense, since Chrishamm mentioned the rr_ system wil be introduced in v3.5
-
@Torin So, it's been a while. I finaly broke down and installed a Go environment so I can play around with your project.
What I belive is going on is that there is rrf3 and 2, which your latested beta does differentiate between, though not entirely correct. Within rrf3 a subdivision must be made between the SBC version and the standalone version. The standalone version (rrf3) will get detected as is and work as intended (I assume I cannot test this). Rrf2 will also work I believe (again, I cannot test this). However, SBC mode (rrf3) will not work since it uses the
/machine/status
syntax which will lead it down the rrf2 branch of your code. That wont work asrr_status
is deprecated and returns resulting in a empty response. Which is obviously not json parsable, hence the continuous json errors I reported earlier. @chrishamm please correct me if I am wrong at any point here.What I belive needs to change to make all of this work:
- Expand the api version check in
main
to handle rrf3 sbc as a separate case (or pass the version/type as a config parameter again) - Make a 3rd handler for rrf3 sbc that uses
/machine/status
to get the full object model and takes the data it needs from it
-> I've changed the v2handler to package for now as an example on how this could work, check the files attached below
Some other changes I think would be useful if added:
- Make the connection protocol part of the host parameter. I.e. add the http part in there as well. For example my machine normally does not listen to http requests so making this user changeable would save some hassle on my side
- Add the same delay to the loop in case of errors, so the loop does not run at mach3
======================
Example implementation for rrf3 sbc handler (currently sits in place of the v2 handler)
v2_handler.gcode
types.gcode - Expand the api version check in
-
@nxt-1 I would unify
/machine/status
andrr_model
, then you can use basically the same data in your code. DSF 3.5-b1 will be able to emulaterr_
requests (except forrr_status
andrr_config
), too. -
I'm not sure I'm following what the issue is or if there is a better / neater way (than I use) .
In an attempt to assist, I posted an excerpt of code that I use in most of my (python) applications. DuetLapse3 etc.
https://forum.duet3d.com/topic/11088/notifications-upon-start-pause-finish-of-print/44
Is this sub-optimal? about to be outdated? just clumsy?
-
-
@stuartofmt That's alright since it already uses the object model.
-
@Torin Hello! I tried using this to send a text message to my phone via email. I have "email: 1234567890@vtext.com" and I keep getting messages from mail-daemon@comcast.net that delivery failed permanently and the recipients is "(empty line)". Is it possible that the email address starting with a number is not working as intended?
Thanks! -
This post is deleted!