Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -f docs/release/${{ env.VERSION }}-notes.md ]; then
gh release create "${{ env.VERSION }}" --latest --repo "${{ github.repository }}" -F docs/release/${{ env.VERSION }}-notes.md
echo "Releasing ${{ env.VERSION }}"
gh release create "${{ env.VERSION }}" --latest --repo "${{ github.repository }}" -F "docs/release/${{ env.VERSION }}-notes.md"
else
gh release create "${{ env.VERSION }}" --latest --repo "${{ github.repository }}" --notes ""
fi
Expand Down
48 changes: 46 additions & 2 deletions bambulabs_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from bambulabs_api.ams import AMSHub
from bambulabs_api.filament_info import FilamentTray
from bambulabs_api.printer_info import NozzleType
from bambulabs_api.states_info import PrintStatus
from .camera_client import PrinterCamera
from .ftp_client import PrinterFTPClient
Expand Down Expand Up @@ -170,7 +171,6 @@ def get_print_speed(self) -> int:
def get_bed_temperature(self) -> float | None:
"""
Get the bed temperature of the printer.
NOT IMPLEMENTED YET

Returns
-------
Expand All @@ -183,7 +183,6 @@ def get_bed_temperature(self) -> float | None:
def get_nozzle_temperature(self) -> float | None:
"""
Get the nozzle temperature of the printer.
NOT IMPLEMENTED YET

Returns
-------
Expand All @@ -193,6 +192,24 @@ def get_nozzle_temperature(self) -> float | None:
"""
return self.mqtt_client.get_nozzle_temperature()

def nozzle_type(self) -> NozzleType:
"""
Get the nozzle type currently registered to printer

Returns:
NozzleType: nozzle diameter
"""
return self.mqtt_client.nozzle_type()

def nozzle_diameter(self) -> float:
"""
Get the nozzle diameter currently registered to printer

Returns:
float: nozzle diameter
"""
return self.mqtt_client.nozzle_diameter()

def get_file_name(self) -> str:
"""
Get the name of the file being printed.
Expand Down Expand Up @@ -670,3 +687,30 @@ def ams_hub(self) -> AMSHub:
"""
self.mqtt_client.process_ams()
return self.mqtt_client.ams_hub

def subtask_name(self) -> str:
"""
Get current subtask name (current print details)

Returns:
str: current subtask name
"""
return self.mqtt_client.subtask_name()

def gcode_file(self) -> str:
"""
Get current gcode file (current print details)

Returns:
str: current gcode_file name
"""
return self.mqtt_client.gcode_file()

def print_error_code(self) -> int:
"""
Get current gcode file (current print details)

Returns:
int: error code (0 if normal)
"""
return self.mqtt_client.print_error_code()
3 changes: 2 additions & 1 deletion bambulabs_api/ftp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def connect_and_run(func):

Args:
func (function): the function to be decorated
""" # noqa
""" # noqa

def wrapper(self, *args, **kwargs) -> Any:
logging.info("Connecting to FTP server...")
self.ftps.connect(host=self.server_ip, port=self.port)
Expand Down
29 changes: 28 additions & 1 deletion bambulabs_api/mqtt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ def nozzle_type(self) -> NozzleType:
Get the nozzle type currently registered to printer

Returns:
str: nozzle diameter
NozzleType: nozzle diameter
"""
return NozzleType(self.__get("nozzle_diameter", "stainless_steel"))

Expand Down Expand Up @@ -848,3 +848,30 @@ def vt_tray(self) -> FilamentTray:
"""
tray = self.__get("vt_tray")
return FilamentTray.from_dict(tray)

def subtask_name(self) -> str:
"""
Get current subtask name (current print details)

Returns:
str: current subtask name
"""
return self.__get("subtask_name")

def gcode_file(self) -> str:
"""
Get current gcode file (current print details)

Returns:
str: current gcode_file name
"""
return self.__get("gcode_file")

def print_error_code(self) -> int:
"""
Get current gcode file (current print details)

Returns:
int: error code (0 if normal)
"""
return int(self.__get("print_error", 0))
6 changes: 6 additions & 0 deletions docs/release/2.5.10-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bambulabs API 2.5.10 Release Notes
=================================

* Add nozzle info to client
* Add print file info api
* Add error code stuff
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "bambulabs_api"
version = "2.5.9"
version = "2.5.10"
authors = [
{ name="Chris Ioannidis", email="[email protected]" },
{ name="Haotian Wu", email="[email protected]"}
Expand Down