bug: fix some cases where Antminer online status couldnt be parsed
Re: #206
This commit is contained in:
@@ -14,9 +14,9 @@
|
|||||||
# limitations under the License. -
|
# limitations under the License. -
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
from typing import List, Optional, Union
|
|
||||||
from pathlib import Path
|
|
||||||
import logging
|
import logging
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import List, Optional, Union
|
||||||
|
|
||||||
from pyasic.config import MinerConfig, MiningModeConfig
|
from pyasic.config import MinerConfig, MiningModeConfig
|
||||||
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
from pyasic.data import AlgoHashRate, Fan, HashBoard, HashUnit
|
||||||
@@ -141,17 +141,24 @@ class AntminerModern(BMMiner):
|
|||||||
raise ValueError("File location must be provided for firmware upgrade.")
|
raise ValueError("File location must be provided for firmware upgrade.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = await self.web.update_firmware(file=file, keep_settings=keep_settings)
|
result = await self.web.update_firmware(
|
||||||
|
file=file, keep_settings=keep_settings
|
||||||
|
)
|
||||||
|
|
||||||
if result.get("success"):
|
if result.get("success"):
|
||||||
logging.info("Firmware upgrade process completed successfully for AntMiner.")
|
logging.info(
|
||||||
|
"Firmware upgrade process completed successfully for AntMiner."
|
||||||
|
)
|
||||||
return "Firmware upgrade completed successfully."
|
return "Firmware upgrade completed successfully."
|
||||||
else:
|
else:
|
||||||
error_message = result.get("message", "Unknown error")
|
error_message = result.get("message", "Unknown error")
|
||||||
logging.error(f"Firmware upgrade failed. Response: {error_message}")
|
logging.error(f"Firmware upgrade failed. Response: {error_message}")
|
||||||
return f"Firmware upgrade failed. Response: {error_message}"
|
return f"Firmware upgrade failed. Response: {error_message}"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"An error occurred during the firmware upgrade process: {e}", exc_info=True)
|
logging.error(
|
||||||
|
f"An error occurred during the firmware upgrade process: {e}",
|
||||||
|
exc_info=True,
|
||||||
|
)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
async def fault_light_on(self) -> bool:
|
async def fault_light_on(self) -> bool:
|
||||||
@@ -367,7 +374,7 @@ class AntminerModern(BMMiner):
|
|||||||
|
|
||||||
if web_get_conf is not None:
|
if web_get_conf is not None:
|
||||||
try:
|
try:
|
||||||
if web_get_conf["bitmain-work-mode"].isdigit():
|
if str(web_get_conf["bitmain-work-mode"]).isdigit():
|
||||||
return (
|
return (
|
||||||
False if int(web_get_conf["bitmain-work-mode"]) == 1 else True
|
False if int(web_get_conf["bitmain-work-mode"]) == 1 else True
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user