bambulabs_api: Can't connect with the simple example

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:

Starting bambulabs_api example
Connecting to Bambulabs 3D printer
IP: 192.168.10.78
Serial: 01P00A3A2900822
Access Code: 26259876
Starting camera thread.
ERROR:root:Not connected to the MQTT server
Printer status: UNKNOWN

and then it hangs

if I press ^C, I get:

Traceback (most recent call last):
  File "/Users/my_user/ProgProj/bambulab/try1.py", line 27, in <module>
    printer.disconnect()
  File "/usr/local/lib/python3.11/site-packages/bambulabs_api/client.py", line 47, in disconnect
    self.__printerCamera.stop()
  File "/usr/local/lib/python3.11/site-packages/bambulabs_api/camera_client.py", line 31, in stop
    self.__thread.join()
  File "/usr/local/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1119, in join
    self._wait_for_tstate_lock()
  File "/usr/local/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1139, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

thanks, fixed by putting a sleep in the def __publish_command function within the PrinterMQTTClient class and calling get_state twice