Open Skaronator opened 1 year ago
I think you are mixing up a few things.
Since you want to connect locally to an XL you should look into PrusaLink v2. It is the same as what the Home Assistant integration uses for example.
From what I can tell, based on the python, you are looking into the V1 source code. This is not correct for the Prusa XL. Also you should look into the part of the API that handles the local API directly to the printer, not the Prusa Connect stuff.
I'm specially looking for to accessing the Print Queue and Set Ready command for my home assistant. Both are Prusa Connect features and not available/part of Prusa Link Vx. Hence, why I'm looking at this SDK.
Looks like this library is mostly meant for a Printer that communicates with Prusa Connect and not a User/Script that reads data from Prusa Connect?
In that case it might be much easier to just use the dev tools on the browser when working on connect.prusa.com and look at what is happening there on the network tab in dev tools
Yeah, I was really hoping this "Python printer library for Prusa Connect" from Prusa directly could do most of the heavy lifting.
I'm somewhat confused by this thread. I'm also trying the example code from the readme and not really getting expected results.
I currently own a prusaXL which is registered to connect.prusa3d.com
. I have not found any way instantiate a prusa.connect.printer.Printer
that allows me to query my printer.
The constructor for prusa.connect.printer.Printer
does not even seem to match the examples in the readme
class Printer:
...
def __init__(self,
type_: Optional[const.PrinterType] = None,
sn: Optional[str] = None,
fingerprint: Optional[str] = None,
max_retries: int = 1,
mmu_supported: bool = True):
And here is the example from readme
from prusa.connect.printer import Printer, const
SERVER = "https://connect.prusa3d.com"
SN = 'SERIAL_NUMBER_FROM_PRINTER'
FINGERPRINT = 'Printer fingerprint'
TOKEN = 'secret token from prusa_printer_settings.ini'
printer = Printer(const.PrinterType.I3MK3, SN, SERVER, TOKEN)
This leaves me with 2 questions:
I'm trying to get it running, but the examples from the Readme are all outdated and / or the error handling appears to be wrong?
My use case is basic. My Prusa XL is already connected to Prusa Connect and I just want to get the current printer state.
My odyssey
---- Let's just go through what I did and why it's frustrating. Picking up the very first example from the Readme: ```python from prusa.connect.printer import Printer, const SERVER = "https://connect.prusa3d.com" SN = 'SERIAL_NUMBER_FROM_PRINTER' FINGERPRINT = 'Printer fingerprint' TOKEN = 'secret token from prusa_printer_settings.ini' printer = Printer(const.PrinterType.I3MK3, SN, SERVER, TOKEN) printer.loop() # communication loop ``` Running this will result in the first error: ``` File "/home/niklas/Workspace/prusa-demo/./main.py", line 14, inWould it be possible to provide an up2date Readme example that shows the current printer status, nozzle temperature, print time and document which (API) tokens and fingerprints I need to get it running?