Skip to content
Merged
Changes from 1 commit
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
39 changes: 38 additions & 1 deletion bambulabs_api/mqtt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ def __send_gcode_line(self, gcode_command: str) -> bool:
Args:
gcode_command (str): G-code command to send to the printer
"""
return self.__publish_command({"print": {"command": "gcode_line",
return self.__publish_command({"print": {"sequence_id": "0",
"command": "gcode_line",
"param": f"{gcode_command}"}})

def send_gcode(self, gcode_command: str | list[str]) -> bool:
Expand Down Expand Up @@ -490,6 +491,42 @@ def set_bed_temperature(self, temperature: int) -> bool:
"""
return self.__send_gcode_line(f"M140 S{temperature}\n")

def get_fan_gear(self):
"""
Get fan_gear

Returns:
int: consolidated fan value for part, aux and chamber fan speeds
"""
return self.__get("fan_gear", 0)

def get_part_fan_speed(self):
"""
Get part fan speed

Returns:
int: 0-255 value representing part fan speed
"""
return self.get_fan_gear() % 256

def get_aux_fan_speed(self):
"""
Get auxiliary fan speed

Returns:
int: 0-255 value representing auxiliary fan speed
"""
return ((self.get_fan_gear() >> 8)) % 256

def get_chamber_fan_speed(self):
"""
Get chamber fan speed

Returns:
int: 0-255 value representing chamber fan speed
"""
return self.get_fan_gear() >> 16

def set_part_fan_speed(self, speed: int | float) -> bool:
"""
Set the fan speed of the part fan
Expand Down
Loading