Added upgraderun in rpc/luxminer

This commit is contained in:
1e9abhi1e10
2024-08-21 01:06:50 +05:30
parent b957aa7fba
commit 6fdd156fa3
2 changed files with 14 additions and 15 deletions

View File

@@ -152,25 +152,15 @@ class LUXMiner(LuxOSFirmware):
Upgrade the firmware on a LuxOS miner by calling the 'updaterun' API command.
Returns: Result of the upgrade process.
"""
command = "updaterun"
try:
response = await self.rpc.send_command(command=command)
response = await self.rpc.upgraderun()
if not response:
raise ValueError("No response received during the firmware upgrade process.")
logging.info(f"{self.ip}: Firmware upgrade initiated successfully.")
return response
if response.get("status") == "success":
logging.info(f"{self.ip}: Firmware upgrade initiated successfully.")
return "Firmware upgrade completed successfully."
else:
logging.error(f"{self.ip}: Firmware upgrade failed. Response: {response}")
raise ValueError(f"Firmware upgrade failed. Response: {response}")
except Exception as e:
logging.error(f"An error occurred during the firmware upgrade process: {e}", exc_info=True)
except APIError as e:
logging.error(f"{self.ip}: Firmware upgrade failed: {e}")
raise
##################################################

View File

@@ -749,3 +749,12 @@ class LUXMinerRPCAPI(BaseMinerRPCAPI):
</details>
"""
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")