Is there a programatic way get all possible printer states?

My plugin triggers different light signals depending on the printers status e.g White light on when connected, dimmed while printing, green on print complete etc.

I am adding a feature to allow users to add additional signals for any other state they are interested in. It would make the users life easier if i could present them with a select box instead of requiring them to look it up then type it. I'd also like to avoid, if possible, hardcoding the possible states manually from the list in the documentation.

So as per the title, is there a way to pull a list of available printer states programatically?

No, currently there is no such thing. There never was a need for it so far, the documentation has always sufficed.

Hi @foosel,

Thanks for the speedy reply.

Not a problem. For the time being I'll just link to the appropriate docs in my plugins readme.

Out of curiosity, could you point me in the direction of the code that sends the statuses to the Event Handler (if that make sense)?

That would be here:

and here:

Awesome, thanks.
Once I finish this feature I'll start getting my head around the event handling.

Thanks again for the speedy help, feel free to consider all my questions as resolved.

1 Like

Dear Gina,
is there a state-documentation where I can see how the state is changing on which conditions from each other?
And when I look to code in comm.py:
if state == self.STATE_NONE:
return "Offline"
elif state == self.STATE_OPEN_SERIAL:
return "Opening serial connection"
elif state == self.STATE_DETECT_SERIAL:
return "Detecting serial connection"
elif state == self.STATE_CONNECTING:
return "Connecting"
elif state == self.STATE_OPERATIONAL:
return "Operational"
elif state == self.STATE_STARTING:
if self.isSdFileSelected():
return "Starting print from SD"
elif self.isStreaming():
return "Starting to send file to SD"
else:
return "Starting"
elif state == self.STATE_PRINTING:
if self.isSdFileSelected():
return "Printing from SD"
elif self.isStreaming():
return "Sending file to SD"
else:
return "Printing"
elif state == self.STATE_CANCELLING:
return "Cancelling"
elif state == self.STATE_PAUSING:
return "Pausing"
elif state == self.STATE_PAUSED:
return "Paused"
elif state == self.STATE_RESUMING:
return "Resuming"
elif state == self.STATE_FINISHING:
return "Finishing"
elif state == self.STATE_CLOSED:
return "Offline"
elif state == self.STATE_ERROR:
return "Error"
elif state == self.STATE_CLOSED_WITH_ERROR:
return "Offline after error"
elif state == self.STATE_TRANSFERING_FILE:
return "Transferring file to SD"
return "Unknown State ({})".format(self._state)

what is differnce between STATE_TRANSFERING_FILE and STATE_PRINTING && is.streaming? (near line 930)
br Thomas