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:
@@ -115,11 +115,18 @@ class ESPMiner(BaseMiner):
|
||||
|
||||
if web_system_info is not None:
|
||||
try:
|
||||
expected_hashrate = (
|
||||
web_system_info.get("smallCoreCount")
|
||||
* web_system_info.get("asicCount")
|
||||
* web_system_info.get("frequency")
|
||||
)
|
||||
small_core_count = web_system_info.get("smallCoreCount")
|
||||
asic_count = web_system_info.get("asicCount")
|
||||
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(
|
||||
rate=float(expected_hashrate), unit=self.algo.unit.MH
|
||||
|
||||
@@ -96,3 +96,6 @@ class ESPMinerWebAPI(BaseWebAPI):
|
||||
|
||||
async def update_settings(self, **config):
|
||||
return await self.send_command("system", patch=True, **config)
|
||||
|
||||
async def asic_info(self):
|
||||
return await self.send_command("system/asic")
|
||||
|
||||
Reference in New Issue
Block a user