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

@@ -115,7 +115,7 @@ class BOSMiner(BaseMiner):
devdetails = await self.api.devdetails()
if not devdetails.get("DEVDETAILS"):
print("devdetails error", devdetails)
return {6: [], 7: [], 8: []}
return {0: [], 1: [], 2: []}
devs = devdetails['DEVDETAILS']
boards = {}
offset = devs[0]["ID"]

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

View File

@@ -219,7 +219,10 @@ class MinerFactory:
else:
# if all that fails, try just version
data = await self._send_api_command(str(ip), "version")
model = data["VERSION"][0]["Type"]
if "VERSION" in data.keys():
model = data["VERSION"][0]["Type"]
else:
print(data)
return model

View File

@@ -4,6 +4,7 @@ from miners.btminer import BTMiner
class BTMinerM21(BTMiner):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.nominal_chips = [105, 66]
def __repr__(self) -> str:
return f"M21 - BTMiner: {str(self.ip)}"

View File

@@ -4,6 +4,7 @@ from miners.btminer import BTMiner
class BTMinerM31(BTMiner):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.nominal_chips = [78]
def __repr__(self) -> str:
return f"M31 - BTMiner: {str(self.ip)}"