Merge pull request #189 from 1e9abhi1e10/luxminer_firmware
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
import logging
|
||||||
|
|
||||||
from pyasic.config import MinerConfig
|
from pyasic.config import MinerConfig
|
||||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||||
@@ -146,6 +147,22 @@ class LUXMiner(LuxOSFirmware):
|
|||||||
async def get_config(self) -> MinerConfig:
|
async def get_config(self) -> MinerConfig:
|
||||||
return self.config
|
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}) ###
|
### DATA GATHERING FUNCTIONS (get_{some_data}) ###
|
||||||
##################################################
|
##################################################
|
||||||
|
|||||||
@@ -749,3 +749,12 @@ class LUXMinerRPCAPI(BaseMinerRPCAPI):
|
|||||||
</details>
|
</details>
|
||||||
"""
|
"""
|
||||||
return await self.send_command("wakeup", parameters=session_id)
|
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")
|
||||||
Reference in New Issue
Block a user