bug: fix T9+ support.

This commit is contained in:
UpstreamData
2023-04-13 14:09:05 -06:00
parent 9c4c8503d6
commit 05e82b85c5
4 changed files with 16 additions and 7 deletions

View File

@@ -29,7 +29,7 @@ from pyasic.miners.base import BaseMiner
BMMINER_DATA_LOC = {
"mac": {"cmd": "get_mac", "kwargs": {}},
"model": {"cmd": "get_model", "kwargs": {"api_devdetails": {"api": "devdetails"}}},
"model": {"cmd": "get_model", "kwargs": {}},
"api_ver": {"cmd": "get_api_ver", "kwargs": {"api_version": {"api": "version"}}},
"fw_ver": {"cmd": "get_fw_ver", "kwargs": {"api_version": {"api": "version"}}},
"hostname": {"cmd": "get_hostname", "kwargs": {}},

View File

@@ -14,6 +14,8 @@
# limitations under the License. -
# ------------------------------------------------------------------------------
from typing import Optional
from pyasic.miners.backends import BMMiner
@@ -22,3 +24,6 @@ class Hiveon(BMMiner):
super().__init__(ip, api_ver)
# static data
self.api_type = "Hiveon"
async def get_model(self) -> Optional[str]:
return self.model + " (Hiveon)"

View File

@@ -58,8 +58,8 @@ class VNish(BMMiner):
# data gathering locations
self.data_locations = VNISH_DATA_LOC
async def get_model(self, api_stats: dict = None) -> Optional[str]:
return self.model + "(VNISH)"
async def get_model(self) -> Optional[str]:
return self.model + " (VNISH)"
async def restart_backend(self) -> bool:
data = await self.web.restart_vnish()

View File

@@ -42,7 +42,7 @@ class HiveonT9(Hiveon, T9):
.upper()
)
return mac
except (TypeError, ValueError, asyncssh.Error, OSError):
except (TypeError, ValueError, asyncssh.Error, OSError, AttributeError):
pass
async def get_hashboards(self, api_stats: dict = None) -> List[HashBoard]:
@@ -62,13 +62,17 @@ class HiveonT9(Hiveon, T9):
try:
hashboard.board_temp = api_stats["STATS"][1][f"temp{chipset}"]
hashboard.chip_temp = api_stats["STATS"][1][f"temp2_{chipset}"]
hashrate += api_stats["STATS"][1][f"chain_rate{chipset}"]
chips += api_stats["STATS"][1][f"chain_acn{chipset}"]
except (KeyError, IndexError):
pass
else:
hashboard.missing = False
hashboard.hashrate = hashrate
try:
hashrate += api_stats["STATS"][1][f"chain_rate{chipset}"]
chips += api_stats["STATS"][1][f"chain_acn{chipset}"]
print(chips)
except (KeyError, IndexError):
pass
hashboard.hashrate = round(hashrate / 1000, 2)
hashboard.chips = chips
hashboards.append(hashboard)