Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
884101c0ba | |||
7c87ba9482 | |||
1d9f874560 | |||
21e30034d0 | |||
3c8b904a26 | |||
55ad4c1718 | |||
4ef8e40702 | |||
2537bc8f57 | |||
28be048300 |
@ -210,7 +210,7 @@ class BambuVirtualPrinter:
|
||||
self._telemetry.bedTemp = temperatures.bed_temp
|
||||
self._telemetry.bedTargetTemp = temperatures.target_bed_temp
|
||||
self._telemetry.chamberTemp = temperatures.chamber_temp
|
||||
if device_data.push_all_data:
|
||||
if device_data.push_all_data and "ams" in device_data.push_all_data:
|
||||
self._telemetry.ams_current_tray = device_data.push_all_data["ams"]["tray_now"] or 255
|
||||
|
||||
if self._telemetry.ams_current_tray != self._settings.get_int(["ams_current_tray"]):
|
||||
@ -367,8 +367,9 @@ class BambuVirtualPrinter:
|
||||
##~~ command implementations
|
||||
|
||||
@gcode_executor.register_no_data("M21")
|
||||
def _sd_status(self) -> None:
|
||||
def _sd_status(self) -> bool:
|
||||
self.sendIO("SD card ok")
|
||||
return True
|
||||
|
||||
@gcode_executor.register("M23")
|
||||
def _select_sd_file(self, data: str) -> bool:
|
||||
@ -469,6 +470,9 @@ class BambuVirtualPrinter:
|
||||
# noinspection PyUnusedLocal
|
||||
@gcode_executor.register_no_data("M115")
|
||||
def _report_firmware_info(self) -> bool:
|
||||
# wait for connection to be established before sending back firmware info
|
||||
while self.bambu_client.connected is False:
|
||||
time.sleep(1)
|
||||
self.sendIO("Bambu Printer Integration")
|
||||
self.sendIO("Cap:AUTOREPORT_SD_STATUS:1")
|
||||
self.sendIO("Cap:AUTOREPORT_TEMP:1")
|
||||
@ -681,7 +685,7 @@ class BambuVirtualPrinter:
|
||||
self._state_change_queue.join()
|
||||
|
||||
def _printer_worker(self):
|
||||
self._create_client_connection_async()
|
||||
# self._create_client_connection_async()
|
||||
self.sendIO("Printer connection complete")
|
||||
while self._running:
|
||||
try:
|
||||
|
@ -87,7 +87,7 @@ class CachedFileView:
|
||||
def _get_file_by_stem_cached(self, file_stem: str, allowed_suffixes: list[str]):
|
||||
for file_path_str in list(self._file_data_cache.keys()) + list(self._file_alias_cache.keys()):
|
||||
file_path = Path(file_path_str)
|
||||
if file_stem == file_path.with_suffix("").stem and all(
|
||||
if file_stem == file_path.with_suffix("").stem and any(
|
||||
suffix in allowed_suffixes for suffix in file_path.suffixes
|
||||
):
|
||||
return self.get_file_data_cached(file_path)
|
||||
|
@ -23,7 +23,7 @@ class BambuCloud:
|
||||
url = 'https://api.bambulab.cn/v1/user-service/user/login'
|
||||
else:
|
||||
url = 'https://api.bambulab.com/v1/user-service/user/login'
|
||||
headers = {'User-Agent' : "HA Bambulab"}
|
||||
headers = {'User-Agent' : "OctoPrint Plugin"}
|
||||
data = {'account': self._email, 'password': self._password}
|
||||
with httpx.Client(http2=True) as client:
|
||||
response = client.post(url, headers=headers, json=data, timeout=10)
|
||||
@ -105,7 +105,7 @@ class BambuCloud:
|
||||
url = 'https://api.bambulab.cn/v1/iot-service/api/user/bind'
|
||||
else:
|
||||
url = 'https://api.bambulab.com/v1/iot-service/api/user/bind'
|
||||
headers = {'Authorization': 'Bearer ' + self._auth_token, 'User-Agent' : "HA Bambulab"}
|
||||
headers = {'Authorization': 'Bearer ' + self._auth_token, 'User-Agent' : "OctoPrint Plugin"}
|
||||
with httpx.Client(http2=True) as client:
|
||||
response = client.get(url, headers=headers, timeout=10)
|
||||
if response.status_code >= 400:
|
||||
@ -186,7 +186,7 @@ class BambuCloud:
|
||||
url = 'https://api.bambulab.cn/v1/iot-service/api/slicer/setting?version=undefined'
|
||||
else:
|
||||
url = 'https://api.bambulab.com/v1/iot-service/api/slicer/setting?version=undefined'
|
||||
headers = {'Authorization': 'Bearer ' + self._auth_token, 'User-Agent' : "HA Bambulab"}
|
||||
headers = {'Authorization': 'Bearer ' + self._auth_token, 'User-Agent' : "OctoPrint Plugin"}
|
||||
with httpx.Client(http2=True) as client:
|
||||
response = client.get(url, headers=headers, timeout=10)
|
||||
if response.status_code >= 400:
|
||||
@ -241,7 +241,7 @@ class BambuCloud:
|
||||
url = 'https://api.bambulab.cn/v1/user-service/my/tasks'
|
||||
else:
|
||||
url = 'https://api.bambulab.com/v1/user-service/my/tasks'
|
||||
headers = {'Authorization': 'Bearer ' + self._auth_token, 'User-Agent' : "HA Bambulab"}
|
||||
headers = {'Authorization': 'Bearer ' + self._auth_token, 'User-Agent' : "OctoPrint Plugin"}
|
||||
with httpx.Client(http2=True) as client:
|
||||
response = client.get(url, headers=headers, timeout=10)
|
||||
if response.status_code >= 400:
|
||||
|
@ -25,7 +25,7 @@ class IdleState(APrinterState):
|
||||
filesystem_root = (
|
||||
"file:///mnt/sdcard/"
|
||||
if self._printer._settings.get(["device_type"]) in ["X1", "X1C"]
|
||||
else "file:///"
|
||||
else "file:///sdcard/"
|
||||
)
|
||||
|
||||
print_command = {
|
||||
|
2
setup.py
2
setup.py
@ -14,7 +14,7 @@ plugin_package = "octoprint_bambu_printer"
|
||||
plugin_name = "OctoPrint-BambuPrinter"
|
||||
|
||||
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
|
||||
plugin_version = "0.1.8rc2"
|
||||
plugin_version = "0.1.8rc6"
|
||||
|
||||
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
|
||||
# module
|
||||
|
Reference in New Issue
Block a user