diff --git a/pyasic/miners/backends/luxminer.py b/pyasic/miners/backends/luxminer.py index abaa3664..be0c15f0 100644 --- a/pyasic/miners/backends/luxminer.py +++ b/pyasic/miners/backends/luxminer.py @@ -14,6 +14,7 @@ # limitations under the License. - # ------------------------------------------------------------------------------ from typing import List, Optional +import logging from pyasic.config import MinerConfig from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit @@ -146,6 +147,22 @@ class LUXMiner(LuxOSFirmware): async def get_config(self) -> MinerConfig: return self.config + async def upgrade_firmware(self) -> bool: + """ + Upgrade the firmware on a LuxOS miner by calling the 'updaterun' API command. + Returns: + bool: True if the firmware upgrade was successfully initiated, False otherwise. + """ + try: + await self.rpc.upgraderun() + logging.info(f"{self.ip}: Firmware upgrade initiated successfully.") + return True + + except APIError as e: + logging.error(f"{self.ip}: Firmware upgrade failed: {e}") + + return False + ################################################## ### DATA GATHERING FUNCTIONS (get_{some_data}) ### ################################################## diff --git a/pyasic/rpc/luxminer.py b/pyasic/rpc/luxminer.py index cb58cab3..37bfb0be 100644 --- a/pyasic/rpc/luxminer.py +++ b/pyasic/rpc/luxminer.py @@ -749,3 +749,12 @@ class LUXMinerRPCAPI(BaseMinerRPCAPI): """ return await self.send_command("wakeup", parameters=session_id) + + async def upgraderun(self): + """ + Send the 'updaterun' command to the miner. + + Returns: + The response from the miner after sending the 'updaterun' command. + """ + return await self.send_command("updaterun") \ No newline at end of file