From c8f33aacdd38fa782444b85603d281e1347fffdf Mon Sep 17 00:00:00 2001 From: ohmdelta <64962148+ohmdelta@users.noreply.github.com> Date: Mon, 1 Sep 2025 13:23:54 +0100 Subject: [PATCH] add reboot api --- bambulabs_api/client.py | 10 ++++++++++ bambulabs_api/mqtt_client.py | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/bambulabs_api/client.py b/bambulabs_api/client.py index 159697d..39f776a 100644 --- a/bambulabs_api/client.py +++ b/bambulabs_api/client.py @@ -780,3 +780,13 @@ def wifi_signal(self) -> str: str: Wifi signal """ return self.mqtt_client.wifi_signal() + + def reboot(self) -> bool: + """ + Reboot printer. Warning: this will reboot printer and may require + manual reconnecting. + + Returns: + bool: if printer has been rebooted correctly + """ + return self.mqtt_client.reboot() diff --git a/bambulabs_api/mqtt_client.py b/bambulabs_api/mqtt_client.py index ebe3f43..ffc49f6 100644 --- a/bambulabs_api/mqtt_client.py +++ b/bambulabs_api/mqtt_client.py @@ -1299,3 +1299,20 @@ def wifi_signal(self) -> str: str: Wifi signal """ return self.__get_print("wifi_signal", "") + + def reboot(self) -> bool: + """ + Reboot printer. Warning: this will reboot printer and may require + manual reconnecting. + + Returns: + bool: if printer has been rebooted correctly + """ + logging.warning("Sending reboot command!") + return self.__publish_command( + { + "system": { + "command": "reboot" + } + } + )