Query printer status via webpage URL ???
Hello all,
i want to query the printer status (e.g. idle, printing, status 50%, etc.) via webpage URL to integrate control and status to my home automation system.
With Octoprint i was using the following URL to fetch the required information:
Unfortunately i could not find similar easy solution with Repetier Server to do this.
I also do not really understand from documentation how to format the URL to include API, command, group, ... etc.
Which webpage URL could be used to get basic printer status from Repetier Server assuming following parameters:
IP = 192.168.6.99
slug = Prusa_MK3S
apikey = 1234567-1234-1234-1234-123456789012
Which webpage URL could be used to fetch basic information?
Many thanks for your help.
Christian
Comments
http://192.168.6.99:3344/printer/api?apikey=1234567-1234-1234-1234-123456789012&a=listPrinter&data={}
would give you basic informations. Normally after /api you have /slugname but for listPrinter that is not necessary. See
https://prgdoc.repetier-server.com/v1/docs/index.html#/en/web-api/websocket/basicCommands?id=list-printer
for more details and also other possible commands to query. stateList is also interesting if you need more informations. But never forget to url escape the data parameter if it contains data or it will fail.
https://prgdoc.repetier-server.com/v1/docs/index.html#/en/web-api/websocket/jobs?id=list-g-code-models
Then copy the file to job list with autostart flag set, so if queue is empty and no print is running it will start print.
https://prgdoc.repetier-server.com/v1/docs/index.html#/en/web-api/websocket/jobs?id=copy-g-code-model-to-print-list
Same replacement for a and data apply to all commands in websocket docs.
There is the @autostart_next_job command that starts next file in job queue, but that makes only sense if your printer automatically clears the bed or you get a printer damage due to old printed content still on bed.
@autostart_next_job
to on connection start. Then as soon as printer connects the first job in queue gets started. To be safe you should only add new files when bed is clear.
You can add this command to the "connection start" script (Go to printer settings -> G-Codes -> Event Dependent -> Run on connect)
There you can simply add "@autostart_next_job".
@startNextPrintInQueue
to just start the next print in queue. You might want to start at the moment until 1.2.1 where the run on connect only gets called once. 1.2.0 also executes it for reset detection so might trigger several times. Maybe no problem as it won't start jobs twice, but in case there are problems that might be the reason.