Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2e1d2f2fd | ||
|
|
dd205c0f06 | ||
|
|
79e247c0cf | ||
|
|
836d045b65 |
@@ -38,6 +38,8 @@ class TemperatureConfig(MinerConfigValue):
|
||||
temp_cfg["hot_temp"] = self.hot
|
||||
if self.danger is not None:
|
||||
temp_cfg["dangerous_temp"] = self.danger
|
||||
if len(temp_cfg) == 0:
|
||||
return {}
|
||||
return {"temp_control": temp_cfg}
|
||||
|
||||
def as_epic(self) -> dict:
|
||||
@@ -67,6 +69,7 @@ class TemperatureConfig(MinerConfigValue):
|
||||
hot=temp_control.get("hot_temp"),
|
||||
danger=temp_control.get("dangerous_temp"),
|
||||
)
|
||||
return cls()
|
||||
|
||||
@classmethod
|
||||
def from_epic(cls, web_conf: dict) -> "TemperatureConfig":
|
||||
|
||||
@@ -176,11 +176,14 @@ class BOSMiner(BaseMiner):
|
||||
self.config = cfg
|
||||
except toml.TomlDecodeError as e:
|
||||
raise APIError("Failed to decode toml when getting config.") from e
|
||||
except TypeError as e:
|
||||
raise APIError("Failed to decode toml when getting config.") from e
|
||||
|
||||
return self.config
|
||||
|
||||
async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None:
|
||||
self.config = config
|
||||
print(config)
|
||||
parsed_cfg = config.as_bosminer(user_suffix=user_suffix)
|
||||
|
||||
toml_conf = toml.dumps(
|
||||
|
||||
@@ -32,6 +32,10 @@ class MinerNetwork:
|
||||
|
||||
def __init__(self, hosts: List[ipaddress.IPv4Address]):
|
||||
self.hosts = hosts
|
||||
semaphore_limit = settings.get("network_scan_semaphore", 255)
|
||||
if semaphore_limit is None:
|
||||
semaphore_limit = 255
|
||||
self.semaphore = asyncio.Semaphore(semaphore_limit)
|
||||
|
||||
def __len__(self):
|
||||
return len(self.hosts)
|
||||
@@ -153,8 +157,16 @@ class MinerNetwork:
|
||||
except TimeoutError:
|
||||
yield None
|
||||
|
||||
async def ping_and_get_miner(
|
||||
self, ip: ipaddress.ip_address
|
||||
) -> Union[None, AnyMiner]:
|
||||
if settings.get("network_scan_semaphore") is None:
|
||||
return await self._ping_and_get_miner(ip)
|
||||
async with self.semaphore:
|
||||
return await self._ping_and_get_miner(ip)
|
||||
|
||||
@staticmethod
|
||||
async def ping_and_get_miner(ip: ipaddress.ip_address) -> Union[None, AnyMiner]:
|
||||
async def _ping_and_get_miner(ip: ipaddress.ip_address) -> Union[None, AnyMiner]:
|
||||
try:
|
||||
return await ping_and_get_miner(ip)
|
||||
except ConnectionRefusedError:
|
||||
|
||||
@@ -24,6 +24,7 @@ from httpx import AsyncHTTPTransport
|
||||
_settings = { # defaults
|
||||
"network_ping_retries": 1,
|
||||
"network_ping_timeout": 3,
|
||||
"network_scan_semaphore": None,
|
||||
"factory_get_retries": 1,
|
||||
"factory_get_timeout": 3,
|
||||
"get_data_retries": 1,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "pyasic"
|
||||
version = "0.55.1"
|
||||
version = "0.55.3"
|
||||
description = "A simplified and standardized interface for Bitcoin ASICs."
|
||||
authors = ["UpstreamData <brett@upstreamdata.ca>"]
|
||||
repository = "https://github.com/UpstreamData/pyasic"
|
||||
|
||||
Reference in New Issue
Block a user