Using Lua to View Printer and Print Job Status
I've been exploring the Lua classes provided within the Repetier Server API, and I've been making some good progress. However, for some reason, I can't seem to figure out how to do the following two simple things:
- View the status of a printer with a given slug (is it currently printing, paused, or idle?)
- View the name, id, and status of all print jobs currently in the queue on a printer with a given slug
Comments
The other thing is that printer state is currently not available in lua api. I have added the state property for next update 0.93.1 which will contain the printer state for reading.
Same for job queue. You can query a job if you know id but not a full list.
What are you trying to do that you need all that stuff. All that is easily accessible from the web API to any client to view it. Lua is more to add extra functions server side that are not possible at client side. Therefore it was never meant to get all data also printer state might in deed have some reasons to get used.
I'm using Lua to implement a filament sensor that pauses a print and sends a push notification to my phone when the filament runs out. I have this implemented already. Now I'm trying to fine-tune the code to only send me notifications if the filament sensor triggers while a print is in progress. In order to do this, it would be handy to be able to retrieve the printer's status (or the print job's status), which would allow me to trigger the notification only when the printer/print job is in an active printing state. This would help prevent notifications from being sent to my phone when I'm changing out filament in between prints and don't need to be notified.