Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

Commit 41b4c23

Browse files
authored
Fix API Issue with Bitaxe Miners (#352)
* added checks to identify which field is None. * better logging * if asicCount is None, try to find it in /system/asic * ran pre-commit
1 parent b4687f1 commit 41b4c23

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

pyasic/miners/backends/espminer.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,18 @@ async def _get_expected_hashrate(
115115

116116
if web_system_info is not None:
117117
try:
118-
expected_hashrate = (
119-
web_system_info.get("smallCoreCount")
120-
* web_system_info.get("asicCount")
121-
* web_system_info.get("frequency")
122-
)
118+
small_core_count = web_system_info.get("smallCoreCount")
119+
asic_count = web_system_info.get("asicCount")
120+
frequency = web_system_info.get("frequency")
121+
122+
if asic_count is None:
123+
try:
124+
asic_info = await self.web.asic_info()
125+
asic_count = asic_info.get("asicCount")
126+
except APIError:
127+
pass
128+
129+
expected_hashrate = small_core_count * asic_count * frequency
123130

124131
return self.algo.hashrate(
125132
rate=float(expected_hashrate), unit=self.algo.unit.MH

pyasic/web/espminer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,6 @@ async def restart(self):
9696

9797
async def update_settings(self, **config):
9898
return await self.send_command("system", patch=True, **config)
99+
100+
async def asic_info(self):
101+
return await self.send_command("system/asic")

0 commit comments

Comments
 (0)