Closed yanshay closed 1 day ago
There's a small issue with previous versions of the example. Try using the example in the README
There's a small issue with previous versions of the example. Try using the example in the README
I'm using the code from the README. Maybe something changed with recent firmware updates?
Here is the code I'm using (removed the sensitive variables here, but they are there when running) (with a Bambulab P1S):
print('Starting bambulabs_api example')
print('Connecting to Bambulabs 3D printer')
print(f'IP: {IP}')
print(f'Serial: {SERIAL}')
print(f'Access Code: {ACCESS_CODE}')
# Create a new instance of the API
printer = bl.Printer(IP, ACCESS_CODE, SERIAL)
# Connect to the Bambulabs 3D printer
printer.connect()
# Get the printer status
status = printer.get_state()
print(f'Printer status: {status}')
# Disconnect from the Bambulabs 3D printer
printer.disconnect()
The example should be working with the latest firmware, could you check again that your configs are all correct?
The configs (IP, ACCESS_CODE, SERIAL) are surely correct because I use the same variables (copy/pasted) in the 2nd code provided in https://github.com/acse-ci223/bambulabs_api/issues/38#issuecomment-2261420451 , and it is connecting and working.
I'm not missing any other config there, right?
Are you using the pip package or have you cloned the repo? If you're using pip it could be a version issue.
I'm using pip, when I check the version, this is what I see (which seems newer than the latest release published on this repo (2.3.1) (but not uncommon to see versions released without the release showing on github):
Name: bambulabs_api
Version: 2.3.3
Summary: API for BambuLabs 3D Printers over MQTT
Home-page: https://github.com/acse-ci223/bambulabs_api
Author: Chris Ioannidis
Author-email: Chris Ioannidis <chris.ioannidis23@imperial.ac.uk>
License:
Location: /usr/local/lib/python3.11/site-packages
Requires: paho-mqtt
Required-by:
Could the released version be not working and need to use the cloned repo?
The released version should be working. 2.3.1 has been tested
So 2.3.3 I have should work?
Yes, it should be working
@yanshay I get the same issue. unable to connect.
The issue seems to be that the pushall command (which triggers the printer to publish a more complete report) is temperamental.
As a temporary fix try sleeping for a couple seconds and then call get state twice. If that doesn't work change the line
self.command_topic = f"device/{printer_serial}/request"
to
self.command_topic = f"device/{printer_serial}/report"
thanks, fixed by putting a sleep in the def __publish_command function within the PrinterMQTTClient class and calling get_state twice
im getting this same issue how do i fix this?
@JustJace1 Have you updated to the latest version and using the example found in the README or the examples folder?
yes it still wont connect. i have tried both examples
This should be fixed now in #64
I'm unable to connect with the example (code as of today, after the fix made in #39 that was reported in #38 as connection issues). I have the correct IP/Serial/Access Code, I'm not on lan-only mode and have other software (OctoEverywhere) that connects to the printer properly from the same local network. I also tested that ports 8883, 990 and 6000 are all open on the printer (using nmap). And the example provided in #38 by @CCJv does work for me.
I get the following log:
and then it hangs
if I press
^C
, I get: