bug: fix some of the issues with bitaxe.
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
from pyasic.config.base import MinerConfigOption, MinerConfigValue
|
from pyasic.config.base import MinerConfigOption, MinerConfigValue
|
||||||
|
|||||||
@@ -10,23 +10,31 @@ BITAXE_DATA_LOC = DataLocations(
|
|||||||
**{
|
**{
|
||||||
str(DataOptions.HASHRATE): DataFunction(
|
str(DataOptions.HASHRATE): DataFunction(
|
||||||
"_get_hashrate",
|
"_get_hashrate",
|
||||||
[WebAPICommand("web_system_info", "system_info")],
|
[WebAPICommand("web_system_info", "system/info")],
|
||||||
),
|
),
|
||||||
str(DataOptions.WATTAGE): DataFunction(
|
str(DataOptions.WATTAGE): DataFunction(
|
||||||
"_get_wattage",
|
"_get_wattage",
|
||||||
[WebAPICommand("web_system_info", "system_info")],
|
[WebAPICommand("web_system_info", "system/info")],
|
||||||
),
|
),
|
||||||
str(DataOptions.UPTIME): DataFunction(
|
str(DataOptions.UPTIME): DataFunction(
|
||||||
"_get_uptime",
|
"_get_uptime",
|
||||||
[WebAPICommand("web_system_info", "system_info")],
|
[WebAPICommand("web_system_info", "system/info")],
|
||||||
),
|
),
|
||||||
str(DataOptions.HASHBOARDS): DataFunction(
|
str(DataOptions.HASHBOARDS): DataFunction(
|
||||||
"_get_hashboards",
|
"_get_hashboards",
|
||||||
[WebAPICommand("web_system_info", "system_info")],
|
[WebAPICommand("web_system_info", "system/info")],
|
||||||
),
|
),
|
||||||
str(DataOptions.FANS): DataFunction(
|
str(DataOptions.FANS): DataFunction(
|
||||||
"_get_fans",
|
"_get_fans",
|
||||||
[WebAPICommand("web_system_info", "system_info")],
|
[WebAPICommand("web_system_info", "system/info")],
|
||||||
|
),
|
||||||
|
str(DataOptions.FW_VERSION): DataFunction(
|
||||||
|
"_get_fw_ver",
|
||||||
|
[WebAPICommand("web_system_info", "system/info")],
|
||||||
|
),
|
||||||
|
str(DataOptions.API_VERSION): DataFunction(
|
||||||
|
"_get_api_ver",
|
||||||
|
[WebAPICommand("web_system_info", "system/info")],
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -50,10 +58,9 @@ class BitAxe(BaseMiner):
|
|||||||
web_system_info = await self.web.system_info()
|
web_system_info = await self.web.system_info()
|
||||||
except APIError:
|
except APIError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if web_system_info is not None:
|
if web_system_info is not None:
|
||||||
try:
|
try:
|
||||||
return web_system_info["power"]
|
return round(web_system_info["power"])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -101,13 +108,13 @@ class BitAxe(BaseMiner):
|
|||||||
hashrate=AlgoHashRate.SHA256(
|
hashrate=AlgoHashRate.SHA256(
|
||||||
web_system_info["hashRate"], HashUnit.SHA256.GH
|
web_system_info["hashRate"], HashUnit.SHA256.GH
|
||||||
).into(self.algo.unit.default),
|
).into(self.algo.unit.default),
|
||||||
chip_temp=web_system_info["temp"],
|
chip_temp=web_system_info.get("temp"),
|
||||||
temp=web_system_info["vrTemp"],
|
temp=web_system_info.get("vrTemp"),
|
||||||
chips=web_system_info["asicCount"],
|
chips=web_system_info.get("asicCount"),
|
||||||
expected_chips=self.expected_chips,
|
expected_chips=self.expected_chips,
|
||||||
missing=False,
|
missing=False,
|
||||||
active=True,
|
active=True,
|
||||||
voltage=web_system_info["voltage"],
|
voltage=web_system_info.get("voltage"),
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -127,3 +134,42 @@ class BitAxe(BaseMiner):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
async def _get_hostname(self, web_system_info: dict = None) -> Optional[str]:
|
||||||
|
if web_system_info is None:
|
||||||
|
try:
|
||||||
|
web_system_info = await self.web.system_info()
|
||||||
|
except APIError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if web_system_info is not None:
|
||||||
|
try:
|
||||||
|
return web_system_info["hostname"]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def _get_api_ver(self, web_system_info: dict = None) -> Optional[str]:
|
||||||
|
if web_system_info is None:
|
||||||
|
try:
|
||||||
|
web_system_info = await self.web.system_info()
|
||||||
|
except APIError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if web_system_info is not None:
|
||||||
|
try:
|
||||||
|
return web_system_info["version"]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def _get_fw_ver(self, web_system_info: dict = None) -> Optional[str]:
|
||||||
|
if web_system_info is None:
|
||||||
|
try:
|
||||||
|
web_system_info = await self.web.system_info()
|
||||||
|
except APIError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if web_system_info is not None:
|
||||||
|
try:
|
||||||
|
return web_system_info["version"]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ from pyasic.miners.device.makes import BitAxeMake
|
|||||||
class Ultra(BitAxeMake):
|
class Ultra(BitAxeMake):
|
||||||
raw_model = MinerModel.BITAXE.BM1366
|
raw_model = MinerModel.BITAXE.BM1366
|
||||||
|
|
||||||
|
expected_hashboards = 1
|
||||||
expected_chips = 1
|
expected_chips = 1
|
||||||
expected_fans = 1
|
expected_fans = 1
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ from pyasic.miners.device.makes import BitAxeMake
|
|||||||
class Supra(BitAxeMake):
|
class Supra(BitAxeMake):
|
||||||
raw_model = MinerModel.BITAXE.BM1368
|
raw_model = MinerModel.BITAXE.BM1368
|
||||||
|
|
||||||
|
expected_hashboards = 1
|
||||||
expected_chips = 1
|
expected_chips = 1
|
||||||
expected_fans = 1
|
expected_fans = 1
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ from pyasic.miners.device.makes import BitAxeMake
|
|||||||
class Max(BitAxeMake):
|
class Max(BitAxeMake):
|
||||||
raw_model = MinerModel.BITAXE.BM1397
|
raw_model = MinerModel.BITAXE.BM1397
|
||||||
|
|
||||||
|
expected_hashboards = 1
|
||||||
expected_chips = 1
|
expected_chips = 1
|
||||||
expected_fans = 1
|
expected_fans = 1
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class BitAxeWebAPI(BaseWebAPI):
|
|||||||
privileged: bool = False,
|
privileged: bool = False,
|
||||||
**parameters: Any,
|
**parameters: Any,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
url = f"http://{self.ip}:{self.port}/{command}"
|
url = f"http://{self.ip}:{self.port}/api/{command}"
|
||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient(
|
async with httpx.AsyncClient(
|
||||||
transport=settings.transport(),
|
transport=settings.transport(),
|
||||||
@@ -44,7 +44,7 @@ class BitAxeWebAPI(BaseWebAPI):
|
|||||||
async def multicommand(
|
async def multicommand(
|
||||||
self, *commands: str, ignore_errors: bool = False, allow_warning: bool = True
|
self, *commands: str, ignore_errors: bool = False, allow_warning: bool = True
|
||||||
) -> dict:
|
) -> dict:
|
||||||
"""Execute multiple commands simultaneously on the Auradine miner.
|
"""Execute multiple commands simultaneously on the BitAxe miner.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
*commands (str): Commands to execute.
|
*commands (str): Commands to execute.
|
||||||
@@ -76,10 +76,10 @@ class BitAxeWebAPI(BaseWebAPI):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
async def system_info(self):
|
async def system_info(self):
|
||||||
return await self.send_command("api/system/info")
|
return await self.send_command("system/info")
|
||||||
|
|
||||||
async def swarm_info(self):
|
async def swarm_info(self):
|
||||||
return await self.send_command("api/swarm/info")
|
return await self.send_command("swarm/info")
|
||||||
|
|
||||||
async def restart(self):
|
async def restart(self):
|
||||||
return await self.send_command("api/system/restart", post=True)
|
return await self.send_command("system/restart", post=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user