Documentation for the web interfaces on a Duet3 w/SBC RRF3?
-
Forgive my ignorance...I've found multiple discussions pointing to the documentation for web interface ie. //rr_connect / rr_model etc. https://github.com/Duet3D/RepRapFirmware/wiki/HTTP-requests
Where can I find documentation for the /machine/status interfaces? I have a duet 3 but it is running in standalone mode so I can't try anything as it uses the rr_model type http interface.
-
@warpster The HTTP server running on the SBC is part of DSF so you can find the docs for the HTTP requests in the corresponding repo here: https://github.com/Duet3D/DuetSoftwareFramework/wiki/REST-API
-
@chrishamm Thanks for that .....could I ask a stupid question, I am new to python and the Duet. I am trying to write a function that will return a queried result of the object model back to the caller. I am adding the function to my copy of DuetWbAPI.py. I would like to pass the function a string like 'sensors.probes' and have it return just that portion of the object model. for my machine, a duet 3 w/o SBC it uses the rr_model/key='sensors.probes' and that works fine. I want this to be one function for either type of client so they need to share the passed parameters. So far I have
def getModelQuery(self, key):def getModelQuery(self, key): if (self.pt == 2): logger.info('in non sbc') if not self._rrf2: #RRF 3 on a Duet Ethernet/Wifi board, apply buffer checking sessionURL = (f'{self._base_url}'+'/rr_connect?password=reprap') r = self.requests.get(sessionURL,timeout=2) if not r.ok: logger.warning('Error in isIdle: ' + str(r)) buffer_size = 0 while buffer_size < 150: bufferURL = (f'{self._base_url}'+'/rr_gcode') buffer_request = self.requests.get(bufferURL,timeout=2) try: buffer_response = buffer_request.json() buffer_size = int(buffer_response['buff']) except: buffer_size = 149 replyURL = (f'{self._base_url}'+'/rr_reply') reply = self.requests.get(replyURL,timeout=2) if buffer_size < 150: logger.debug('Buffer low - adding 0.6s delay before next call: ' + str(buffer_size)) time.sleep(0.6) URL=(f'{self._base_url}'+'/rr_model?key=' + str(key)) try: r = self.requests.get(URL,timeout=2) j = self.json.loads(r.text) except Exception as c1: logger.info('bad JuJu' + ' ' + str(c1)) return ('failed') if not self._rrf2: #RRF 3 on a Duet Ethernet/Wifi board, apply buffer checking endsessionURL = (f'{self._base_url}'+'/rr_disconnect') r2 = self.requests.get(endsessionURL,timeout=2) return (j) if (self.pt == 3): logger.info('in sbc') URL=(f'{self._base_url}'+'/machine/status') r = self.requests.get(URL,timeout=2) j = self.json.loads(r.text) if 'result' in j: j = j['result'] thing = key.split(".") ja=j[thing[0]][thing[1]] return (ja)
This works but does not allow me to expand the number of indices so it isn't very flexible. Is there an easy way to take the input string and use it to query the whole object down to what I want and allow for flexibility in the number of indices? Or is there a completely different way of doing this that I am ignorant of? Thanks.