Compare commits

...

7 Commits

Author SHA1 Message Date
Brett Rowan
d40d92c1ca version: bump version number. 2024-05-28 21:46:41 -06:00
Brett Rowan
7ea63643a9 bug: fix a bunch of spelling mistakes. 2024-05-28 21:46:13 -06:00
upstreamdata
313c324771 bug: fix into naming on vnish with expected hashrate. 2024-05-27 15:57:06 -06:00
upstreamdata
a9fd9343d8 feature: add vnish fault light. 2024-05-26 21:59:59 -06:00
upstreamdata
8f41d4d0bc bug: fix MRO with vnish. 2024-05-26 21:59:57 -06:00
Brett Rowan
6f10c91482 Merge pull request #150 from UpstreamData/snyk-fix-c1d73ce3e71f8a7a86f4d2be00564ee4 2024-05-25 09:00:39 -06:00
snyk-bot
f2d6bce165 fix: docs/requirements.txt to reduce vulnerabilities
The following vulnerabilities are fixed by pinning transitive dependencies:
- https://snyk.io/vuln/SNYK-PYTHON-JINJA2-6809379
2024-05-25 02:29:08 +00:00
14 changed files with 70 additions and 11 deletions

View 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

View 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

View File

@@ -18,3 +18,4 @@ from .X3 import *
from .X7 import *
from .X17 import *
from .X19 import *
from .X21 import *

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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()

View File

@@ -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

View File

@@ -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)

View File

@@ -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"