added avalon1 1066 to board util tentatively

This commit is contained in:
UpstreamData
2022-05-06 09:11:08 -06:00
parent 93912a6df6
commit b7b589802f

View File

@@ -7,6 +7,7 @@ class CGMinerAvalon10(CGMiner):
super().__init__(ip)
self.model = "Avalon 10"
self.api_type = "CGMiner"
self.nominal_chips = 114
async def get_hostname(self):
try:
@@ -22,3 +23,39 @@ class CGMinerAvalon10(CGMiner):
return "?"
logging.warning(f"Failed to get hostname for miner: {self}")
return "?"
async def get_board_info(self):
boards_chips = 0
logging.debug(f"{self}: Getting board info.")
stats = await self.api.stats()
if not stats.get("STATS") and not stats.get("STATS") == []:
print("stats error", stats)
return {0: [], 1: [], 2: []}
stats = stats["STATS"][0]
for key in stats.keys():
if key.startswith("MM") and not stats[key] == 1:
data = stats[key]
for line in data.split("]"):
if "TA[" in line:
total_chips = line.replace("TA[", "")
boards_chips = round(int(total_chips)/3)
boards = {}
for board in [0, 1, 2]:
if not boards_chips == self.nominal_chips:
nominal = False
else:
nominal = True
boards[board] = []
boards[board].append({
"chain": board,
"chip_count": boards_chips,
"chip_status": "o" * boards_chips,
"nominal": nominal,
})
return boards