From 41b4c23d4524fde913d4b800fc1649644a4ec3e2 Mon Sep 17 00:00:00 2001 From: Brody <80214001+lurkny@users.noreply.github.com> Date: Thu, 10 Jul 2025 10:56:22 -0600 Subject: [PATCH] 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 --- pyasic/miners/backends/espminer.py | 17 ++++++++++++----- pyasic/web/espminer.py | 3 +++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pyasic/miners/backends/espminer.py b/pyasic/miners/backends/espminer.py index d3826a5f..0b54b9f7 100644 --- a/pyasic/miners/backends/espminer.py +++ b/pyasic/miners/backends/espminer.py @@ -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 diff --git a/pyasic/web/espminer.py b/pyasic/web/espminer.py index aa33ffb9..8ce1b5de 100644 --- a/pyasic/web/espminer.py +++ b/pyasic/web/espminer.py @@ -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")