feature: add AntminerModern serial numbers to Hashboard data.
This commit is contained in:
@@ -263,6 +263,12 @@ If you are sure you want to use this command please use API.send_command("{comma
|
|||||||
else:
|
else:
|
||||||
return False, data["STATUS"][0]["Msg"]
|
return False, data["STATUS"][0]["Msg"]
|
||||||
|
|
||||||
|
elif isinstance(data["STATUS"], dict):
|
||||||
|
# new style X19 command
|
||||||
|
if data["STATUS"]["STATUS"] not in ["S", "I"]:
|
||||||
|
return False, data["STATUS"]["Msg"]
|
||||||
|
return True, None
|
||||||
|
|
||||||
if data["STATUS"] not in ["S", "I"]:
|
if data["STATUS"] not in ["S", "I"]:
|
||||||
return False, data["Msg"]
|
return False, data["Msg"]
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class HashBoard:
|
|||||||
chip_temp: int = None
|
chip_temp: int = None
|
||||||
chips: int = None
|
chips: int = None
|
||||||
expected_chips: int = None
|
expected_chips: int = None
|
||||||
|
serial_number: str = None
|
||||||
missing: bool = True
|
missing: bool = True
|
||||||
|
|
||||||
def get(self, __key: str, default: Any = None):
|
def get(self, __key: str, default: Any = None):
|
||||||
|
|||||||
@@ -52,9 +52,7 @@ ANTMINER_MODERN_DATA_LOC = DataLocations(
|
|||||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||||
"get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
"get_expected_hashrate", [RPCAPICommand("api_stats", "stats")]
|
||||||
),
|
),
|
||||||
str(DataOptions.HASHBOARDS): DataFunction(
|
str(DataOptions.HASHBOARDS): DataFunction("get_hashboards", []),
|
||||||
"get_hashboards", [RPCAPICommand("api_stats", "stats")]
|
|
||||||
),
|
|
||||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("get_env_temp"),
|
str(DataOptions.ENVIRONMENT_TEMP): DataFunction("get_env_temp"),
|
||||||
str(DataOptions.WATTAGE): DataFunction("get_wattage"),
|
str(DataOptions.WATTAGE): DataFunction("get_wattage"),
|
||||||
str(DataOptions.WATTAGE_LIMIT): DataFunction("get_wattage_limit"),
|
str(DataOptions.WATTAGE_LIMIT): DataFunction("get_wattage_limit"),
|
||||||
@@ -196,6 +194,42 @@ class AntminerModern(BMMiner):
|
|||||||
pass
|
pass
|
||||||
return errors
|
return errors
|
||||||
|
|
||||||
|
async def get_hashboards(self) -> List[HashBoard]:
|
||||||
|
hashboards = [
|
||||||
|
HashBoard(idx, expected_chips=self.expected_chips)
|
||||||
|
for idx in range(self.expected_hashboards)
|
||||||
|
]
|
||||||
|
|
||||||
|
try:
|
||||||
|
api_stats = await self.api.send_command("stats", new_api=True)
|
||||||
|
except APIError:
|
||||||
|
return hashboards
|
||||||
|
|
||||||
|
if api_stats:
|
||||||
|
try:
|
||||||
|
for board in api_stats["STATS"][0]["chain"]:
|
||||||
|
hashboards[board["index"]].hashrate = round(
|
||||||
|
board["rate_real"] / 1000, 2
|
||||||
|
)
|
||||||
|
hashboards[board["index"]].chips = board["asic_num"]
|
||||||
|
board_temp_data = list(
|
||||||
|
filter(lambda x: not x == 0, board["temp_pcb"])
|
||||||
|
)
|
||||||
|
hashboards[board["index"]].temp = sum(board_temp_data) / len(
|
||||||
|
board_temp_data
|
||||||
|
)
|
||||||
|
chip_temp_data = list(
|
||||||
|
filter(lambda x: not x == 0, board["temp_chip"])
|
||||||
|
)
|
||||||
|
hashboards[board["index"]].chip_temp = sum(chip_temp_data) / len(
|
||||||
|
chip_temp_data
|
||||||
|
)
|
||||||
|
hashboards[board["index"]].serial_number = board["sn"]
|
||||||
|
hashboards[board["index"]].missing = False
|
||||||
|
except LookupError:
|
||||||
|
pass
|
||||||
|
return hashboards
|
||||||
|
|
||||||
async def get_fault_light(self, web_get_blink_status: dict = None) -> bool:
|
async def get_fault_light(self, web_get_blink_status: dict = None) -> bool:
|
||||||
if self.light:
|
if self.light:
|
||||||
return self.light
|
return self.light
|
||||||
|
|||||||
Reference in New Issue
Block a user