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
This commit is contained in:
Brody
2025-07-10 10:56:22 -06:00
committed by GitHub
parent b4687f18fd
commit 41b4c23d45
2 changed files with 15 additions and 5 deletions

View File

@@ -115,11 +115,18 @@ class ESPMiner(BaseMiner):
if web_system_info is not None: if web_system_info is not None:
try: try:
expected_hashrate = ( small_core_count = web_system_info.get("smallCoreCount")
web_system_info.get("smallCoreCount") asic_count = web_system_info.get("asicCount")
* web_system_info.get("asicCount") frequency = web_system_info.get("frequency")
* web_system_info.get("frequency")
) if asic_count is None:
try:
asic_info = await self.web.asic_info()
asic_count = asic_info.get("asicCount")
except APIError:
pass
expected_hashrate = small_core_count * asic_count * frequency
return self.algo.hashrate( return self.algo.hashrate(
rate=float(expected_hashrate), unit=self.algo.unit.MH rate=float(expected_hashrate), unit=self.algo.unit.MH

View File

@@ -96,3 +96,6 @@ class ESPMinerWebAPI(BaseWebAPI):
async def update_settings(self, **config): async def update_settings(self, **config):
return await self.send_command("system", patch=True, **config) return await self.send_command("system", patch=True, **config)
async def asic_info(self):
return await self.send_command("system/asic")