Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d40d92c1ca | ||
|
|
7ea63643a9 | ||
|
|
313c324771 | ||
|
|
a9fd9343d8 | ||
|
|
8f41d4d0bc | ||
|
|
6f10c91482 | ||
|
|
f2d6bce165 |
22
pyasic/miners/antminer/vnish/X21/S21.py
Normal file
22
pyasic/miners/antminer/vnish/X21/S21.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright 2022 Upstream Data Inc -
|
||||
# -
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||
# you may not use this file except in compliance with the License. -
|
||||
# You may obtain a copy of the License at -
|
||||
# -
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||
# -
|
||||
# Unless required by applicable law or agreed to in writing, software -
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
from pyasic.miners.backends import VNish
|
||||
from pyasic.miners.device.models import S21
|
||||
|
||||
|
||||
class VNishS21(VNish, S21):
|
||||
pass
|
||||
17
pyasic/miners/antminer/vnish/X21/__init__.py
Normal file
17
pyasic/miners/antminer/vnish/X21/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright 2022 Upstream Data Inc -
|
||||
# -
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||
# you may not use this file except in compliance with the License. -
|
||||
# You may obtain a copy of the License at -
|
||||
# -
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||
# -
|
||||
# Unless required by applicable law or agreed to in writing, software -
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
from .S21 import VNishS21
|
||||
@@ -18,3 +18,4 @@ from .X3 import *
|
||||
from .X7 import *
|
||||
from .X17 import *
|
||||
from .X19 import *
|
||||
from .X21 import *
|
||||
|
||||
@@ -275,7 +275,7 @@ class AntminerModern(BMMiner):
|
||||
rate_unit = "GH"
|
||||
return AlgoHashRate.SHA256(
|
||||
expected_rate, HashUnit.SHA256.from_str(rate_unit)
|
||||
).int(self.algo.unit.default)
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ class AvalonMiner(CGMiner):
|
||||
parsed_stats = self.parse_stats(unparsed_stats)
|
||||
return AlgoHashRate.SHA256(
|
||||
parsed_stats["GHSmm"], HashUnit.SHA256.GH
|
||||
).int(self.algo.unit.default)
|
||||
).into(self.algo.unit.default)
|
||||
except (IndexError, KeyError, ValueError, TypeError):
|
||||
pass
|
||||
|
||||
|
||||
@@ -224,6 +224,6 @@ class BFGMiner(StockFirmware):
|
||||
rate_unit = "GH"
|
||||
return AlgoHashRate.SHA256(
|
||||
expected_rate, HashUnit.SHA256.from_str(rate_unit)
|
||||
).int(self.algo.unit.default)
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
@@ -240,7 +240,7 @@ class BMMiner(StockFirmware):
|
||||
rate_unit = "GH"
|
||||
return AlgoHashRate.SHA256(
|
||||
expected_rate, HashUnit.SHA256.from_str(rate_unit)
|
||||
).int(self.algo.unit.default)
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
|
||||
@@ -575,7 +575,7 @@ class BTMiner(StockFirmware):
|
||||
if expected_hashrate:
|
||||
return AlgoHashRate.SHA256(
|
||||
expected_hashrate, HashUnit.SHA256.GH
|
||||
).int(self.algo.unit.default)
|
||||
).into(self.algo.unit.default)
|
||||
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
@@ -279,7 +279,7 @@ class LUXMiner(LuxOSFirmware):
|
||||
rate_unit = "GH"
|
||||
return AlgoHashRate.SHA256(
|
||||
expected_rate, HashUnit.SHA256.from_str(rate_unit)
|
||||
).int(self.algo.unit.default)
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ class MaraMiner(MaraFirmware):
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
web_brief["hashrate_ideal"], HashUnit.SHA256.GH
|
||||
).int(self.algo.unit.default)
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ VNISH_DATA_LOC = DataLocations(
|
||||
)
|
||||
|
||||
|
||||
class VNish(BMMiner, VNishFirmware):
|
||||
class VNish(VNishFirmware, BMMiner):
|
||||
"""Handler for VNish miners"""
|
||||
|
||||
_web_cls = VNishWebAPI
|
||||
@@ -147,6 +147,22 @@ class VNish(BMMiner, VNishFirmware):
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
async def fault_light_off(self) -> bool:
|
||||
result = await self.web.find_miner()
|
||||
if result is not None:
|
||||
if result.get("on") is False:
|
||||
return True
|
||||
else:
|
||||
await self.web.find_miner()
|
||||
|
||||
async def fault_light_on(self) -> bool:
|
||||
result = await self.web.find_miner()
|
||||
if result is not None:
|
||||
if result.get("on") is True:
|
||||
return True
|
||||
else:
|
||||
await self.web.find_miner()
|
||||
|
||||
async def _get_hostname(self, web_summary: dict = None) -> str:
|
||||
if web_summary is None:
|
||||
web_info = await self.web.info()
|
||||
|
||||
@@ -384,6 +384,7 @@ MINER_CLASSES = {
|
||||
"ANTMINER S19A": VNishS19a,
|
||||
"ANTMINER S19A PRO": VNishS19aPro,
|
||||
"ANTMINER T19": VNishT19,
|
||||
"ANTMINER S21": VNishS21,
|
||||
},
|
||||
MinerTypes.EPIC: {
|
||||
None: ePIC,
|
||||
@@ -530,7 +531,6 @@ class MinerFactory:
|
||||
miner_type=miner_type,
|
||||
miner_model=miner_model,
|
||||
)
|
||||
|
||||
return miner
|
||||
|
||||
async def _get_miner_type(self, ip: str) -> MinerTypes | None:
|
||||
@@ -673,7 +673,7 @@ class MinerFactory:
|
||||
return MinerTypes.BRAIINS_OS
|
||||
if "BTMINER" in upper_data or "BITMICRO" in upper_data:
|
||||
return MinerTypes.WHATSMINER
|
||||
if "VNISH" in upper_data:
|
||||
if "VNISH" in upper_data or "DEVICE PATH" in upper_data:
|
||||
return MinerTypes.VNISH
|
||||
if "HIVEON" in upper_data:
|
||||
return MinerTypes.HIVEON
|
||||
|
||||
@@ -140,3 +140,6 @@ class VNishWebAPI(BaseWebAPI):
|
||||
|
||||
async def autotune_presets(self) -> dict:
|
||||
return await self.send_command("autotune/presets")
|
||||
|
||||
async def find_miner(self) -> dict:
|
||||
return await self.send_command("find-miner", privileged=True)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "pyasic"
|
||||
version = "0.57.4"
|
||||
version = "0.57.5"
|
||||
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