added whatsminer get bad boards

This commit is contained in:
UpstreamData
2022-01-26 14:53:51 -07:00
parent 516075db6d
commit 3178083533
6 changed files with 42 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ class BTMiner(BaseMiner):
api = BTMinerAPI(ip)
self.model = None
super().__init__(ip, api)
self.nominal_chips = 66
def __repr__(self) -> str:
return f"BTMiner: {str(self.ip)}"
@@ -28,3 +29,31 @@ class BTMiner(BaseMiner):
return host_data["Msg"]["hostname"]
except APIError:
return "?"
async def get_board_info(self) -> dict:
"""Gets data on each board and chain in the miner."""
devs = await self.api.devs()
if not devs.get("DEVS"):
print("devs error", devs)
return {0: [], 1: [], 2: []}
devs = devs["DEVS"]
boards = {}
offset = devs[0]["ID"]
for board in devs:
boards[board["ID"] - offset] = []
if "Effective Chips" in board.keys():
if not board['Effective Chips'] in self.nominal_chips:
nominal = False
else:
nominal = True
boards[board["ID"] - offset].append({
"chain": board["ID"] - offset,
"chip_count": board['Effective Chips'],
"chip_status": "o" * board['Effective Chips'],
"nominal": nominal
})
else:
print(board)
return boards