added whatsminer get bad boards
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user