diff --git a/octomonitor.py b/octomonitor.py index 14086e2..2890be4 100644 --- a/octomonitor.py +++ b/octomonitor.py @@ -50,13 +50,15 @@ def getData(): jsondata=requests.get(fullurl, verify=False).json() jsondatatwo=requests.get(fullurltwo, verify=False).json() state="" - if jsondatatwo["state"]["flags"]["paused"] == "true": + if jsondatatwo["state"]["flags"]["paused"]: state="paused" - elif jsondatatwo["state"]["flags"]["printing"] == "true": + elif jsondatatwo["state"]["flags"]["printing"]: state="printing" - elif jsondatatwo["state"]["flags"]["error"] == "true": + elif jsondatatwo["state"]["flags"]["error"]: state="error" - elif jsondatatwo["state"]["flags"]["cancelling"] == "true": + elif jsondatatwo["state"]["flags"]["ready"]: + state="ready" + elif jsondatatwo["state"]["flags"]["cancelling"]: state="cancelling" else: state="unknown" @@ -127,7 +129,7 @@ try: draw.text((280,82),"Job complete.",font=font14,fill=0) draw.text((250,96)," Refreshing every 5m.",font=font14,fill=0) else: - draw.text((280,82),jobdata["state"],font=font18,fill=0) + draw.text((288,82),jobdata["state"],font=font18,fill=0) draw.text((25,228),f"{jobdata['bedtemp']}°c/{jobdata['bedtarget']}°c {jobdata['temp']}°c/{jobdata['target']}°c",font=font14,fill=0) # DISPLAY OUR MASTERPIECE epd.display(epd.getbuffer(paper))