Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd9fd81b17 |
@@ -1,11 +1,10 @@
|
||||
ci:
|
||||
skip:
|
||||
- poetry-lock
|
||||
- unittest
|
||||
- generate-docs
|
||||
- pytest
|
||||
repos:
|
||||
- repo: https://github.com/python-poetry/poetry
|
||||
rev: 2.1.1
|
||||
rev: 2.0.1
|
||||
hooks:
|
||||
- id: poetry-check
|
||||
- id: poetry-lock
|
||||
@@ -23,11 +22,11 @@ repos:
|
||||
exclude: ^mkdocs\.yml$
|
||||
- id: check-added-large-files
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 25.1.0
|
||||
rev: 24.10.0
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 6.0.1
|
||||
rev: 5.13.2
|
||||
hooks:
|
||||
- id: isort
|
||||
name: isort (python)
|
||||
@@ -38,12 +37,6 @@ repos:
|
||||
name: unittest
|
||||
entry: python -m unittest discover
|
||||
language: system
|
||||
types: [ python ]
|
||||
'types': [python]
|
||||
args: ["-p '*test.py'"] # Probably this option is absolutely not needed.
|
||||
pass_filenames: false
|
||||
- id: generate-docs
|
||||
name: generate-docs
|
||||
entry: python docs/generate_miners.py
|
||||
language: system
|
||||
types: [ python ]
|
||||
pass_filenames: false
|
||||
|
||||
@@ -2,7 +2,6 @@ import asyncio
|
||||
import importlib
|
||||
import os
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
|
||||
from pyasic.miners.factory import MINER_CLASSES, MinerTypes
|
||||
|
||||
@@ -52,19 +51,12 @@ def backend_str(backend: MinerTypes) -> str:
|
||||
return "Mara Firmware Miners"
|
||||
case MinerTypes.BITAXE:
|
||||
return "Stock Firmware BitAxe Miners"
|
||||
case MinerTypes.LUCKYMINER:
|
||||
return "Stock Firmware Lucky Miners"
|
||||
case MinerTypes.ICERIVER:
|
||||
return "Stock Firmware IceRiver Miners"
|
||||
case MinerTypes.HAMMER:
|
||||
return "Stock Firmware Hammer Miners"
|
||||
case MinerTypes.VOLCMINER:
|
||||
return "Stock Firmware Volcminers"
|
||||
case MinerTypes.ELPHAPEX:
|
||||
return "Stock Firmware Elphapex Miners"
|
||||
case MinerTypes.MSKMINER:
|
||||
return "MSKMiner Firmware Miners"
|
||||
raise TypeError("Unknown miner backend, cannot generate docs")
|
||||
|
||||
|
||||
def create_url_str(mtype: str):
|
||||
@@ -143,14 +135,14 @@ for m in MINER_CLASSES:
|
||||
done.append(miner)
|
||||
|
||||
|
||||
def create_directory_structure(directory, data):
|
||||
async def create_directory_structure(directory, data):
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
|
||||
for key, value in data.items():
|
||||
subdirectory = os.path.join(directory, key)
|
||||
if isinstance(value, dict):
|
||||
create_directory_structure(subdirectory, value)
|
||||
await create_directory_structure(subdirectory, value)
|
||||
elif isinstance(value, list):
|
||||
file_path = os.path.join(subdirectory + ".md")
|
||||
|
||||
@@ -171,7 +163,7 @@ def create_directory_structure(directory, data):
|
||||
)
|
||||
|
||||
|
||||
def create_supported_types(directory):
|
||||
async def create_supported_types(directory):
|
||||
with open(os.path.join(directory, "supported_types.md"), "w") as file:
|
||||
file.write(SUPPORTED_TYPES_HEADER)
|
||||
for mback in MINER_CLASSES:
|
||||
@@ -188,7 +180,7 @@ def create_supported_types(directory):
|
||||
for mtype in backend_types:
|
||||
file.write(MINER_TYPE_HEADER.format(mtype))
|
||||
for minstance in backend_types[mtype]:
|
||||
model = minstance("1.1.1.1").model
|
||||
model = await minstance("1.1.1.1").get_model()
|
||||
file.write(
|
||||
MINER_DETAILS.format(
|
||||
make(minstance), mtype, create_url_str(model), model
|
||||
@@ -198,7 +190,6 @@ def create_supported_types(directory):
|
||||
file.write(BACKEND_TYPE_CLOSER)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
root_directory = Path(__file__).parent.joinpath("miners")
|
||||
create_directory_structure(root_directory, m_data)
|
||||
create_supported_types(root_directory)
|
||||
root_directory = os.path.join(os.getcwd(), "miners")
|
||||
asyncio.run(create_directory_structure(root_directory, m_data))
|
||||
asyncio.run(create_supported_types(root_directory))
|
||||
|
||||
@@ -495,19 +495,6 @@
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
## S19i (VNish)
|
||||
|
||||
- [x] Shutdowns
|
||||
- [ ] Power Modes
|
||||
- [x] Setpoints
|
||||
- [x] Presets
|
||||
|
||||
::: pyasic.miners.antminer.vnish.X19.S19.VNishS19i
|
||||
handler: python
|
||||
options:
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
## S19j (VNish)
|
||||
|
||||
- [x] Shutdowns
|
||||
@@ -703,45 +690,6 @@
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
## S19K Pro (Hive)
|
||||
|
||||
- [ ] Shutdowns
|
||||
- [ ] Power Modes
|
||||
- [ ] Setpoints
|
||||
- [ ] Presets
|
||||
|
||||
::: pyasic.miners.antminer.hiveon.X19.S19.HiveonS19kPro
|
||||
handler: python
|
||||
options:
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
## S19 No PIC (Hive)
|
||||
|
||||
- [ ] Shutdowns
|
||||
- [ ] Power Modes
|
||||
- [ ] Setpoints
|
||||
- [ ] Presets
|
||||
|
||||
::: pyasic.miners.antminer.hiveon.X19.S19.HiveonS19NoPIC
|
||||
handler: python
|
||||
options:
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
## S19 No PIC (Stock)
|
||||
|
||||
- [ ] Shutdowns
|
||||
- [ ] Power Modes
|
||||
- [ ] Setpoints
|
||||
- [ ] Presets
|
||||
|
||||
::: pyasic.miners.antminer.mskminer.X19.S19.MSKMinerS19NoPIC
|
||||
handler: python
|
||||
options:
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
## S19 (LuxOS)
|
||||
|
||||
- [x] Shutdowns
|
||||
|
||||
@@ -14,19 +14,6 @@
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
## S21 Hydro (Stock)
|
||||
|
||||
- [x] Shutdowns
|
||||
- [x] Power Modes
|
||||
- [ ] Setpoints
|
||||
- [ ] Presets
|
||||
|
||||
::: pyasic.miners.antminer.bmminer.X21.S21.BMMinerS21Hydro
|
||||
handler: python
|
||||
options:
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
## S21 Pro (Stock)
|
||||
|
||||
- [x] Shutdowns
|
||||
@@ -66,19 +53,6 @@
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
## S21 Pro (BOS+)
|
||||
|
||||
- [x] Shutdowns
|
||||
- [ ] Power Modes
|
||||
- [x] Setpoints
|
||||
- [ ] Presets
|
||||
|
||||
::: pyasic.miners.antminer.bosminer.X21.S21.BOSMinerS21Pro
|
||||
handler: python
|
||||
options:
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
## T21 (BOS+)
|
||||
|
||||
- [x] Shutdowns
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
# pyasic
|
||||
## A15X Models
|
||||
|
||||
## Avalon 1566 (Stock)
|
||||
|
||||
- [ ] Shutdowns
|
||||
- [ ] Power Modes
|
||||
- [ ] Setpoints
|
||||
- [ ] Presets
|
||||
|
||||
::: pyasic.miners.avalonminer.cgminer.A15X.A1566.CGMinerAvalon1566
|
||||
handler: python
|
||||
options:
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
# pyasic
|
||||
## DGX Models
|
||||
|
||||
## DG1+ (Stock)
|
||||
|
||||
- [ ] Shutdowns
|
||||
- [ ] Power Modes
|
||||
- [ ] Setpoints
|
||||
- [ ] Presets
|
||||
|
||||
::: pyasic.miners.elphapex.daoge.DGX.DG1.ElphapexDG1Plus
|
||||
handler: python
|
||||
options:
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# pyasic
|
||||
## LV Models
|
||||
|
||||
## LV07 (Stock)
|
||||
|
||||
- [ ] Shutdowns
|
||||
- [ ] Power Modes
|
||||
- [ ] Setpoints
|
||||
- [ ] Presets
|
||||
|
||||
::: pyasic.miners.luckyminer.espminer.LV.LV07.LuckyMinerLV07
|
||||
handler: python
|
||||
options:
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
## LV08 (Stock)
|
||||
|
||||
- [ ] Shutdowns
|
||||
- [ ] Power Modes
|
||||
- [ ] Setpoints
|
||||
- [ ] Presets
|
||||
|
||||
::: pyasic.miners.luckyminer.espminer.LV.LV08.LuckyMinerLV08
|
||||
handler: python
|
||||
options:
|
||||
show_root_heading: false
|
||||
heading_level: 0
|
||||
|
||||
@@ -105,7 +105,6 @@ details {
|
||||
<li><a href="../antminer/X21#s21-stock">S21 (Stock)</a></li>
|
||||
<li><a href="../antminer/X21#s21-pro-stock">S21 Pro (Stock)</a></li>
|
||||
<li><a href="../antminer/X21#t21-stock">T21 (Stock)</a></li>
|
||||
<li><a href="../antminer/X21#s21-hydro-stock">S21 Hydro (Stock)</a></li>
|
||||
</ul>
|
||||
</details>
|
||||
</ul>
|
||||
@@ -554,12 +553,6 @@ details {
|
||||
<li><a href="../avalonminer/nano#avalon-nano-3-stock">Avalon Nano 3 (Stock)</a></li>
|
||||
</ul>
|
||||
</details>
|
||||
<details>
|
||||
<summary>A15X Series:</summary>
|
||||
<ul>
|
||||
<li><a href="../avalonminer/A15X#avalon-1566-stock">Avalon 1566 (Stock)</a></li>
|
||||
</ul>
|
||||
</details>
|
||||
</ul>
|
||||
</details>
|
||||
<details>
|
||||
@@ -659,7 +652,6 @@ details {
|
||||
<summary>X21 Series:</summary>
|
||||
<ul>
|
||||
<li><a href="../antminer/X21#s21-bos_1">S21 (BOS+)</a></li>
|
||||
<li><a href="../antminer/X21#s21-pro-bos_1">S21 Pro (BOS+)</a></li>
|
||||
<li><a href="../antminer/X21#t21-bos_1">T21 (BOS+)</a></li>
|
||||
</ul>
|
||||
</details>
|
||||
@@ -702,7 +694,6 @@ details {
|
||||
<li><a href="../antminer/X19#s19-no-pic-vnish">S19 No PIC (VNish)</a></li>
|
||||
<li><a href="../antminer/X19#s19-pro-vnish">S19 Pro (VNish)</a></li>
|
||||
<li><a href="../antminer/X19#s19j-vnish">S19j (VNish)</a></li>
|
||||
<li><a href="../antminer/X19#s19i-vnish">S19i (VNish)</a></li>
|
||||
<li><a href="../antminer/X19#s19j-pro-vnish">S19j Pro (VNish)</a></li>
|
||||
<li><a href="../antminer/X19#s19j-pro-vnish">S19j Pro (VNish)</a></li>
|
||||
<li><a href="../antminer/X19#s19j-pro-vnish">S19j Pro (VNish)</a></li>
|
||||
@@ -769,19 +760,6 @@ details {
|
||||
<ul>
|
||||
<li><a href="../antminer/X19#s19j-pro-hive">S19j Pro (Hive)</a></li>
|
||||
<li><a href="../antminer/X19#s19-hive">S19 (Hive)</a></li>
|
||||
<li><a href="../antminer/X19#s19k-pro-hive">S19K Pro (Hive)</a></li>
|
||||
<li><a href="../antminer/X19#s19-no-pic-hive">S19 No PIC (Hive)</a></li>
|
||||
</ul>
|
||||
</details>
|
||||
</ul>
|
||||
</details>
|
||||
<details>
|
||||
<summary>MSKMiner Firmware Miners:</summary>
|
||||
<ul>
|
||||
<details>
|
||||
<summary>X19 Series:</summary>
|
||||
<ul>
|
||||
<li><a href="../antminer/X19#s19-no-pic-stock">S19 No PIC (Stock)</a></li>
|
||||
</ul>
|
||||
</details>
|
||||
</ul>
|
||||
@@ -881,18 +859,6 @@ details {
|
||||
</ul>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Stock Firmware Lucky Miners:</summary>
|
||||
<ul>
|
||||
<details>
|
||||
<summary>LV Series:</summary>
|
||||
<ul>
|
||||
<li><a href="../luckyminer/LV#lv08-stock">LV08 (Stock)</a></li>
|
||||
<li><a href="../luckyminer/LV#lv07-stock">LV07 (Stock)</a></li>
|
||||
</ul>
|
||||
</details>
|
||||
</ul>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Stock Firmware IceRiver Miners:</summary>
|
||||
<ul>
|
||||
<details>
|
||||
@@ -932,15 +898,4 @@ details {
|
||||
</ul>
|
||||
</details>
|
||||
</ul>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Stock Firmware Elphapex Miners:</summary>
|
||||
<ul>
|
||||
<details>
|
||||
<summary>DGX Series:</summary>
|
||||
<ul>
|
||||
<li><a href="../elphapex/DGX#dg1_1-stock">DG1+ (Stock)</a></li>
|
||||
</ul>
|
||||
</details>
|
||||
</ul>
|
||||
</details>
|
||||
275
poetry.lock
generated
275
poetry.lock
generated
@@ -1,4 +1,4 @@
|
||||
# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand.
|
||||
# This file is automatically @generated by Poetry 2.0.1 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "aiofiles"
|
||||
@@ -44,19 +44,19 @@ typing_extensions = {version = ">=4.5", markers = "python_version < \"3.13\""}
|
||||
|
||||
[package.extras]
|
||||
doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx_rtd_theme"]
|
||||
test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "trustme", "truststore (>=0.9.1) ; python_version >= \"3.10\"", "uvloop (>=0.21) ; platform_python_implementation == \"CPython\" and platform_system != \"Windows\" and python_version < \"3.14\""]
|
||||
test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21)"]
|
||||
trio = ["trio (>=0.26.1)"]
|
||||
|
||||
[[package]]
|
||||
name = "asyncssh"
|
||||
version = "2.20.0"
|
||||
version = "2.19.0"
|
||||
description = "AsyncSSH: Asynchronous SSHv2 client and server library"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "asyncssh-2.20.0-py3-none-any.whl", hash = "sha256:af6888d937c07a4bf31293335a6166b4d87608cdb5957b49547da6ad87ecf174"},
|
||||
{file = "asyncssh-2.20.0.tar.gz", hash = "sha256:020b6e384b2328ef8683908ad8e73de9ec2b9b62fd964571ea957bba98412983"},
|
||||
{file = "asyncssh-2.19.0-py3-none-any.whl", hash = "sha256:bb82ac30ff0cb4393fbaf1114e606ad7a4f13d6c4bdaed423c033ee26b455228"},
|
||||
{file = "asyncssh-2.19.0.tar.gz", hash = "sha256:723dead4d068b558708dc66a4ca7e7a93a813aa9416036eccb9af4c03ae2cf30"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -74,37 +74,18 @@ pywin32 = ["pywin32 (>=227)"]
|
||||
|
||||
[[package]]
|
||||
name = "babel"
|
||||
version = "2.17.0"
|
||||
version = "2.16.0"
|
||||
description = "Internationalization utilities"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
groups = ["docs"]
|
||||
files = [
|
||||
{file = "babel-2.17.0-py3-none-any.whl", hash = "sha256:4d0b53093fdfb4b21c92b5213dba5a1b23885afa8383709427046b21c366e5f2"},
|
||||
{file = "babel-2.17.0.tar.gz", hash = "sha256:0c54cffb19f690cdcc52a3b50bcbf71e07a808d1c80d549f2459b9d2cf0afb9d"},
|
||||
{file = "babel-2.16.0-py3-none-any.whl", hash = "sha256:368b5b98b37c06b7daf6696391c3240c938b37767d4584413e8438c5c435fa8b"},
|
||||
{file = "babel-2.16.0.tar.gz", hash = "sha256:d1f3554ca26605fe173f3de0c65f750f5a42f924499bf134de6423582298e316"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
dev = ["backports.zoneinfo ; python_version < \"3.9\"", "freezegun (>=1.0,<2.0)", "jinja2 (>=3.0)", "pytest (>=6.0)", "pytest-cov", "pytz", "setuptools", "tzdata ; sys_platform == \"win32\""]
|
||||
|
||||
[[package]]
|
||||
name = "backrefs"
|
||||
version = "5.8"
|
||||
description = "A wrapper around re and regex that adds additional back references."
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
groups = ["docs"]
|
||||
files = [
|
||||
{file = "backrefs-5.8-py310-none-any.whl", hash = "sha256:c67f6638a34a5b8730812f5101376f9d41dc38c43f1fdc35cb54700f6ed4465d"},
|
||||
{file = "backrefs-5.8-py311-none-any.whl", hash = "sha256:2e1c15e4af0e12e45c8701bd5da0902d326b2e200cafcd25e49d9f06d44bb61b"},
|
||||
{file = "backrefs-5.8-py312-none-any.whl", hash = "sha256:bbef7169a33811080d67cdf1538c8289f76f0942ff971222a16034da88a73486"},
|
||||
{file = "backrefs-5.8-py313-none-any.whl", hash = "sha256:e3a63b073867dbefd0536425f43db618578528e3896fb77be7141328642a1585"},
|
||||
{file = "backrefs-5.8-py39-none-any.whl", hash = "sha256:a66851e4533fb5b371aa0628e1fee1af05135616b86140c9d787a2ffdf4b8fdc"},
|
||||
{file = "backrefs-5.8.tar.gz", hash = "sha256:2cab642a205ce966af3dd4b38ee36009b31fa9502a35fd61d59ccc116e40a6bd"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
extras = ["regex"]
|
||||
dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"]
|
||||
|
||||
[[package]]
|
||||
name = "betterproto"
|
||||
@@ -129,14 +110,14 @@ rust-codec = ["betterproto-rust-codec (==0.1.1)"]
|
||||
|
||||
[[package]]
|
||||
name = "certifi"
|
||||
version = "2025.1.31"
|
||||
version = "2024.12.14"
|
||||
description = "Python package for providing Mozilla's CA Bundle."
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
groups = ["main", "docs"]
|
||||
files = [
|
||||
{file = "certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe"},
|
||||
{file = "certifi-2025.1.31.tar.gz", hash = "sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651"},
|
||||
{file = "certifi-2024.12.14-py3-none-any.whl", hash = "sha256:1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56"},
|
||||
{file = "certifi-2024.12.14.tar.gz", hash = "sha256:b650d30f370c2b724812bee08008be0c4163b163ddaec3f2546c1caf65f191db"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -441,20 +422,20 @@ test = ["pytest (>=6)"]
|
||||
|
||||
[[package]]
|
||||
name = "filelock"
|
||||
version = "3.17.0"
|
||||
version = "3.16.1"
|
||||
description = "A platform independent file lock."
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
python-versions = ">=3.8"
|
||||
groups = ["dev"]
|
||||
files = [
|
||||
{file = "filelock-3.17.0-py3-none-any.whl", hash = "sha256:533dc2f7ba78dc2f0f531fc6c4940addf7b70a481e269a5a3b93be94ffbe8338"},
|
||||
{file = "filelock-3.17.0.tar.gz", hash = "sha256:ee4e77401ef576ebb38cd7f13b9b28893194acc20a8e68e18730ba9c0e54660e"},
|
||||
{file = "filelock-3.16.1-py3-none-any.whl", hash = "sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0"},
|
||||
{file = "filelock-3.16.1.tar.gz", hash = "sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
docs = ["furo (>=2024.8.6)", "sphinx (>=8.1.3)", "sphinx-autodoc-typehints (>=3)"]
|
||||
testing = ["covdefaults (>=2.3)", "coverage (>=7.6.10)", "diff-cover (>=9.2.1)", "pytest (>=8.3.4)", "pytest-asyncio (>=0.25.2)", "pytest-cov (>=6)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.28.1)"]
|
||||
typing = ["typing-extensions (>=4.12.2) ; python_version < \"3.11\""]
|
||||
docs = ["furo (>=2024.8.6)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4.1)"]
|
||||
testing = ["covdefaults (>=2.3)", "coverage (>=7.6.1)", "diff-cover (>=9.2)", "pytest (>=8.3.3)", "pytest-asyncio (>=0.24)", "pytest-cov (>=5)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.26.4)"]
|
||||
typing = ["typing-extensions (>=4.12.2)"]
|
||||
|
||||
[[package]]
|
||||
name = "ghp-import"
|
||||
@@ -476,14 +457,14 @@ dev = ["flake8", "markdown", "twine", "wheel"]
|
||||
|
||||
[[package]]
|
||||
name = "griffe"
|
||||
version = "1.6.0"
|
||||
version = "1.5.5"
|
||||
description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API."
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
groups = ["docs"]
|
||||
files = [
|
||||
{file = "griffe-1.6.0-py3-none-any.whl", hash = "sha256:9f1dfe035d4715a244ed2050dfbceb05b1f470809ed4f6bb10ece5a7302f8dd1"},
|
||||
{file = "griffe-1.6.0.tar.gz", hash = "sha256:eb5758088b9c73ad61c7ac014f3cdfb4c57b5c2fcbfca69996584b702aefa354"},
|
||||
{file = "griffe-1.5.5-py3-none-any.whl", hash = "sha256:2761b1e8876c6f1f9ab1af274df93ea6bbadd65090de5f38f4cb5cc84897c7dd"},
|
||||
{file = "griffe-1.5.5.tar.gz", hash = "sha256:35ee5b38b93d6a839098aad0f92207e6ad6b70c3e8866c08ca669275b8cba585"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -521,30 +502,30 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "4.2.0"
|
||||
description = "Pure-Python HTTP/2 protocol implementation"
|
||||
version = "4.1.0"
|
||||
description = "HTTP/2 State-Machine based protocol implementation"
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
python-versions = ">=3.6.1"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "h2-4.2.0-py3-none-any.whl", hash = "sha256:479a53ad425bb29af087f3458a61d30780bc818e4ebcf01f0b536ba916462ed0"},
|
||||
{file = "h2-4.2.0.tar.gz", hash = "sha256:c8a52129695e88b1a0578d8d2cc6842bbd79128ac685463b887ee278126ad01f"},
|
||||
{file = "h2-4.1.0-py3-none-any.whl", hash = "sha256:03a46bcf682256c95b5fd9e9a99c1323584c3eec6440d379b9903d709476bc6d"},
|
||||
{file = "h2-4.1.0.tar.gz", hash = "sha256:a83aca08fbe7aacb79fec788c9c0bac936343560ed9ec18b82a13a12c28d2abb"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
hpack = ">=4.1,<5"
|
||||
hyperframe = ">=6.1,<7"
|
||||
hpack = ">=4.0,<5"
|
||||
hyperframe = ">=6.0,<7"
|
||||
|
||||
[[package]]
|
||||
name = "hpack"
|
||||
version = "4.1.0"
|
||||
description = "Pure-Python HPACK header encoding"
|
||||
version = "4.0.0"
|
||||
description = "Pure-Python HPACK header compression"
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
python-versions = ">=3.6.1"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "hpack-4.1.0-py3-none-any.whl", hash = "sha256:157ac792668d995c657d93111f46b4535ed114f0c9c8d672271bbec7eae1b496"},
|
||||
{file = "hpack-4.1.0.tar.gz", hash = "sha256:ec5eca154f7056aa06f196a557655c5b009b382873ac8d1e66e79e87535f1dca"},
|
||||
{file = "hpack-4.0.0-py3-none-any.whl", hash = "sha256:84a076fad3dc9a9f8063ccb8041ef100867b1878b25ef0ee63847a5d53818a6c"},
|
||||
{file = "hpack-4.0.0.tar.gz", hash = "sha256:fc41de0c63e687ebffde81187a948221294896f6bdc0ae2312708df339430095"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -588,7 +569,7 @@ httpcore = "==1.*"
|
||||
idna = "*"
|
||||
|
||||
[package.extras]
|
||||
brotli = ["brotli ; platform_python_implementation == \"CPython\"", "brotlicffi ; platform_python_implementation != \"CPython\""]
|
||||
brotli = ["brotli", "brotlicffi"]
|
||||
cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"]
|
||||
http2 = ["h2 (>=3,<5)"]
|
||||
socks = ["socksio (==1.*)"]
|
||||
@@ -596,26 +577,26 @@ zstd = ["zstandard (>=0.18.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "hyperframe"
|
||||
version = "6.1.0"
|
||||
description = "Pure-Python HTTP/2 framing"
|
||||
version = "6.0.1"
|
||||
description = "HTTP/2 framing layer for Python"
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
python-versions = ">=3.6.1"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "hyperframe-6.1.0-py3-none-any.whl", hash = "sha256:b03380493a519fce58ea5af42e4a42317bf9bd425596f7a0835ffce80f1a42e5"},
|
||||
{file = "hyperframe-6.1.0.tar.gz", hash = "sha256:f630908a00854a7adeabd6382b43923a4c4cd4b821fcb527e6ab9e15382a3b08"},
|
||||
{file = "hyperframe-6.0.1-py3-none-any.whl", hash = "sha256:0ec6bafd80d8ad2195c4f03aacba3a8265e57bc4cff261e802bf39970ed02a15"},
|
||||
{file = "hyperframe-6.0.1.tar.gz", hash = "sha256:ae510046231dc8e9ecb1a6586f63d2347bf4c8905914aa84ba585ae85f28a914"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "identify"
|
||||
version = "2.6.8"
|
||||
version = "2.6.5"
|
||||
description = "File identification library for Python"
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
groups = ["dev"]
|
||||
files = [
|
||||
{file = "identify-2.6.8-py2.py3-none-any.whl", hash = "sha256:83657f0f766a3c8d0eaea16d4ef42494b39b34629a4b3192a9d020d349b3e255"},
|
||||
{file = "identify-2.6.8.tar.gz", hash = "sha256:61491417ea2c0c5c670484fd8abbb34de34cdae1e5f39a73ee65e48e4bb663fc"},
|
||||
{file = "identify-2.6.5-py2.py3-none-any.whl", hash = "sha256:14181a47091eb75b337af4c23078c9d09225cd4c48929f521f3bf16b09d02566"},
|
||||
{file = "identify-2.6.5.tar.gz", hash = "sha256:c10b33f250e5bba374fae86fb57f3adcebf1161bce7cdf92031915fd480c13bc"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
@@ -638,27 +619,27 @@ all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2
|
||||
|
||||
[[package]]
|
||||
name = "importlib-metadata"
|
||||
version = "8.6.1"
|
||||
version = "8.5.0"
|
||||
description = "Read metadata from Python packages"
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
python-versions = ">=3.8"
|
||||
groups = ["docs"]
|
||||
markers = "python_version < \"3.10\""
|
||||
files = [
|
||||
{file = "importlib_metadata-8.6.1-py3-none-any.whl", hash = "sha256:02a89390c1e15fdfdc0d7c6b25cb3e62650d0494005c97d6f148bf5b9787525e"},
|
||||
{file = "importlib_metadata-8.6.1.tar.gz", hash = "sha256:310b41d755445d74569f993ccfc22838295d9fe005425094fad953d7f15c8580"},
|
||||
{file = "importlib_metadata-8.5.0-py3-none-any.whl", hash = "sha256:45e54197d28b7a7f1559e60b95e7c567032b602131fbd588f1497f47880aa68b"},
|
||||
{file = "importlib_metadata-8.5.0.tar.gz", hash = "sha256:71522656f0abace1d072b9e5481a48f07c138e00f079c38c8f883823f9c26bd7"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
zipp = ">=3.20"
|
||||
|
||||
[package.extras]
|
||||
check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""]
|
||||
check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"]
|
||||
cover = ["pytest-cov"]
|
||||
doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
|
||||
enabler = ["pytest-enabler (>=2.2)"]
|
||||
perf = ["ipython"]
|
||||
test = ["flufl.flake8", "importlib_resources (>=1.3) ; python_version < \"3.9\"", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6,!=8.1.*)", "pytest-perf (>=0.9.2)"]
|
||||
test = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6,!=8.1.*)", "pytest-perf (>=0.9.2)"]
|
||||
type = ["pytest-mypy"]
|
||||
|
||||
[[package]]
|
||||
@@ -826,18 +807,18 @@ watchdog = ">=2.0"
|
||||
|
||||
[package.extras]
|
||||
i18n = ["babel (>=2.9.0)"]
|
||||
min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4) ; platform_system == \"Windows\"", "ghp-import (==1.0)", "importlib-metadata (==4.4) ; python_version < \"3.10\"", "jinja2 (==2.11.1)", "markdown (==3.3.6)", "markupsafe (==2.0.1)", "mergedeep (==1.3.4)", "mkdocs-get-deps (==0.2.0)", "packaging (==20.5)", "pathspec (==0.11.1)", "pyyaml (==5.1)", "pyyaml-env-tag (==0.1)", "watchdog (==2.0)"]
|
||||
min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4)", "ghp-import (==1.0)", "importlib-metadata (==4.4)", "jinja2 (==2.11.1)", "markdown (==3.3.6)", "markupsafe (==2.0.1)", "mergedeep (==1.3.4)", "mkdocs-get-deps (==0.2.0)", "packaging (==20.5)", "pathspec (==0.11.1)", "pyyaml (==5.1)", "pyyaml-env-tag (==0.1)", "watchdog (==2.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "mkdocs-autorefs"
|
||||
version = "1.4.0"
|
||||
version = "1.3.0"
|
||||
description = "Automatically link across pages in MkDocs."
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
groups = ["docs"]
|
||||
files = [
|
||||
{file = "mkdocs_autorefs-1.4.0-py3-none-any.whl", hash = "sha256:bad19f69655878d20194acd0162e29a89c3f7e6365ffe54e72aa3fd1072f240d"},
|
||||
{file = "mkdocs_autorefs-1.4.0.tar.gz", hash = "sha256:a9c0aa9c90edbce302c09d050a3c4cb7c76f8b7b2c98f84a7a05f53d00392156"},
|
||||
{file = "mkdocs_autorefs-1.3.0-py3-none-any.whl", hash = "sha256:d180f9778a04e78b7134e31418f238bba56f56d6a8af97873946ff661befffb3"},
|
||||
{file = "mkdocs_autorefs-1.3.0.tar.gz", hash = "sha256:6867764c099ace9025d6ac24fd07b85a98335fbd30107ef01053697c8f46db61"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -865,19 +846,18 @@ pyyaml = ">=5.1"
|
||||
|
||||
[[package]]
|
||||
name = "mkdocs-material"
|
||||
version = "9.6.7"
|
||||
version = "9.5.50"
|
||||
description = "Documentation that simply works"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
groups = ["docs"]
|
||||
files = [
|
||||
{file = "mkdocs_material-9.6.7-py3-none-any.whl", hash = "sha256:8a159e45e80fcaadd9fbeef62cbf928569b93df954d4dc5ba76d46820caf7b47"},
|
||||
{file = "mkdocs_material-9.6.7.tar.gz", hash = "sha256:3e2c1fceb9410056c2d91f334a00cdea3215c28750e00c691c1e46b2a33309b4"},
|
||||
{file = "mkdocs_material-9.5.50-py3-none-any.whl", hash = "sha256:f24100f234741f4d423a9d672a909d859668a4f404796be3cf035f10d6050385"},
|
||||
{file = "mkdocs_material-9.5.50.tar.gz", hash = "sha256:ae5fe16f3d7c9ccd05bb6916a7da7420cf99a9ce5e33debd9d40403a090d5825"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
babel = ">=2.10,<3.0"
|
||||
backrefs = ">=5.7.post1,<6.0"
|
||||
colorama = ">=0.4,<1.0"
|
||||
jinja2 = ">=3.0,<4.0"
|
||||
markdown = ">=3.2,<4.0"
|
||||
@@ -886,6 +866,7 @@ mkdocs-material-extensions = ">=1.3,<2.0"
|
||||
paginate = ">=0.5,<1.0"
|
||||
pygments = ">=2.16,<3.0"
|
||||
pymdown-extensions = ">=10.2,<11.0"
|
||||
regex = ">=2022.4"
|
||||
requests = ">=2.26,<3.0"
|
||||
|
||||
[package.extras]
|
||||
@@ -1146,14 +1127,14 @@ type = ["mypy (>=1.11.2)"]
|
||||
|
||||
[[package]]
|
||||
name = "pre-commit"
|
||||
version = "4.1.0"
|
||||
version = "4.0.1"
|
||||
description = "A framework for managing and maintaining multi-language pre-commit hooks."
|
||||
optional = false
|
||||
python-versions = ">=3.9"
|
||||
groups = ["dev"]
|
||||
files = [
|
||||
{file = "pre_commit-4.1.0-py2.py3-none-any.whl", hash = "sha256:d29e7cb346295bcc1cc75fc3e92e343495e3ea0196c9ec6ba53f49f10ab6ae7b"},
|
||||
{file = "pre_commit-4.1.0.tar.gz", hash = "sha256:ae3f018575a588e30dfddfab9a05448bfbd6b73d78709617b5a2b853549716d4"},
|
||||
{file = "pre_commit-4.0.1-py2.py3-none-any.whl", hash = "sha256:efde913840816312445dc98787724647c65473daefe420785f885e8ed9a06878"},
|
||||
{file = "pre_commit-4.0.1.tar.gz", hash = "sha256:80905ac375958c0444c65e9cebebd948b3cdb518f335a091a670a89d652139d2"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -1196,14 +1177,14 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "pydantic"
|
||||
version = "2.10.6"
|
||||
version = "2.10.5"
|
||||
description = "Data validation using Python type hints"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "pydantic-2.10.6-py3-none-any.whl", hash = "sha256:427d664bf0b8a2b34ff5dd0f5a18df00591adcee7198fbd71981054cef37b584"},
|
||||
{file = "pydantic-2.10.6.tar.gz", hash = "sha256:ca5daa827cce33de7a42be142548b0096bf05a7e7b365aebfa5f8eeec7128236"},
|
||||
{file = "pydantic-2.10.5-py3-none-any.whl", hash = "sha256:4dd4e322dbe55472cb7ca7e73f4b63574eecccf2835ffa2af9021ce113c83c53"},
|
||||
{file = "pydantic-2.10.5.tar.gz", hash = "sha256:278b38dbbaec562011d659ee05f63346951b3a248a6f3642e1bc68894ea2b4ff"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -1213,7 +1194,7 @@ typing-extensions = ">=4.12.2"
|
||||
|
||||
[package.extras]
|
||||
email = ["email-validator (>=2.0.0)"]
|
||||
timezone = ["tzdata ; python_version >= \"3.9\" and platform_system == \"Windows\""]
|
||||
timezone = ["tzdata"]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-core"
|
||||
@@ -1345,14 +1326,14 @@ windows-terminal = ["colorama (>=0.4.6)"]
|
||||
|
||||
[[package]]
|
||||
name = "pymdown-extensions"
|
||||
version = "10.14.3"
|
||||
version = "10.14"
|
||||
description = "Extension pack for Python Markdown."
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
groups = ["docs"]
|
||||
files = [
|
||||
{file = "pymdown_extensions-10.14.3-py3-none-any.whl", hash = "sha256:05e0bee73d64b9c71a4ae17c72abc2f700e8bc8403755a00580b49a4e9f189e9"},
|
||||
{file = "pymdown_extensions-10.14.3.tar.gz", hash = "sha256:41e576ce3f5d650be59e900e4ceff231e0aed2a88cf30acaee41e02f063a061b"},
|
||||
{file = "pymdown_extensions-10.14-py3-none-any.whl", hash = "sha256:202481f716cc8250e4be8fce997781ebf7917701b59652458ee47f2401f818b5"},
|
||||
{file = "pymdown_extensions-10.14.tar.gz", hash = "sha256:741bd7c4ff961ba40b7528d32284c53bc436b8b1645e8e37c3e57770b8700a34"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -1455,6 +1436,110 @@ files = [
|
||||
[package.dependencies]
|
||||
pyyaml = "*"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "2024.11.6"
|
||||
description = "Alternative regular expression module, to replace re."
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
groups = ["docs"]
|
||||
files = [
|
||||
{file = "regex-2024.11.6-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ff590880083d60acc0433f9c3f713c51f7ac6ebb9adf889c79a261ecf541aa91"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:658f90550f38270639e83ce492f27d2c8d2cd63805c65a13a14d36ca126753f0"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:164d8b7b3b4bcb2068b97428060b2a53be050085ef94eca7f240e7947f1b080e"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d3660c82f209655a06b587d55e723f0b813d3a7db2e32e5e7dc64ac2a9e86fde"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d22326fcdef5e08c154280b71163ced384b428343ae16a5ab2b3354aed12436e"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f1ac758ef6aebfc8943560194e9fd0fa18bcb34d89fd8bd2af18183afd8da3a2"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:997d6a487ff00807ba810e0f8332c18b4eb8d29463cfb7c820dc4b6e7562d0cf"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:02a02d2bb04fec86ad61f3ea7f49c015a0681bf76abb9857f945d26159d2968c"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f02f93b92358ee3f78660e43b4b0091229260c5d5c408d17d60bf26b6c900e86"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:06eb1be98df10e81ebaded73fcd51989dcf534e3c753466e4b60c4697a003b67"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:040df6fe1a5504eb0f04f048e6d09cd7c7110fef851d7c567a6b6e09942feb7d"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:fdabbfc59f2c6edba2a6622c647b716e34e8e3867e0ab975412c5c2f79b82da2"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:8447d2d39b5abe381419319f942de20b7ecd60ce86f16a23b0698f22e1b70008"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:da8f5fc57d1933de22a9e23eec290a0d8a5927a5370d24bda9a6abe50683fe62"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-win32.whl", hash = "sha256:b489578720afb782f6ccf2840920f3a32e31ba28a4b162e13900c3e6bd3f930e"},
|
||||
{file = "regex-2024.11.6-cp310-cp310-win_amd64.whl", hash = "sha256:5071b2093e793357c9d8b2929dfc13ac5f0a6c650559503bb81189d0a3814519"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:5478c6962ad548b54a591778e93cd7c456a7a29f8eca9c49e4f9a806dcc5d638"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2c89a8cc122b25ce6945f0423dc1352cb9593c68abd19223eebbd4e56612c5b7"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:94d87b689cdd831934fa3ce16cc15cd65748e6d689f5d2b8f4f4df2065c9fa20"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1062b39a0a2b75a9c694f7a08e7183a80c63c0d62b301418ffd9c35f55aaa114"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:167ed4852351d8a750da48712c3930b031f6efdaa0f22fa1933716bfcd6bf4a3"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2d548dafee61f06ebdb584080621f3e0c23fff312f0de1afc776e2a2ba99a74f"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f2a19f302cd1ce5dd01a9099aaa19cae6173306d1302a43b627f62e21cf18ac0"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bec9931dfb61ddd8ef2ebc05646293812cb6b16b60cf7c9511a832b6f1854b55"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:9714398225f299aa85267fd222f7142fcb5c769e73d7733344efc46f2ef5cf89"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:202eb32e89f60fc147a41e55cb086db2a3f8cb82f9a9a88440dcfc5d37faae8d"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:4181b814e56078e9b00427ca358ec44333765f5ca1b45597ec7446d3a1ef6e34"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:068376da5a7e4da51968ce4c122a7cd31afaaec4fccc7856c92f63876e57b51d"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ac10f2c4184420d881a3475fb2c6f4d95d53a8d50209a2500723d831036f7c45"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-win32.whl", hash = "sha256:c36f9b6f5f8649bb251a5f3f66564438977b7ef8386a52460ae77e6070d309d9"},
|
||||
{file = "regex-2024.11.6-cp311-cp311-win_amd64.whl", hash = "sha256:02e28184be537f0e75c1f9b2f8847dc51e08e6e171c6bde130b2687e0c33cf60"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:52fb28f528778f184f870b7cf8f225f5eef0a8f6e3778529bdd40c7b3920796a"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:fdd6028445d2460f33136c55eeb1f601ab06d74cb3347132e1c24250187500d9"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:805e6b60c54bf766b251e94526ebad60b7de0c70f70a4e6210ee2891acb70bf2"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b85c2530be953a890eaffde05485238f07029600e8f098cdf1848d414a8b45e4"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:bb26437975da7dc36b7efad18aa9dd4ea569d2357ae6b783bf1118dabd9ea577"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:abfa5080c374a76a251ba60683242bc17eeb2c9818d0d30117b4486be10c59d3"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70b7fa6606c2881c1db9479b0eaa11ed5dfa11c8d60a474ff0e095099f39d98e"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0c32f75920cf99fe6b6c539c399a4a128452eaf1af27f39bce8909c9a3fd8cbe"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:982e6d21414e78e1f51cf595d7f321dcd14de1f2881c5dc6a6e23bbbbd68435e"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:a7c2155f790e2fb448faed6dd241386719802296ec588a8b9051c1f5c481bc29"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:149f5008d286636e48cd0b1dd65018548944e495b0265b45e1bffecce1ef7f39"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:e5364a4502efca094731680e80009632ad6624084aff9a23ce8c8c6820de3e51"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0a86e7eeca091c09e021db8eb72d54751e527fa47b8d5787caf96d9831bd02ad"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-win32.whl", hash = "sha256:32f9a4c643baad4efa81d549c2aadefaeba12249b2adc5af541759237eee1c54"},
|
||||
{file = "regex-2024.11.6-cp312-cp312-win_amd64.whl", hash = "sha256:a93c194e2df18f7d264092dc8539b8ffb86b45b899ab976aa15d48214138e81b"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:a6ba92c0bcdf96cbf43a12c717eae4bc98325ca3730f6b130ffa2e3c3c723d84"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:525eab0b789891ac3be914d36893bdf972d483fe66551f79d3e27146191a37d4"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:086a27a0b4ca227941700e0b31425e7a28ef1ae8e5e05a33826e17e47fbfdba0"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bde01f35767c4a7899b7eb6e823b125a64de314a8ee9791367c9a34d56af18d0"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b583904576650166b3d920d2bcce13971f6f9e9a396c673187f49811b2769dc7"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1c4de13f06a0d54fa0d5ab1b7138bfa0d883220965a29616e3ea61b35d5f5fc7"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3cde6e9f2580eb1665965ce9bf17ff4952f34f5b126beb509fee8f4e994f143c"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0d7f453dca13f40a02b79636a339c5b62b670141e63efd511d3f8f73fba162b3"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:59dfe1ed21aea057a65c6b586afd2a945de04fc7db3de0a6e3ed5397ad491b07"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:b97c1e0bd37c5cd7902e65f410779d39eeda155800b65fc4d04cc432efa9bc6e"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:f9d1e379028e0fc2ae3654bac3cbbef81bf3fd571272a42d56c24007979bafb6"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:13291b39131e2d002a7940fb176e120bec5145f3aeb7621be6534e46251912c4"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4f51f88c126370dcec4908576c5a627220da6c09d0bff31cfa89f2523843316d"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-win32.whl", hash = "sha256:63b13cfd72e9601125027202cad74995ab26921d8cd935c25f09c630436348ff"},
|
||||
{file = "regex-2024.11.6-cp313-cp313-win_amd64.whl", hash = "sha256:2b3361af3198667e99927da8b84c1b010752fa4b1115ee30beaa332cabc3ef1a"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:3a51ccc315653ba012774efca4f23d1d2a8a8f278a6072e29c7147eee7da446b"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ad182d02e40de7459b73155deb8996bbd8e96852267879396fb274e8700190e3"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ba9b72e5643641b7d41fa1f6d5abda2c9a263ae835b917348fc3c928182ad467"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40291b1b89ca6ad8d3f2b82782cc33807f1406cf68c8d440861da6304d8ffbbd"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cdf58d0e516ee426a48f7b2c03a332a4114420716d55769ff7108c37a09951bf"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a36fdf2af13c2b14738f6e973aba563623cb77d753bbbd8d414d18bfaa3105dd"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d1cee317bfc014c2419a76bcc87f071405e3966da434e03e13beb45f8aced1a6"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:50153825ee016b91549962f970d6a4442fa106832e14c918acd1c8e479916c4f"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:ea1bfda2f7162605f6e8178223576856b3d791109f15ea99a9f95c16a7636fb5"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:df951c5f4a1b1910f1a99ff42c473ff60f8225baa1cdd3539fe2819d9543e9df"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:072623554418a9911446278f16ecb398fb3b540147a7828c06e2011fa531e773"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:f654882311409afb1d780b940234208a252322c24a93b442ca714d119e68086c"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:89d75e7293d2b3e674db7d4d9b1bee7f8f3d1609428e293771d1a962617150cc"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:f65557897fc977a44ab205ea871b690adaef6b9da6afda4790a2484b04293a5f"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-win32.whl", hash = "sha256:6f44ec28b1f858c98d3036ad5d7d0bfc568bdd7a74f9c24e25f41ef1ebfd81a4"},
|
||||
{file = "regex-2024.11.6-cp38-cp38-win_amd64.whl", hash = "sha256:bb8f74f2f10dbf13a0be8de623ba4f9491faf58c24064f32b65679b021ed0001"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:5704e174f8ccab2026bd2f1ab6c510345ae8eac818b613d7d73e785f1310f839"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:220902c3c5cc6af55d4fe19ead504de80eb91f786dc102fbd74894b1551f095e"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:5e7e351589da0850c125f1600a4c4ba3c722efefe16b297de54300f08d734fbf"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5056b185ca113c88e18223183aa1a50e66507769c9640a6ff75859619d73957b"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2e34b51b650b23ed3354b5a07aab37034d9f923db2a40519139af34f485f77d0"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5670bce7b200273eee1840ef307bfa07cda90b38ae56e9a6ebcc9f50da9c469b"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:08986dce1339bc932923e7d1232ce9881499a0e02925f7402fb7c982515419ef"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93c0b12d3d3bc25af4ebbf38f9ee780a487e8bf6954c115b9f015822d3bb8e48"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:764e71f22ab3b305e7f4c21f1a97e1526a25ebdd22513e251cf376760213da13"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:f056bf21105c2515c32372bbc057f43eb02aae2fda61052e2f7622c801f0b4e2"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:69ab78f848845569401469da20df3e081e6b5a11cb086de3eed1d48f5ed57c95"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:86fddba590aad9208e2fa8b43b4c098bb0ec74f15718bb6a704e3c63e2cef3e9"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:684d7a212682996d21ca12ef3c17353c021fe9de6049e19ac8481ec35574a70f"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:a03e02f48cd1abbd9f3b7e3586d97c8f7a9721c436f51a5245b3b9483044480b"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-win32.whl", hash = "sha256:41758407fc32d5c3c5de163888068cfee69cb4c2be844e7ac517a52770f9af57"},
|
||||
{file = "regex-2024.11.6-cp39-cp39-win_amd64.whl", hash = "sha256:b2837718570f95dd41675328e111345f9b7095d821bac435aac173ac80b19983"},
|
||||
{file = "regex-2024.11.6.tar.gz", hash = "sha256:7ab159b063c52a0333c884e4679f8d7a85112ee3078fe3d9004b2dd875585519"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "requests"
|
||||
version = "2.32.3"
|
||||
@@ -1582,21 +1667,21 @@ files = [
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
brotli = ["brotli (>=1.0.9) ; platform_python_implementation == \"CPython\"", "brotlicffi (>=0.8.0) ; platform_python_implementation != \"CPython\""]
|
||||
brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"]
|
||||
h2 = ["h2 (>=4,<5)"]
|
||||
socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]
|
||||
zstd = ["zstandard (>=0.18.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "virtualenv"
|
||||
version = "20.29.2"
|
||||
version = "20.29.1"
|
||||
description = "Virtual Python Environment builder"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
groups = ["dev"]
|
||||
files = [
|
||||
{file = "virtualenv-20.29.2-py3-none-any.whl", hash = "sha256:febddfc3d1ea571bdb1dc0f98d7b45d24def7428214d4fb73cc486c9568cce6a"},
|
||||
{file = "virtualenv-20.29.2.tar.gz", hash = "sha256:fdaabebf6d03b5ba83ae0a02cfe96f48a716f4fae556461d180825866f75b728"},
|
||||
{file = "virtualenv-20.29.1-py3-none-any.whl", hash = "sha256:4e4cb403c0b0da39e13b46b1b2476e505cb0046b25f242bee80f62bf990b2779"},
|
||||
{file = "virtualenv-20.29.1.tar.gz", hash = "sha256:b8b8970138d32fb606192cb97f6cd4bb644fa486be9308fb9b63f81091b5dc35"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -1606,7 +1691,7 @@ platformdirs = ">=3.9.1,<5"
|
||||
|
||||
[package.extras]
|
||||
docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"]
|
||||
test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8) ; platform_python_implementation == \"PyPy\" or platform_python_implementation == \"CPython\" and sys_platform == \"win32\" and python_version >= \"3.13\"", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10) ; platform_python_implementation == \"CPython\""]
|
||||
test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"]
|
||||
|
||||
[[package]]
|
||||
name = "watchdog"
|
||||
@@ -1665,14 +1750,14 @@ files = [
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""]
|
||||
check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"]
|
||||
cover = ["pytest-cov"]
|
||||
doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
|
||||
enabler = ["pytest-enabler (>=2.2)"]
|
||||
test = ["big-O", "importlib-resources ; python_version < \"3.9\"", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-ignore-flaky"]
|
||||
test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-ignore-flaky"]
|
||||
type = ["pytest-mypy"]
|
||||
|
||||
[metadata]
|
||||
lock-version = "2.1"
|
||||
python-versions = ">3.9, <4.0"
|
||||
content-hash = "67a8e0d34c0d1af0f8e4d617d80fd5afc8d197e5d5444f78fd82e4f716a52965"
|
||||
python-versions = "^3.9"
|
||||
content-hash = "a0d1e4d454da0d9d3c246a4f1047e804db5726c175071d95b7007e88689cdbf2"
|
||||
|
||||
@@ -56,26 +56,6 @@ class MinerConfig(BaseModel):
|
||||
**self.temperature.as_am_modern(),
|
||||
}
|
||||
|
||||
def as_hiveon_modern(self, user_suffix: str | None = None) -> dict:
|
||||
"""Generates the configuration in the format suitable for modern Hiveon."""
|
||||
return {
|
||||
**self.fan_mode.as_hiveon_modern(),
|
||||
"freq-level": "100",
|
||||
**self.mining_mode.as_hiveon_modern(),
|
||||
**self.pools.as_hiveon_modern(user_suffix=user_suffix),
|
||||
**self.temperature.as_hiveon_modern(),
|
||||
}
|
||||
|
||||
def as_elphapex(self, user_suffix: str | None = None) -> dict:
|
||||
"""Generates the configuration in the format suitable for modern Elphapex."""
|
||||
return {
|
||||
**self.fan_mode.as_elphapex(),
|
||||
"fc-freq-level": "100",
|
||||
**self.mining_mode.as_elphapex(),
|
||||
**self.pools.as_elphapex(user_suffix=user_suffix),
|
||||
**self.temperature.as_elphapex(),
|
||||
}
|
||||
|
||||
def as_wm(self, user_suffix: str | None = None) -> dict:
|
||||
"""Generates the configuration in the format suitable for Whatsminers."""
|
||||
return {
|
||||
@@ -163,12 +143,12 @@ class MinerConfig(BaseModel):
|
||||
**self.pools.as_mara(user_suffix=user_suffix),
|
||||
}
|
||||
|
||||
def as_espminer(self, user_suffix: str | None = None) -> dict:
|
||||
def as_bitaxe(self, user_suffix: str | None = None) -> dict:
|
||||
return {
|
||||
**self.fan_mode.as_espminer(),
|
||||
**self.temperature.as_espminer(),
|
||||
**self.mining_mode.as_espminer(),
|
||||
**self.pools.as_espminer(user_suffix=user_suffix),
|
||||
**self.fan_mode.as_bitaxe(),
|
||||
**self.temperature.as_bitaxe(),
|
||||
**self.mining_mode.as_bitaxe(),
|
||||
**self.pools.as_bitaxe(user_suffix=user_suffix),
|
||||
}
|
||||
|
||||
def as_luxos(self, user_suffix: str | None = None) -> dict:
|
||||
@@ -219,24 +199,6 @@ class MinerConfig(BaseModel):
|
||||
fan_mode=FanModeConfig.from_am_modern(web_conf),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_hiveon_modern(cls, web_conf: dict) -> "MinerConfig":
|
||||
"""Constructs a MinerConfig object from web configuration for Hiveon."""
|
||||
return cls(
|
||||
pools=PoolConfig.from_hiveon_modern(web_conf),
|
||||
mining_mode=MiningModeConfig.from_hiveon_modern(web_conf),
|
||||
fan_mode=FanModeConfig.from_hiveon_modern(web_conf),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_elphapex(cls, web_conf: dict) -> "MinerConfig":
|
||||
"""Constructs a MinerConfig object from web configuration for modern Antminers."""
|
||||
return cls(
|
||||
pools=PoolConfig.from_elphapex(web_conf),
|
||||
mining_mode=MiningModeConfig.from_elphapex(web_conf),
|
||||
fan_mode=FanModeConfig.from_elphapex(web_conf),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_am_old(cls, web_conf: dict) -> "MinerConfig":
|
||||
"""Constructs a MinerConfig object from web configuration for old versions of Antminers."""
|
||||
@@ -310,10 +272,10 @@ class MinerConfig(BaseModel):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_espminer(cls, web_system_info: dict) -> "MinerConfig":
|
||||
def from_bitaxe(cls, web_system_info: dict) -> "MinerConfig":
|
||||
return cls(
|
||||
pools=PoolConfig.from_espminer(web_system_info),
|
||||
fan_mode=FanModeConfig.from_espminer(web_system_info),
|
||||
pools=PoolConfig.from_bitaxe(web_system_info),
|
||||
fan_mode=FanModeConfig.from_bitaxe(web_system_info),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@@ -346,3 +308,7 @@ class MinerConfig(BaseModel):
|
||||
@classmethod
|
||||
def from_hammer(cls, *args, **kwargs) -> "MinerConfig":
|
||||
return cls.from_am_modern(*args, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def from_hiveon_modern(cls, web_conf: dict) -> "MinerConfig":
|
||||
return cls.from_am_modern(web_conf)
|
||||
|
||||
@@ -28,9 +28,6 @@ class MinerConfigOption(Enum):
|
||||
def as_am_modern(self) -> dict:
|
||||
return self.value.as_am_modern()
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
return self.value.as_hiveon_modern()
|
||||
|
||||
def as_am_old(self) -> dict:
|
||||
return self.value.as_am_old()
|
||||
|
||||
@@ -64,15 +61,12 @@ class MinerConfigOption(Enum):
|
||||
def as_mara(self) -> dict:
|
||||
return self.value.as_mara()
|
||||
|
||||
def as_espminer(self) -> dict:
|
||||
return self.value.as_espminer()
|
||||
def as_bitaxe(self) -> dict:
|
||||
return self.value.as_bitaxe()
|
||||
|
||||
def as_luxos(self) -> dict:
|
||||
return self.value.as_luxos()
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return self.value.as_elphapex()
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self.value(*args, **kwargs)
|
||||
|
||||
@@ -98,9 +92,6 @@ class MinerConfigValue(BaseModel):
|
||||
def as_am_modern(self) -> dict:
|
||||
return {}
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
return {}
|
||||
|
||||
def as_am_old(self) -> dict:
|
||||
return {}
|
||||
|
||||
@@ -134,15 +125,12 @@ class MinerConfigValue(BaseModel):
|
||||
def as_mara(self) -> dict:
|
||||
return {}
|
||||
|
||||
def as_espminer(self) -> dict:
|
||||
def as_bitaxe(self) -> dict:
|
||||
return {}
|
||||
|
||||
def as_luxos(self) -> dict:
|
||||
return {}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {}
|
||||
|
||||
def __getitem__(self, item):
|
||||
try:
|
||||
return getattr(self, item)
|
||||
|
||||
@@ -55,12 +55,6 @@ class FanModeNormal(MinerConfigValue):
|
||||
def as_am_modern(self) -> dict:
|
||||
return {"bitmain-fan-ctrl": False, "bitmain-fan-pwn": "100"}
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
return {"bitmain-fan-ctrl": False, "bitmain-fan-pwn": "100"}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {"fc-fan-ctrl": False, "fc-fan-pwn": "100"}
|
||||
|
||||
def as_bosminer(self) -> dict:
|
||||
return {
|
||||
"temp_control": {"mode": "auto"},
|
||||
@@ -87,7 +81,7 @@ class FanModeNormal(MinerConfigValue):
|
||||
},
|
||||
}
|
||||
|
||||
def as_espminer(self) -> dict:
|
||||
def as_bitaxe(self) -> dict:
|
||||
return {"autoFanspeed": 1}
|
||||
|
||||
def as_luxos(self) -> dict:
|
||||
@@ -141,12 +135,6 @@ class FanModeManual(MinerConfigValue):
|
||||
def as_am_modern(self) -> dict:
|
||||
return {"bitmain-fan-ctrl": True, "bitmain-fan-pwm": str(self.speed)}
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
return {"bitmain-fan-ctrl": True, "bitmain-fan-pwm": str(self.speed)}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {"fc-fan-ctrl": True, "fc-fan-pwm": str(self.speed)}
|
||||
|
||||
def as_bosminer(self) -> dict:
|
||||
return {
|
||||
"temp_control": {"mode": "manual"},
|
||||
@@ -168,7 +156,7 @@ class FanModeManual(MinerConfigValue):
|
||||
},
|
||||
}
|
||||
|
||||
def as_espminer(self) -> dict:
|
||||
def as_bitaxe(self) -> dict:
|
||||
return {"autoFanspeed": 0, "fanspeed": self.speed}
|
||||
|
||||
def as_luxos(self) -> dict:
|
||||
@@ -197,12 +185,6 @@ class FanModeImmersion(MinerConfigValue):
|
||||
def as_am_modern(self) -> dict:
|
||||
return {"bitmain-fan-ctrl": True, "bitmain-fan-pwm": "0"}
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
return {"bitmain-fan-ctrl": True, "bitmain-fan-pwm": "0"}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {"fc-fan-ctrl": True, "fc-fan-pwm": "0"}
|
||||
|
||||
def as_bosminer(self) -> dict:
|
||||
return {
|
||||
"fan_control": {"min_fans": 0},
|
||||
@@ -257,34 +239,6 @@ class FanModeConfig(MinerConfigOption):
|
||||
else:
|
||||
return cls.default()
|
||||
|
||||
@classmethod
|
||||
def from_hiveon_modern(cls, web_conf: dict):
|
||||
if web_conf.get("bitmain-fan-ctrl") is not None:
|
||||
fan_manual = web_conf["bitmain-fan-ctrl"]
|
||||
if fan_manual:
|
||||
speed = int(web_conf["bitmain-fan-pwm"])
|
||||
if speed == 0:
|
||||
return cls.immersion()
|
||||
return cls.manual(speed=speed)
|
||||
else:
|
||||
return cls.normal()
|
||||
else:
|
||||
return cls.default()
|
||||
|
||||
@classmethod
|
||||
def from_elphapex(cls, web_conf: dict):
|
||||
if web_conf.get("fc-fan-ctrl") is not None:
|
||||
fan_manual = web_conf["fc-fan-ctrl"]
|
||||
if fan_manual:
|
||||
speed = int(web_conf["fc-fan-pwm"])
|
||||
if speed == 0:
|
||||
return cls.immersion()
|
||||
return cls.manual(speed=speed)
|
||||
else:
|
||||
return cls.normal()
|
||||
else:
|
||||
return cls.default()
|
||||
|
||||
@classmethod
|
||||
def from_epic(cls, web_conf: dict):
|
||||
try:
|
||||
@@ -388,7 +342,7 @@ class FanModeConfig(MinerConfigOption):
|
||||
return cls.default()
|
||||
|
||||
@classmethod
|
||||
def from_espminer(cls, web_system_info: dict):
|
||||
def from_bitaxe(cls, web_system_info: dict):
|
||||
if web_system_info["autofanspeed"] == 1:
|
||||
return cls.normal()
|
||||
else:
|
||||
|
||||
@@ -52,14 +52,6 @@ class MiningModeNormal(MinerConfigValue):
|
||||
return {"miner-mode": "0"}
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
if settings.get("antminer_mining_mode_as_str", False):
|
||||
return {"miner-mode": "0"}
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_wm(self) -> dict:
|
||||
return {"mode": self.mode}
|
||||
|
||||
@@ -95,14 +87,6 @@ class MiningModeSleep(MinerConfigValue):
|
||||
return {"miner-mode": "1"}
|
||||
return {"miner-mode": 1}
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
if settings.get("antminer_mining_mode_as_str", False):
|
||||
return {"miner-mode": "1"}
|
||||
return {"miner-mode": 1}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {"miner-mode": 1}
|
||||
|
||||
def as_wm(self) -> dict:
|
||||
return {"mode": self.mode}
|
||||
|
||||
@@ -135,14 +119,6 @@ class MiningModeLPM(MinerConfigValue):
|
||||
return {"miner-mode": "3"}
|
||||
return {"miner-mode": 3}
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
if settings.get("antminer_mining_mode_as_str", False):
|
||||
return {"miner-mode": "3"}
|
||||
return {"miner-mode": 3}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {"miner-mode": 3}
|
||||
|
||||
def as_wm(self) -> dict:
|
||||
return {"mode": self.mode}
|
||||
|
||||
@@ -165,14 +141,6 @@ class MiningModeHPM(MinerConfigValue):
|
||||
return {"miner-mode": "0"}
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
if settings.get("antminer_mining_mode_as_str", False):
|
||||
return {"miner-mode": "0"}
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_wm(self) -> dict:
|
||||
return {"mode": self.mode}
|
||||
|
||||
@@ -206,14 +174,6 @@ class MiningModePowerTune(MinerConfigValue):
|
||||
return {"miner-mode": "0"}
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
if settings.get("antminer_mining_mode_as_str", False):
|
||||
return {"miner-mode": "0"}
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_wm(self) -> dict:
|
||||
if self.power is not None:
|
||||
return {"mode": self.mode, self.mode: {"wattage": self.power}}
|
||||
@@ -313,14 +273,6 @@ class MiningModeHashrateTune(MinerConfigValue):
|
||||
return {"miner-mode": "0"}
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
if settings.get("antminer_mining_mode_as_str", False):
|
||||
return {"miner-mode": "0"}
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_bosminer(self) -> dict:
|
||||
conf = {"enabled": True, "mode": "hashrate_target"}
|
||||
if self.hashrate is not None:
|
||||
@@ -416,10 +368,12 @@ class MiningModePreset(MinerConfigValue):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_luxos(cls, rpc_config: dict, rpc_profiles: dict) -> "MiningModePreset":
|
||||
def from_luxos(
|
||||
cls, rpc_config: dict, rpc_profiles: list[dict]
|
||||
) -> "MiningModePreset":
|
||||
active_preset = cls.get_active_preset_from_luxos(rpc_config, rpc_profiles)
|
||||
return cls(
|
||||
active_preset=active_preset,
|
||||
active_preset=MiningPreset.from_luxos(active_preset),
|
||||
available_presets=[
|
||||
MiningPreset.from_luxos(p) for p in rpc_profiles["PROFILES"]
|
||||
],
|
||||
@@ -427,14 +381,14 @@ class MiningModePreset(MinerConfigValue):
|
||||
|
||||
@classmethod
|
||||
def get_active_preset_from_luxos(
|
||||
cls, rpc_config: dict, rpc_profiles: dict
|
||||
) -> MiningPreset:
|
||||
cls, rpc_config: dict, rpc_profiles: list[dict]
|
||||
) -> dict:
|
||||
active_preset = None
|
||||
active_profile = rpc_config["CONFIG"][0]["Profile"]
|
||||
for profile in rpc_profiles["PROFILES"]:
|
||||
if profile["Profile Name"] == active_profile:
|
||||
active_preset = profile
|
||||
return MiningPreset.from_luxos(active_preset)
|
||||
return active_preset
|
||||
|
||||
|
||||
class ManualBoardSettings(MinerConfigValue):
|
||||
@@ -450,14 +404,6 @@ class ManualBoardSettings(MinerConfigValue):
|
||||
return {"miner-mode": "0"}
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_hiveon_modern(self) -> dict:
|
||||
if settings.get("antminer_mining_mode_as_str", False):
|
||||
return {"miner-mode": "0"}
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_vnish(self) -> dict:
|
||||
return {"freq": self.freq}
|
||||
|
||||
@@ -482,9 +428,6 @@ class MiningModeManual(MinerConfigValue):
|
||||
return {"miner-mode": "0"}
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_elphapex(self) -> dict:
|
||||
return {"miner-mode": 0}
|
||||
|
||||
def as_vnish(self) -> dict:
|
||||
chains = [b.as_vnish() for b in self.boards.values() if b.freq != 0]
|
||||
return {
|
||||
@@ -582,34 +525,6 @@ class MiningModeConfig(MinerConfigOption):
|
||||
return cls.low()
|
||||
return cls.default()
|
||||
|
||||
@classmethod
|
||||
def from_hiveon_modern(cls, web_conf: dict):
|
||||
if web_conf.get("bitmain-work-mode") is not None:
|
||||
work_mode = web_conf["bitmain-work-mode"]
|
||||
if work_mode == "":
|
||||
return cls.default()
|
||||
if int(work_mode) == 0:
|
||||
return cls.normal()
|
||||
elif int(work_mode) == 1:
|
||||
return cls.sleep()
|
||||
elif int(work_mode) == 3:
|
||||
return cls.low()
|
||||
return cls.default()
|
||||
|
||||
@classmethod
|
||||
def from_elphapex(cls, web_conf: dict):
|
||||
if web_conf.get("fc-work-mode") is not None:
|
||||
work_mode = web_conf["fc-work-mode"]
|
||||
if work_mode == "":
|
||||
return cls.default()
|
||||
if int(work_mode) == 0:
|
||||
return cls.normal()
|
||||
elif int(work_mode) == 1:
|
||||
return cls.sleep()
|
||||
elif int(work_mode) == 3:
|
||||
return cls.low()
|
||||
return cls.default()
|
||||
|
||||
@classmethod
|
||||
def from_epic(cls, web_conf: dict):
|
||||
try:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import field
|
||||
from dataclasses import dataclass, field
|
||||
from typing import TypeVar, Union
|
||||
|
||||
from pyasic.config.base import MinerConfigOption, MinerConfigValue
|
||||
|
||||
@@ -24,14 +24,7 @@ class MiningPreset(MinerConfigValue):
|
||||
hashrate = None
|
||||
else:
|
||||
power = hr_power_split[0].replace("watt", "").strip()
|
||||
hashrate = (
|
||||
hr_power_split[1]
|
||||
.replace("TH", "")
|
||||
.replace("GH", "")
|
||||
.replace("MH", "")
|
||||
.replace(" LC", "")
|
||||
.strip()
|
||||
)
|
||||
hashrate = hr_power_split[1].replace("TH", "").replace(" LC", "").strip()
|
||||
tuned = web_preset["status"] == "tuned"
|
||||
modded_psu = web_preset["modded_psu_required"]
|
||||
return cls(
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from pyasic.config.base import MinerConfigValue
|
||||
|
||||
|
||||
|
||||
@@ -43,20 +43,6 @@ class Pool(MinerConfigValue):
|
||||
"pass": self.password,
|
||||
}
|
||||
|
||||
def as_hiveon_modern(self, user_suffix: str | None = None) -> dict:
|
||||
return {
|
||||
"url": self.url,
|
||||
"user": f"{self.user}{user_suffix or ''}",
|
||||
"pass": self.password,
|
||||
}
|
||||
|
||||
def as_elphapex(self, user_suffix: str | None = None) -> dict:
|
||||
return {
|
||||
"url": self.url,
|
||||
"user": f"{self.user}{user_suffix or ''}",
|
||||
"pass": self.password,
|
||||
}
|
||||
|
||||
def as_wm(self, idx: int = 1, user_suffix: str | None = None) -> dict:
|
||||
return {
|
||||
f"pool_{idx}": self.url,
|
||||
@@ -116,7 +102,7 @@ class Pool(MinerConfigValue):
|
||||
"pass": self.password,
|
||||
}
|
||||
|
||||
def as_espminer(self, user_suffix: str | None = None) -> dict:
|
||||
def as_bitaxe(self, user_suffix: str | None = None) -> dict:
|
||||
return {
|
||||
"stratumURL": self.url,
|
||||
"stratumUser": f"{self.user}{user_suffix or ''}",
|
||||
@@ -160,18 +146,6 @@ class Pool(MinerConfigValue):
|
||||
url=web_pool["url"], user=web_pool["user"], password=web_pool["pass"]
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_hiveon_modern(cls, web_pool: dict) -> "Pool":
|
||||
return cls(
|
||||
url=web_pool["url"], user=web_pool["user"], password=web_pool["pass"]
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_elphapex(cls, web_pool: dict) -> "Pool":
|
||||
return cls(
|
||||
url=web_pool["url"], user=web_pool["user"], password=web_pool["pass"]
|
||||
)
|
||||
|
||||
# TODO: check if this is accurate, user/username, pass/password
|
||||
@classmethod
|
||||
def from_goldshell(cls, web_pool: dict) -> "Pool":
|
||||
@@ -218,7 +192,7 @@ class Pool(MinerConfigValue):
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_espminer(cls, web_system_info: dict) -> "Pool":
|
||||
def from_bitaxe(cls, web_system_info: dict) -> "Pool":
|
||||
url = f"stratum+tcp://{web_system_info['stratumURL']}:{web_system_info['stratumPort']}"
|
||||
return cls(
|
||||
url=url,
|
||||
@@ -261,28 +235,6 @@ class PoolGroup(MinerConfigValue):
|
||||
idx += 1
|
||||
return pools
|
||||
|
||||
def as_hiveon_modern(self, user_suffix: str | None = None) -> list:
|
||||
pools = []
|
||||
idx = 0
|
||||
while idx < 3:
|
||||
if len(self.pools) > idx:
|
||||
pools.append(self.pools[idx].as_hiveon_modern(user_suffix=user_suffix))
|
||||
else:
|
||||
pools.append(Pool(url="", user="", password="").as_hiveon_modern())
|
||||
idx += 1
|
||||
return pools
|
||||
|
||||
def as_elphapex(self, user_suffix: str | None = None) -> list:
|
||||
pools = []
|
||||
idx = 0
|
||||
while idx < 3:
|
||||
if len(self.pools) > idx:
|
||||
pools.append(self.pools[idx].as_elphapex(user_suffix=user_suffix))
|
||||
else:
|
||||
pools.append(Pool(url="", user="", password="").as_elphapex())
|
||||
idx += 1
|
||||
return pools
|
||||
|
||||
def as_wm(self, user_suffix: str | None = None) -> dict:
|
||||
pools = {}
|
||||
idx = 0
|
||||
@@ -354,8 +306,8 @@ class PoolGroup(MinerConfigValue):
|
||||
def as_mara(self, user_suffix: str | None = None) -> list:
|
||||
return [p.as_mara(user_suffix=user_suffix) for p in self.pools]
|
||||
|
||||
def as_espminer(self, user_suffix: str | None = None) -> dict:
|
||||
return self.pools[0].as_espminer(user_suffix=user_suffix)
|
||||
def as_bitaxe(self, user_suffix: str | None = None) -> dict:
|
||||
return self.pools[0].as_bitaxe(user_suffix=user_suffix)
|
||||
|
||||
def as_boser(self, user_suffix: str | None = None) -> PoolGroupConfiguration:
|
||||
return PoolGroupConfiguration(
|
||||
@@ -399,20 +351,6 @@ class PoolGroup(MinerConfigValue):
|
||||
pools.append(Pool.from_am_modern(pool))
|
||||
return cls(pools=pools)
|
||||
|
||||
@classmethod
|
||||
def from_hiveon_modern(cls, web_pool_list: list) -> "PoolGroup":
|
||||
pools = []
|
||||
for pool in web_pool_list:
|
||||
pools.append(Pool.from_hiveon_modern(pool))
|
||||
return cls(pools=pools)
|
||||
|
||||
@classmethod
|
||||
def from_elphapex(cls, web_pool_list: list) -> "PoolGroup":
|
||||
pools = []
|
||||
for pool in web_pool_list:
|
||||
pools.append(Pool.from_elphapex(pool))
|
||||
return cls(pools=pools)
|
||||
|
||||
@classmethod
|
||||
def from_goldshell(cls, web_pools: list) -> "PoolGroup":
|
||||
return cls(pools=[Pool.from_goldshell(p) for p in web_pools])
|
||||
@@ -457,8 +395,8 @@ class PoolGroup(MinerConfigValue):
|
||||
return cls(pools=[Pool.from_mara(pool_conf) for pool_conf in web_config_pools])
|
||||
|
||||
@classmethod
|
||||
def from_espminer(cls, web_system_info: dict) -> "PoolGroup":
|
||||
return cls(pools=[Pool.from_espminer(web_system_info)])
|
||||
def from_bitaxe(cls, web_system_info: dict) -> "PoolGroup":
|
||||
return cls(pools=[Pool.from_bitaxe(web_system_info)])
|
||||
|
||||
@classmethod
|
||||
def from_iceriver(cls, web_userpanel: dict) -> "PoolGroup":
|
||||
@@ -498,16 +436,6 @@ class PoolConfig(MinerConfigValue):
|
||||
return {"pools": self.groups[0].as_am_modern(user_suffix=user_suffix)}
|
||||
return {"pools": PoolGroup().as_am_modern()}
|
||||
|
||||
def as_hiveon_modern(self, user_suffix: str | None = None) -> dict:
|
||||
if len(self.groups) > 0:
|
||||
return {"pools": self.groups[0].as_hiveon_modern(user_suffix=user_suffix)}
|
||||
return {"pools": PoolGroup().as_hiveon_modern()}
|
||||
|
||||
def as_elphapex(self, user_suffix: str | None = None) -> dict:
|
||||
if len(self.groups) > 0:
|
||||
return {"pools": self.groups[0].as_elphapex(user_suffix=user_suffix)}
|
||||
return {"pools": PoolGroup().as_elphapex()}
|
||||
|
||||
def as_wm(self, user_suffix: str | None = None) -> dict:
|
||||
if len(self.groups) > 0:
|
||||
return {"pools": self.groups[0].as_wm(user_suffix=user_suffix)}
|
||||
@@ -579,8 +507,8 @@ class PoolConfig(MinerConfigValue):
|
||||
return {"pools": self.groups[0].as_mara(user_suffix=user_suffix)}
|
||||
return {"pools": []}
|
||||
|
||||
def as_espminer(self, user_suffix: str | None = None) -> dict:
|
||||
return self.groups[0].as_espminer(user_suffix=user_suffix)
|
||||
def as_bitaxe(self, user_suffix: str | None = None) -> dict:
|
||||
return self.groups[0].as_bitaxe(user_suffix=user_suffix)
|
||||
|
||||
def as_luxos(self, user_suffix: str | None = None) -> dict:
|
||||
return {}
|
||||
@@ -605,27 +533,9 @@ class PoolConfig(MinerConfigValue):
|
||||
|
||||
@classmethod
|
||||
def from_am_modern(cls, web_conf: dict) -> "PoolConfig":
|
||||
try:
|
||||
pool_data = web_conf["pools"]
|
||||
except KeyError:
|
||||
return cls(groups=[])
|
||||
|
||||
return cls(groups=[PoolGroup.from_am_modern(pool_data)])
|
||||
|
||||
@classmethod
|
||||
def from_hiveon_modern(cls, web_conf: dict) -> "PoolConfig":
|
||||
try:
|
||||
pool_data = web_conf["pools"]
|
||||
except KeyError:
|
||||
return cls(groups=[])
|
||||
|
||||
return cls(groups=[PoolGroup.from_hiveon_modern(pool_data)])
|
||||
|
||||
@classmethod
|
||||
def from_elphapex(cls, web_conf: dict) -> "PoolConfig":
|
||||
pool_data = web_conf["pools"]
|
||||
|
||||
return cls(groups=[PoolGroup.from_elphapex(pool_data)])
|
||||
return cls(groups=[PoolGroup.from_am_modern(pool_data)])
|
||||
|
||||
@classmethod
|
||||
def from_goldshell(cls, web_pools: list) -> "PoolConfig":
|
||||
@@ -666,8 +576,8 @@ class PoolConfig(MinerConfigValue):
|
||||
return cls(groups=[PoolGroup.from_mara(web_config["pools"])])
|
||||
|
||||
@classmethod
|
||||
def from_espminer(cls, web_system_info: dict) -> "PoolConfig":
|
||||
return cls(groups=[PoolGroup.from_espminer(web_system_info)])
|
||||
def from_bitaxe(cls, web_system_info: dict) -> "PoolConfig":
|
||||
return cls(groups=[PoolGroup.from_bitaxe(web_system_info)])
|
||||
|
||||
@classmethod
|
||||
def from_iceriver(cls, web_userpanel: dict) -> "PoolConfig":
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from pyasic.config.base import MinerConfigValue
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import copy
|
||||
import time
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any
|
||||
from typing import Any, List, Union
|
||||
|
||||
from pydantic import BaseModel, Field, computed_field
|
||||
|
||||
@@ -24,11 +24,12 @@ from pyasic.config import MinerConfig
|
||||
from pyasic.config.mining import MiningModePowerTune
|
||||
from pyasic.data.pools import PoolMetrics, Scheme
|
||||
from pyasic.device.algorithm.hashrate import AlgoHashRateType
|
||||
from pyasic.device.algorithm.hashrate.base import GenericHashrate
|
||||
|
||||
from ..device.algorithm.hashrate.unit.base import GenericUnit
|
||||
from .boards import HashBoard
|
||||
from .device import DeviceInfo
|
||||
from .error_codes import BraiinsOSError, InnosiliconError, WhatsminerError, X19Error
|
||||
from .error_codes.base import BaseMinerError
|
||||
from .fans import Fan
|
||||
|
||||
|
||||
@@ -108,18 +109,25 @@ class MinerData(BaseModel):
|
||||
raw_wattage_limit: int | None = Field(exclude=True, default=None, repr=False)
|
||||
|
||||
# fans
|
||||
fans: list[Fan] = Field(default_factory=list)
|
||||
fans: List[Fan] = Field(default_factory=list)
|
||||
fan_psu: int | None = None
|
||||
|
||||
# boards
|
||||
hashboards: list[HashBoard] = Field(default_factory=list)
|
||||
hashboards: List[HashBoard] = Field(default_factory=list)
|
||||
|
||||
# config
|
||||
config: MinerConfig | None = None
|
||||
fault_light: bool | None = None
|
||||
|
||||
# errors
|
||||
errors: list[BaseMinerError] = Field(default_factory=list)
|
||||
errors: List[
|
||||
Union[
|
||||
WhatsminerError,
|
||||
BraiinsOSError,
|
||||
X19Error,
|
||||
InnosiliconError,
|
||||
]
|
||||
] = Field(default_factory=list)
|
||||
|
||||
# mining state
|
||||
is_mining: bool = True
|
||||
@@ -129,10 +137,8 @@ class MinerData(BaseModel):
|
||||
pools: list[PoolMetrics] = Field(default_factory=list)
|
||||
|
||||
@classmethod
|
||||
def fields(cls) -> set:
|
||||
all_fields = set(cls.model_fields.keys())
|
||||
all_fields.update(set(cls.model_computed_fields.keys()))
|
||||
return all_fields
|
||||
def fields(cls):
|
||||
return list(cls.model_fields.keys())
|
||||
|
||||
def get(self, __key: str, default: Any = None):
|
||||
try:
|
||||
@@ -303,25 +309,25 @@ class MinerData(BaseModel):
|
||||
|
||||
@computed_field # type: ignore[misc]
|
||||
@property
|
||||
def make(self) -> str | None:
|
||||
def make(self) -> str:
|
||||
if self.device_info.make is not None:
|
||||
return str(self.device_info.make)
|
||||
|
||||
@computed_field # type: ignore[misc]
|
||||
@property
|
||||
def model(self) -> str | None:
|
||||
def model(self) -> str:
|
||||
if self.device_info.model is not None:
|
||||
return str(self.device_info.model)
|
||||
|
||||
@computed_field # type: ignore[misc]
|
||||
@property
|
||||
def firmware(self) -> str | None:
|
||||
def firmware(self) -> str:
|
||||
if self.device_info.firmware is not None:
|
||||
return str(self.device_info.firmware)
|
||||
|
||||
@computed_field # type: ignore[misc]
|
||||
@property
|
||||
def algo(self) -> str | None:
|
||||
def algo(self) -> str:
|
||||
if self.device_info.algo is not None:
|
||||
return str(self.device_info.algo)
|
||||
|
||||
@@ -361,9 +367,7 @@ class MinerData(BaseModel):
|
||||
data_list = [str(data[item]) for item in data]
|
||||
return ",".join(data_list)
|
||||
|
||||
def as_influxdb(
|
||||
self, measurement_name: str = "miner_data", level_delimiter: str = "."
|
||||
) -> str:
|
||||
def as_influxdb(self, measurement_name: str = "miner_data") -> str:
|
||||
"""Get this dataclass as [influxdb line protocol](https://docs.influxdata.com/influxdb/v2.4/reference/syntax/line-protocol/).
|
||||
|
||||
Parameters:
|
||||
@@ -372,127 +376,54 @@ class MinerData(BaseModel):
|
||||
Returns:
|
||||
A influxdb line protocol version of this class.
|
||||
"""
|
||||
|
||||
def serialize_int(key: str, value: int) -> str:
|
||||
return f"{key}={value}"
|
||||
|
||||
def serialize_float(key: str, value: float) -> str:
|
||||
return f"{key}={value}"
|
||||
|
||||
def serialize_str(key: str, value: str) -> str:
|
||||
return f'{key}="{value}"'
|
||||
|
||||
def serialize_algo_hash_rate(key: str, value: AlgoHashRateType) -> str:
|
||||
return f"{key}={round(float(value), 2)}"
|
||||
|
||||
def serialize_list(key: str, value: list[Any]) -> str | None:
|
||||
if len(value) == 0:
|
||||
return None
|
||||
|
||||
list_field_data = []
|
||||
for idx, list_field_val in enumerate(value):
|
||||
item_serialization_func = serialization_map.get(
|
||||
type(list_field_val), lambda _k, _v: None
|
||||
)
|
||||
item_serialized = item_serialization_func(
|
||||
f"{key}{level_delimiter}{idx}", list_field_val
|
||||
)
|
||||
if item_serialized is not None:
|
||||
list_field_data.append(item_serialized)
|
||||
continue
|
||||
for dt in serialization_map_instance:
|
||||
if item_serialized is None:
|
||||
if isinstance(list_field_val, dt):
|
||||
item_serialized = serialization_map_instance[dt](
|
||||
f"{key}{level_delimiter}{idx}", list_field_val
|
||||
)
|
||||
if item_serialized is not None:
|
||||
list_field_data.append(item_serialized)
|
||||
return ",".join(list_field_data)
|
||||
|
||||
def serialize_miner_error(key: str, value: BaseMinerError):
|
||||
return value.as_influxdb(key, level_delimiter=level_delimiter)
|
||||
|
||||
def serialize_fan(key: str, value: Fan) -> str:
|
||||
return f"{key}{level_delimiter}speed={value.speed}"
|
||||
|
||||
def serialize_hashboard(key: str, value: HashBoard) -> str:
|
||||
return value.as_influxdb(key, level_delimiter=level_delimiter)
|
||||
|
||||
def serialize_bool(key: str, value: bool):
|
||||
return f"{key}={str(value).lower()}"
|
||||
|
||||
def serialize_pool_metrics(key: str, value: PoolMetrics):
|
||||
return value.as_influxdb(key, level_delimiter=level_delimiter)
|
||||
|
||||
include = [
|
||||
"uptime",
|
||||
"expected_hashrate",
|
||||
"hashrate",
|
||||
"hashboards",
|
||||
"temperature_avg",
|
||||
"env_temp",
|
||||
"wattage",
|
||||
"wattage_limit",
|
||||
"voltage",
|
||||
"fans",
|
||||
"expected_fans",
|
||||
"fan_psu",
|
||||
"total_chips",
|
||||
"expected_chips",
|
||||
"efficiency",
|
||||
"fault_light",
|
||||
"is_mining",
|
||||
"errors",
|
||||
"pools",
|
||||
]
|
||||
|
||||
serialization_map_instance = {
|
||||
AlgoHashRateType: serialize_algo_hash_rate,
|
||||
BaseMinerError: serialize_miner_error,
|
||||
}
|
||||
serialization_map = {
|
||||
int: serialize_int,
|
||||
float: serialize_float,
|
||||
str: serialize_str,
|
||||
bool: serialize_bool,
|
||||
list: serialize_list,
|
||||
Fan: serialize_fan,
|
||||
HashBoard: serialize_hashboard,
|
||||
PoolMetrics: serialize_pool_metrics,
|
||||
}
|
||||
|
||||
tag_data = [
|
||||
measurement_name,
|
||||
f"ip={str(self.ip)}",
|
||||
f"mac={str(self.mac)}",
|
||||
f"make={str(self.make)}",
|
||||
f"model={str(self.model)}",
|
||||
f"firmware={str(self.firmware)}",
|
||||
f"algo={str(self.algo)}",
|
||||
]
|
||||
tag_data = [measurement_name]
|
||||
field_data = []
|
||||
|
||||
for field in include:
|
||||
field_val = getattr(self, field)
|
||||
serialization_func = serialization_map.get(
|
||||
type(field_val), lambda _k, _v: None
|
||||
)
|
||||
serialized = serialization_func(field, field_val)
|
||||
if serialized is not None:
|
||||
field_data.append(serialized)
|
||||
tags = ["ip", "mac", "model", "hostname"]
|
||||
for attribute in self.fields():
|
||||
if attribute in tags:
|
||||
escaped_data = self.get(attribute, "Unknown").replace(" ", "\\ ")
|
||||
tag_data.append(f"{attribute}={escaped_data}")
|
||||
continue
|
||||
for datatype in serialization_map_instance:
|
||||
if serialized is None:
|
||||
if isinstance(field_val, datatype):
|
||||
serialized = serialization_map_instance[datatype](
|
||||
field, field_val
|
||||
)
|
||||
if serialized is not None:
|
||||
field_data.append(serialized)
|
||||
elif str(attribute).startswith("_"):
|
||||
continue
|
||||
elif isinstance(self[attribute], str):
|
||||
field_data.append(f'{attribute}="{self[attribute]}"')
|
||||
continue
|
||||
elif isinstance(self[attribute], bool):
|
||||
field_data.append(f"{attribute}={str(self[attribute]).lower()}")
|
||||
continue
|
||||
elif isinstance(self[attribute], int):
|
||||
field_data.append(f"{attribute}={self[attribute]}")
|
||||
continue
|
||||
elif isinstance(self[attribute], float):
|
||||
field_data.append(f"{attribute}={self[attribute]}")
|
||||
continue
|
||||
elif attribute == "errors":
|
||||
for idx, item in enumerate(self[attribute]):
|
||||
field_data.append(f'error_{idx+1}="{item.error_message}"')
|
||||
elif attribute == "hashboards":
|
||||
for idx, item in enumerate(self[attribute]):
|
||||
field_data.append(
|
||||
f"hashboard_{idx+1}_hashrate={item.get('hashrate', 0.0)}"
|
||||
)
|
||||
field_data.append(
|
||||
f"hashboard_{idx+1}_temperature={item.get('temp', 0)}"
|
||||
)
|
||||
field_data.append(
|
||||
f"hashboard_{idx+1}_chip_temperature={item.get('chip_temp', 0)}"
|
||||
)
|
||||
field_data.append(f"hashboard_{idx+1}_chips={item.get('chips', 0)}")
|
||||
field_data.append(
|
||||
f"hashboard_{idx+1}_expected_chips={item.get('expected_chips', 0)}"
|
||||
)
|
||||
elif attribute == "fans":
|
||||
for idx, item in enumerate(self[attribute]):
|
||||
if item.speed is not None:
|
||||
field_data.append(f"fan_{idx+1}={item.speed}")
|
||||
|
||||
tags_str = ",".join(tag_data).replace(" ", "\\ ")
|
||||
field_str = ",".join(field_data).replace(" ", "\\ ")
|
||||
timestamp = str(self.timestamp * 10**9)
|
||||
tags_str = ",".join(tag_data)
|
||||
field_str = ",".join(field_data)
|
||||
timestamp = str(self.timestamp * 1e9)
|
||||
|
||||
return " ".join([tags_str, field_str, timestamp])
|
||||
|
||||
@@ -17,7 +17,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, field_serializer
|
||||
|
||||
from pyasic.device.algorithm.hashrate import AlgoHashRateType
|
||||
|
||||
@@ -51,12 +51,6 @@ class HashBoard(BaseModel):
|
||||
active: bool | None = None
|
||||
voltage: float | None = None
|
||||
|
||||
@classmethod
|
||||
def fields(cls) -> set:
|
||||
all_fields = set(cls.model_fields.keys())
|
||||
all_fields.update(set(cls.model_computed_fields.keys()))
|
||||
return all_fields
|
||||
|
||||
def get(self, __key: str, default: Any = None):
|
||||
try:
|
||||
val = self.__getitem__(__key)
|
||||
@@ -71,63 +65,3 @@ class HashBoard(BaseModel):
|
||||
return getattr(self, item)
|
||||
except AttributeError:
|
||||
raise KeyError(f"{item}")
|
||||
|
||||
def as_influxdb(self, key_root: str, level_delimiter: str = ".") -> str:
|
||||
|
||||
def serialize_int(key: str, value: int) -> str:
|
||||
return f"{key}={value}"
|
||||
|
||||
def serialize_float(key: str, value: float) -> str:
|
||||
return f"{key}={value}"
|
||||
|
||||
def serialize_str(key: str, value: str) -> str:
|
||||
return f'{key}="{value}"'
|
||||
|
||||
def serialize_algo_hash_rate(key: str, value: AlgoHashRateType) -> str:
|
||||
return f"{key}={round(float(value), 2)}"
|
||||
|
||||
def serialize_bool(key: str, value: bool):
|
||||
return f"{key}={str(value).lower()}"
|
||||
|
||||
serialization_map_instance = {
|
||||
AlgoHashRateType: serialize_algo_hash_rate,
|
||||
}
|
||||
serialization_map = {
|
||||
int: serialize_int,
|
||||
float: serialize_float,
|
||||
str: serialize_str,
|
||||
bool: serialize_bool,
|
||||
}
|
||||
|
||||
include = [
|
||||
"hashrate",
|
||||
"temp",
|
||||
"chip_temp",
|
||||
"chips",
|
||||
"expected_chips",
|
||||
"tuned",
|
||||
"active",
|
||||
"voltage",
|
||||
]
|
||||
|
||||
field_data = []
|
||||
for field in include:
|
||||
field_val = getattr(self, field)
|
||||
serialization_func = serialization_map.get(
|
||||
type(field_val), lambda _k, _v: None
|
||||
)
|
||||
serialized = serialization_func(
|
||||
f"{key_root}{level_delimiter}{field}", field_val
|
||||
)
|
||||
if serialized is not None:
|
||||
field_data.append(serialized)
|
||||
continue
|
||||
for datatype in serialization_map_instance:
|
||||
if serialized is None:
|
||||
if isinstance(field_val, datatype):
|
||||
serialized = serialization_map_instance[datatype](
|
||||
f"{key_root}{level_delimiter}{field}", field_val
|
||||
)
|
||||
if serialized is not None:
|
||||
field_data.append(serialized)
|
||||
return ",".join(field_data)
|
||||
|
||||
@@ -18,15 +18,9 @@ from typing import TypeVar
|
||||
|
||||
from .bos import BraiinsOSError
|
||||
from .innosilicon import InnosiliconError
|
||||
from .vnish import VnishError
|
||||
from .whatsminer import WhatsminerError
|
||||
from .X19 import X19Error
|
||||
|
||||
MinerErrorData = TypeVar(
|
||||
"MinerErrorData",
|
||||
WhatsminerError,
|
||||
BraiinsOSError,
|
||||
X19Error,
|
||||
InnosiliconError,
|
||||
VnishError,
|
||||
"MinerErrorData", WhatsminerError, BraiinsOSError, X19Error, InnosiliconError
|
||||
)
|
||||
|
||||
@@ -16,17 +16,3 @@ class BaseMinerError(BaseModel):
|
||||
A dictionary version of this class.
|
||||
"""
|
||||
return self.asdict()
|
||||
|
||||
def as_influxdb(self, root_key: str, level_delimiter: str = ".") -> str:
|
||||
field_data = []
|
||||
|
||||
if self.error_code is not None:
|
||||
field_data.append(
|
||||
f"{root_key}{level_delimiter}error_code={self.error_code}"
|
||||
)
|
||||
if self.error_message is not None:
|
||||
field_data.append(
|
||||
f'{root_key}{level_delimiter}error_message="{self.error_message}"'
|
||||
)
|
||||
|
||||
return ",".join(field_data)
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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.data.error_codes.base import BaseMinerError
|
||||
|
||||
|
||||
class VnishError(BaseMinerError):
|
||||
"""A Dataclass to handle error codes of Vnish miners.
|
||||
|
||||
Attributes:
|
||||
error_message: The error message as a string.
|
||||
error_code: The error code as an int. 0 if the message is not assigned a code.
|
||||
"""
|
||||
|
||||
error_message: str
|
||||
error_code: int = 0
|
||||
@@ -92,51 +92,3 @@ class PoolMetrics(BaseModel):
|
||||
if total == 0:
|
||||
return 0
|
||||
return (value / total) * 100
|
||||
|
||||
def as_influxdb(self, key_root: str, level_delimiter: str = ".") -> str:
|
||||
|
||||
def serialize_int(key: str, value: int) -> str:
|
||||
return f"{key}={value}"
|
||||
|
||||
def serialize_float(key: str, value: float) -> str:
|
||||
return f"{key}={value}"
|
||||
|
||||
def serialize_str(key: str, value: str) -> str:
|
||||
return f'{key}="{value}"'
|
||||
|
||||
def serialize_pool_url(key: str, value: str) -> str:
|
||||
return f'{key}="{str(value)}"'
|
||||
|
||||
def serialize_bool(key: str, value: bool):
|
||||
return f"{key}={str(value).lower()}"
|
||||
|
||||
serialization_map = {
|
||||
int: serialize_int,
|
||||
float: serialize_float,
|
||||
str: serialize_str,
|
||||
bool: serialize_bool,
|
||||
PoolUrl: serialize_pool_url,
|
||||
}
|
||||
|
||||
include = [
|
||||
"url",
|
||||
"accepted",
|
||||
"rejected",
|
||||
"active",
|
||||
"alive",
|
||||
"user",
|
||||
]
|
||||
|
||||
field_data = []
|
||||
for field in include:
|
||||
field_val = getattr(self, field)
|
||||
serialization_func = serialization_map.get(
|
||||
type(field_val), lambda _k, _v: None
|
||||
)
|
||||
serialized = serialization_func(
|
||||
f"{key_root}{level_delimiter}{field}", field_val
|
||||
)
|
||||
if serialized is not None:
|
||||
field_data.append(serialized)
|
||||
|
||||
return ",".join(field_data)
|
||||
|
||||
@@ -26,11 +26,9 @@ class MinerMake(str, Enum):
|
||||
AURADINE = "Auradine"
|
||||
EPIC = "ePIC"
|
||||
BITAXE = "BitAxe"
|
||||
LUCKYMINER = "LuckyMiner"
|
||||
ICERIVER = "IceRiver"
|
||||
HAMMER = "Hammer"
|
||||
VOLCMINER = "VolcMiner"
|
||||
ELPHAPEX = "Elphapex"
|
||||
BRAIINS = "Braiins"
|
||||
|
||||
def __str__(self):
|
||||
|
||||
@@ -59,7 +59,6 @@ class AntminerModels(MinerModelType):
|
||||
T19 = "T19"
|
||||
S21 = "S21"
|
||||
S21Pro = "S21 Pro"
|
||||
S21Hydro = "S21 Hydro"
|
||||
T21 = "T21"
|
||||
|
||||
def __str__(self):
|
||||
@@ -448,7 +447,6 @@ class AvalonminerModels(MinerModelType):
|
||||
Avalon1166Pro = "Avalon 1166 Pro"
|
||||
Avalon1126Pro = "Avalon 1126 Pro"
|
||||
Avalon1246 = "Avalon 1246"
|
||||
Avalon1566 = "Avalon 1566"
|
||||
AvalonNano3 = "Avalon Nano 3"
|
||||
|
||||
def __str__(self):
|
||||
@@ -509,14 +507,6 @@ class BitAxeModels(MinerModelType):
|
||||
return self.value
|
||||
|
||||
|
||||
class LuckyMinerModels(MinerModelType):
|
||||
LV07 = "LV07"
|
||||
LV08 = "LV08"
|
||||
|
||||
def __str__(self):
|
||||
return self.value
|
||||
|
||||
|
||||
class IceRiverModels(MinerModelType):
|
||||
KS0 = "KS0"
|
||||
KS1 = "KS1"
|
||||
@@ -551,10 +541,6 @@ class BraiinsModels(MinerModelType):
|
||||
BMM101 = "BMM101"
|
||||
|
||||
|
||||
class ElphapexModels(MinerModelType):
|
||||
DG1Plus = "DG1+"
|
||||
|
||||
|
||||
class MinerModel:
|
||||
ANTMINER = AntminerModels
|
||||
WHATSMINER = WhatsminerModels
|
||||
@@ -564,9 +550,7 @@ class MinerModel:
|
||||
AURADINE = AuradineModels
|
||||
EPIC = ePICModels
|
||||
BITAXE = BitAxeModels
|
||||
LUCKYMINER = LuckyMinerModels
|
||||
ICERIVER = IceRiverModels
|
||||
HAMMER = HammerModels
|
||||
VOLCMINER = VolcMinerModels
|
||||
ELPHAPEX = ElphapexModels
|
||||
BRAIINS = BraiinsModels
|
||||
|
||||
@@ -21,5 +21,4 @@ from .epic import *
|
||||
from .hiveon import *
|
||||
from .luxos import *
|
||||
from .marathon import *
|
||||
from .mskminer import *
|
||||
from .vnish import *
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
from pyasic.miners.backends import AntminerModern
|
||||
from pyasic.miners.device.models import S21, S21Hydro, S21Pro
|
||||
from pyasic.miners.device.models import S21, S21Pro
|
||||
|
||||
|
||||
class BMMinerS21(AntminerModern, S21):
|
||||
@@ -24,7 +24,3 @@ class BMMinerS21(AntminerModern, S21):
|
||||
|
||||
class BMMinerS21Pro(AntminerModern, S21Pro):
|
||||
pass
|
||||
|
||||
|
||||
class BMMinerS21Hydro(AntminerModern, S21Hydro):
|
||||
pass
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from .S21 import BMMinerS21, BMMinerS21Hydro, BMMinerS21Pro
|
||||
from .S21 import BMMinerS21, BMMinerS21Pro
|
||||
from .T21 import BMMinerT21
|
||||
|
||||
@@ -15,12 +15,8 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
from pyasic.miners.backends import BOSer
|
||||
from pyasic.miners.device.models import S21, S21Pro
|
||||
from pyasic.miners.device.models import S21
|
||||
|
||||
|
||||
class BOSMinerS21(BOSer, S21):
|
||||
pass
|
||||
|
||||
|
||||
class BOSMinerS21Pro(BOSer, S21Pro):
|
||||
pass
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
from .S21 import BOSMinerS21, BOSMinerS21Pro
|
||||
from .S21 import BOSMinerS21
|
||||
from .T21 import BOSMinerT21
|
||||
|
||||
@@ -27,7 +27,6 @@ from pyasic.miners.device.models import (
|
||||
S19jNoPIC,
|
||||
S19jPro,
|
||||
S19KPro,
|
||||
S19NoPIC,
|
||||
S19Plus,
|
||||
S19Pro,
|
||||
S19ProHydro,
|
||||
@@ -40,10 +39,6 @@ class HiveonS19(HiveonModern, S19):
|
||||
pass
|
||||
|
||||
|
||||
class HiveonS19NoPIC(HiveonModern, S19NoPIC):
|
||||
pass
|
||||
|
||||
|
||||
class HiveonS19Plus(HiveonModern, S19Plus):
|
||||
pass
|
||||
|
||||
@@ -100,5 +95,5 @@ class HiveonS19ProPlusHydro(HiveonModern, S19ProPlusHydro):
|
||||
pass
|
||||
|
||||
|
||||
class HiveonS19kPro(HiveonModern, S19KPro):
|
||||
class HiveonS19KPro(HiveonModern, S19KPro):
|
||||
pass
|
||||
|
||||
@@ -23,9 +23,8 @@ from .S19 import (
|
||||
HiveonS19j,
|
||||
HiveonS19jNoPIC,
|
||||
HiveonS19jPro,
|
||||
HiveonS19kPro,
|
||||
HiveonS19KPro,
|
||||
HiveonS19L,
|
||||
HiveonS19NoPIC,
|
||||
HiveonS19Plus,
|
||||
HiveonS19Pro,
|
||||
HiveonS19ProHydro,
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
import asyncssh
|
||||
|
||||
from pyasic.data import HashBoard
|
||||
from pyasic.device.algorithm import AlgoHashRate, HashUnit
|
||||
from pyasic.errors import APIError
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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.mskminer import MSKMiner
|
||||
from pyasic.miners.device.models import (
|
||||
S19NoPIC,
|
||||
)
|
||||
|
||||
|
||||
class MSKMinerS19NoPIC(MSKMiner, S19NoPIC):
|
||||
pass
|
||||
@@ -1,17 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 .S19 import MSKMinerS19NoPIC
|
||||
@@ -1,17 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 .X19 import *
|
||||
@@ -1,22 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 AvalonMiner
|
||||
from pyasic.miners.device.models import Avalon1566
|
||||
|
||||
|
||||
class CGMinerAvalon1566(AvalonMiner, Avalon1566):
|
||||
pass
|
||||
@@ -1,17 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 .A1566 import CGMinerAvalon1566
|
||||
@@ -20,5 +20,4 @@ from .A9X import *
|
||||
from .A10X import *
|
||||
from .A11X import *
|
||||
from .A12X import *
|
||||
from .A15X import *
|
||||
from .nano import *
|
||||
|
||||
@@ -13,95 +13,10 @@
|
||||
# See the License for the specific language governing permissions and -
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
from typing import Optional
|
||||
|
||||
from pyasic import APIError
|
||||
from pyasic.miners.backends import AvalonMiner
|
||||
from pyasic.miners.data import (
|
||||
DataFunction,
|
||||
DataLocations,
|
||||
DataOptions,
|
||||
RPCAPICommand,
|
||||
WebAPICommand,
|
||||
)
|
||||
from pyasic.miners.device.models import AvalonNano3
|
||||
from pyasic.web.avalonminer import AvalonMinerWebAPI
|
||||
|
||||
AVALON_NANO_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction(
|
||||
"_get_mac",
|
||||
[WebAPICommand("web_minerinfo", "get_minerinfo")],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("rpc_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver",
|
||||
[RPCAPICommand("rpc_version", "version")],
|
||||
),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("rpc_devs", "devs")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.ENVIRONMENT_TEMP): DataFunction(
|
||||
"_get_env_temp",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.WATTAGE_LIMIT): DataFunction(
|
||||
"_get_wattage_limit",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction(
|
||||
"_get_fault_light",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.POOLS): DataFunction(
|
||||
"_get_pools",
|
||||
[RPCAPICommand("rpc_pools", "pools")],
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class CGMinerAvalonNano3(AvalonMiner, AvalonNano3):
|
||||
_web_cls = AvalonMinerWebAPI
|
||||
web: AvalonMinerWebAPI
|
||||
|
||||
data_locations = AVALON_NANO_DATA_LOC
|
||||
|
||||
async def _get_mac(self, web_minerinfo: dict) -> Optional[dict]:
|
||||
if web_minerinfo is None:
|
||||
try:
|
||||
web_minerinfo = await self.web.minerinfo()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if web_minerinfo is not None:
|
||||
try:
|
||||
mac = web_minerinfo.get("mac")
|
||||
if mac is not None:
|
||||
return mac.upper()
|
||||
except (KeyError, ValueError):
|
||||
pass
|
||||
pass
|
||||
|
||||
@@ -22,17 +22,14 @@ from .bmminer import BMMiner
|
||||
from .braiins_os import BOSer, BOSMiner
|
||||
from .btminer import BTMiner
|
||||
from .cgminer import CGMiner
|
||||
from .elphapex import ElphapexMiner
|
||||
from .epic import ePIC
|
||||
from .goldshell import GoldshellMiner
|
||||
from .hammer import BlackMiner
|
||||
from .hiveon import HiveonModern, HiveonOld
|
||||
from .iceriver import IceRiver
|
||||
from .innosilicon import Innosilicon
|
||||
from .luckyminer import LuckyMiner
|
||||
from .luxminer import LUXMiner
|
||||
from .marathon import MaraMiner
|
||||
from .mskminer import MSKMiner
|
||||
from .unknown import UnknownMiner
|
||||
from .vnish import VNish
|
||||
from .whatsminer import M2X, M3X, M5X, M6X, M7X
|
||||
|
||||
@@ -75,10 +75,6 @@ ANTMINER_MODERN_DATA_LOC = DataLocations(
|
||||
"_get_fault_light",
|
||||
[WebAPICommand("web_get_blink_status", "get_blink_status")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards",
|
||||
[],
|
||||
),
|
||||
str(DataOptions.IS_MINING): DataFunction(
|
||||
"_is_mining",
|
||||
[WebAPICommand("web_get_conf", "get_miner_conf")],
|
||||
|
||||
@@ -57,10 +57,6 @@ AVALON_DATA_LOC = DataLocations(
|
||||
"_get_wattage_limit",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
@@ -104,23 +100,6 @@ class AvalonMiner(CGMiner):
|
||||
return True
|
||||
return False
|
||||
|
||||
async def set_power_limit(self, wattage: int) -> bool:
|
||||
try:
|
||||
if wattage < 3:
|
||||
limit = wattage
|
||||
elif wattage > 100:
|
||||
limit = 2
|
||||
elif wattage > 80:
|
||||
limit = 1
|
||||
else:
|
||||
limit = 0
|
||||
data = await self.rpc.ascset(0, "worklevel,set", 1)
|
||||
except APIError:
|
||||
return False
|
||||
if data["STATUS"][0]["Msg"] == "ASC 0 set OK":
|
||||
return True
|
||||
return False
|
||||
|
||||
async def reboot(self) -> bool:
|
||||
try:
|
||||
data = await self.rpc.restart()
|
||||
@@ -310,21 +289,6 @@ class AvalonMiner(CGMiner):
|
||||
except (IndexError, KeyError, ValueError, TypeError):
|
||||
pass
|
||||
|
||||
async def _get_wattage(self, rpc_stats: dict = None) -> Optional[int]:
|
||||
if rpc_stats is None:
|
||||
try:
|
||||
rpc_stats = await self.rpc.stats()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if rpc_stats is not None:
|
||||
try:
|
||||
unparsed_stats = rpc_stats["STATS"][0]["MM ID0"]
|
||||
parsed_stats = self.parse_stats(unparsed_stats)
|
||||
return int(parsed_stats["WALLPOWER"][0])
|
||||
except (IndexError, KeyError, ValueError, TypeError):
|
||||
pass
|
||||
|
||||
async def _get_fans(self, rpc_stats: dict = None) -> List[Fan]:
|
||||
if rpc_stats is None:
|
||||
try:
|
||||
|
||||
@@ -1,7 +1,235 @@
|
||||
from pyasic.miners.backends.espminer import ESPMiner
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic import APIError, MinerConfig
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.device.firmware import MinerFirmware
|
||||
from pyasic.miners.base import BaseMiner
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, WebAPICommand
|
||||
from pyasic.web.bitaxe import BitAxeWebAPI
|
||||
|
||||
BITAXE_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction(
|
||||
"_get_hostname",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans",
|
||||
[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")],
|
||||
),
|
||||
str(DataOptions.MAC): DataFunction(
|
||||
"_get_mac",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class BitAxe(ESPMiner):
|
||||
class BitAxe(BaseMiner):
|
||||
"""Handler for BitAxe"""
|
||||
|
||||
pass
|
||||
web: BitAxeWebAPI
|
||||
_web_cls = BitAxeWebAPI
|
||||
|
||||
firmware = MinerFirmware.STOCK
|
||||
|
||||
data_locations = BITAXE_DATA_LOC
|
||||
|
||||
async def reboot(self) -> bool:
|
||||
await self.web.restart()
|
||||
return True
|
||||
|
||||
async def get_config(self) -> MinerConfig:
|
||||
web_system_info = await self.web.system_info()
|
||||
return MinerConfig.from_bitaxe(web_system_info)
|
||||
|
||||
async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None:
|
||||
await self.web.update_settings(**config.as_bitaxe())
|
||||
|
||||
async def _get_wattage(self, web_system_info: dict = None) -> Optional[int]:
|
||||
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 round(web_system_info["power"])
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
async def _get_hashrate(
|
||||
self, web_system_info: dict = None
|
||||
) -> Optional[AlgoHashRate]:
|
||||
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 self.algo.hashrate(
|
||||
rate=float(web_system_info["hashRate"]), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
async def _get_expected_hashrate(
|
||||
self, web_system_info: dict = None
|
||||
) -> Optional[AlgoHashRate]:
|
||||
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:
|
||||
expected_hashrate = (
|
||||
web_system_info.get("smallCoreCount")
|
||||
* web_system_info.get("asicCount")
|
||||
* web_system_info.get("frequency")
|
||||
)
|
||||
|
||||
return self.algo.hashrate(
|
||||
rate=float(expected_hashrate), unit=self.algo.unit.MH
|
||||
).into(self.algo.unit.default)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
async def _get_uptime(self, web_system_info: dict = None) -> Optional[int]:
|
||||
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["uptimeSeconds"]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
async def _get_hashboards(self, web_system_info: dict = None) -> List[HashBoard]:
|
||||
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 [
|
||||
HashBoard(
|
||||
hashrate=self.algo.hashrate(
|
||||
rate=float(web_system_info["hashRate"]),
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default),
|
||||
chip_temp=web_system_info.get("temp"),
|
||||
temp=web_system_info.get("vrTemp"),
|
||||
chips=web_system_info.get("asicCount", 1),
|
||||
expected_chips=self.expected_chips,
|
||||
missing=False,
|
||||
active=True,
|
||||
voltage=web_system_info.get("voltage"),
|
||||
)
|
||||
]
|
||||
except KeyError:
|
||||
pass
|
||||
return []
|
||||
|
||||
async def _get_fans(self, web_system_info: dict = None) -> List[Fan]:
|
||||
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 [Fan(speed=web_system_info["fanrpm"])]
|
||||
except KeyError:
|
||||
pass
|
||||
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
|
||||
|
||||
async def _get_mac(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["macAddr"].upper()
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
@@ -1,374 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 typing import List, Optional
|
||||
|
||||
from pyasic import APIError, MinerConfig
|
||||
from pyasic.data import Fan, HashBoard, X19Error
|
||||
from pyasic.data.error_codes import MinerErrorData
|
||||
from pyasic.data.pools import PoolMetrics, PoolUrl
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.miners.data import (
|
||||
DataFunction,
|
||||
DataLocations,
|
||||
DataOptions,
|
||||
WebAPICommand,
|
||||
)
|
||||
from pyasic.miners.device.firmware import StockFirmware
|
||||
from pyasic.web.elphapex import ElphapexWebAPI
|
||||
|
||||
ELPHAPEX_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.MAC): DataFunction(
|
||||
"_get_mac",
|
||||
[WebAPICommand("web_get_system_info", "get_system_info")],
|
||||
),
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver",
|
||||
[WebAPICommand("web_get_system_info", "get_system_info")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction(
|
||||
"_get_hostname",
|
||||
[WebAPICommand("web_get_system_info", "get_system_info")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards",
|
||||
[WebAPICommand("web_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate",
|
||||
[WebAPICommand("web_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans",
|
||||
[WebAPICommand("web_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.ERRORS): DataFunction(
|
||||
"_get_errors",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.FAULT_LIGHT): DataFunction(
|
||||
"_get_fault_light",
|
||||
[WebAPICommand("web_get_blink_status", "get_blink_status")],
|
||||
),
|
||||
str(DataOptions.IS_MINING): DataFunction(
|
||||
"_is_mining",
|
||||
[WebAPICommand("web_get_miner_conf", "get_miner_conf")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
str(DataOptions.POOLS): DataFunction(
|
||||
"_get_pools",
|
||||
[WebAPICommand("web_pools", "pools")],
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class ElphapexMiner(StockFirmware):
|
||||
"""Handler for Elphapex miners."""
|
||||
|
||||
_web_cls = ElphapexWebAPI
|
||||
web: ElphapexWebAPI
|
||||
|
||||
data_locations = ELPHAPEX_DATA_LOC
|
||||
|
||||
async def get_config(self) -> MinerConfig:
|
||||
data = await self.web.get_miner_conf()
|
||||
if data:
|
||||
self.config = MinerConfig.from_elphapex(data)
|
||||
return self.config
|
||||
|
||||
async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None:
|
||||
self.config = config
|
||||
await self.web.set_miner_conf(config.as_elphapex(user_suffix=user_suffix))
|
||||
|
||||
async def fault_light_on(self) -> bool:
|
||||
data = await self.web.blink(blink=True)
|
||||
if data:
|
||||
if data.get("code") == "B000":
|
||||
self.light = True
|
||||
return self.light
|
||||
|
||||
async def fault_light_off(self) -> bool:
|
||||
data = await self.web.blink(blink=False)
|
||||
if data:
|
||||
if data.get("code") == "B100":
|
||||
self.light = False
|
||||
return self.light
|
||||
|
||||
async def reboot(self) -> bool:
|
||||
data = await self.web.reboot()
|
||||
if data:
|
||||
return True
|
||||
return False
|
||||
|
||||
async def _get_api_ver(self, web_summary: dict = None) -> Optional[str]:
|
||||
if web_summary is None:
|
||||
try:
|
||||
web_summary = await self.web.summary()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if web_summary is not None:
|
||||
try:
|
||||
self.api_ver = web_summary["STATUS"]["api_version"]
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
return self.api_ver
|
||||
|
||||
async def _get_fw_ver(self, web_get_system_info: dict = None) -> Optional[str]:
|
||||
if web_get_system_info is None:
|
||||
try:
|
||||
web_get_system_info = await self.web.get_system_info()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if web_get_system_info is not None:
|
||||
try:
|
||||
self.fw_ver = (
|
||||
web_get_system_info["system_filesystem_version"]
|
||||
.upper()
|
||||
.split("V")[-1]
|
||||
)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
return self.fw_ver
|
||||
|
||||
async def _get_hostname(self, web_get_system_info: dict = None) -> Optional[str]:
|
||||
if web_get_system_info is None:
|
||||
try:
|
||||
web_get_system_info = await self.web.get_system_info()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if web_get_system_info is not None:
|
||||
try:
|
||||
return web_get_system_info["hostname"]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
async def _get_mac(self, web_get_system_info: dict = None) -> Optional[str]:
|
||||
if web_get_system_info is None:
|
||||
try:
|
||||
web_get_system_info = await self.web.get_system_info()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if web_get_system_info is not None:
|
||||
try:
|
||||
return web_get_system_info["macaddr"]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
try:
|
||||
data = await self.web.get_network_info()
|
||||
if data:
|
||||
return data["macaddr"]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
async def _get_errors(self, web_summary: dict = None) -> List[MinerErrorData]:
|
||||
if web_summary is None:
|
||||
try:
|
||||
web_summary = await self.web.summary()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
errors = []
|
||||
if web_summary is not None:
|
||||
try:
|
||||
for item in web_summary["SUMMARY"][0]["status"]:
|
||||
try:
|
||||
if not item["status"] == "s":
|
||||
errors.append(X19Error(error_message=item["msg"]))
|
||||
except KeyError:
|
||||
continue
|
||||
except LookupError:
|
||||
pass
|
||||
return errors
|
||||
|
||||
async def _get_hashboards(self, web_stats: dict | None = None) -> List[HashBoard]:
|
||||
hashboards = [
|
||||
HashBoard(slot=idx, expected_chips=self.expected_chips)
|
||||
for idx in range(self.expected_hashboards)
|
||||
]
|
||||
|
||||
if web_stats is None:
|
||||
try:
|
||||
web_stats = await self.web.stats()
|
||||
except APIError:
|
||||
return hashboards
|
||||
|
||||
if web_stats is not None:
|
||||
try:
|
||||
for board in web_stats["STATS"][0]["chain"]:
|
||||
hashboards[board["index"]].hashrate = self.algo.hashrate(
|
||||
rate=board["rate_real"], unit=self.algo.unit.MH
|
||||
).into(self.algo.unit.default)
|
||||
hashboards[board["index"]].chips = board["asic_num"]
|
||||
board_temp_data = list(
|
||||
filter(lambda x: not x == 0, board["temp_pcb"])
|
||||
)
|
||||
hashboards[board["index"]].temp = sum(board_temp_data) / len(
|
||||
board_temp_data
|
||||
)
|
||||
chip_temp_data = list(
|
||||
filter(lambda x: not x == "", board["temp_chip"])
|
||||
)
|
||||
hashboards[board["index"]].chip_temp = sum(
|
||||
[int(i) / 1000 for i in chip_temp_data]
|
||||
) / len(chip_temp_data)
|
||||
hashboards[board["index"]].serial_number = board["sn"]
|
||||
hashboards[board["index"]].missing = False
|
||||
except LookupError:
|
||||
pass
|
||||
return hashboards
|
||||
|
||||
async def _get_fault_light(
|
||||
self, web_get_blink_status: dict = None
|
||||
) -> Optional[bool]:
|
||||
if self.light:
|
||||
return self.light
|
||||
|
||||
if web_get_blink_status is None:
|
||||
try:
|
||||
web_get_blink_status = await self.web.get_blink_status()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if web_get_blink_status is not None:
|
||||
try:
|
||||
self.light = web_get_blink_status["blink"]
|
||||
except KeyError:
|
||||
pass
|
||||
return self.light
|
||||
|
||||
async def _get_expected_hashrate(
|
||||
self, web_stats: dict = None
|
||||
) -> Optional[AlgoHashRate]:
|
||||
if web_stats is None:
|
||||
try:
|
||||
web_stats = await self.web.stats()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if web_stats is not None:
|
||||
try:
|
||||
expected_rate = web_stats["STATS"][1]["total_rateideal"]
|
||||
try:
|
||||
rate_unit = web_stats["STATS"][1]["rate_unit"]
|
||||
except KeyError:
|
||||
rate_unit = "MH"
|
||||
return self.algo.hashrate(
|
||||
rate=float(expected_rate), unit=self.algo.unit.from_str(rate_unit)
|
||||
).into(self.algo.unit.default)
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
async def _is_mining(self, web_get_miner_conf: dict = None) -> Optional[bool]:
|
||||
if web_get_miner_conf is None:
|
||||
try:
|
||||
web_get_miner_conf = await self.web.get_miner_conf()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if web_get_miner_conf is not None:
|
||||
try:
|
||||
if str(web_get_miner_conf["fc-work-mode"]).isdigit():
|
||||
return (
|
||||
False if int(web_get_miner_conf["fc-work-mode"]) == 1 else True
|
||||
)
|
||||
return False
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
async def _get_uptime(self, web_summary: dict = None) -> Optional[int]:
|
||||
if web_summary is None:
|
||||
try:
|
||||
web_summary = await self.web.summary()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if web_summary is not None:
|
||||
try:
|
||||
return int(web_summary["SUMMARY"][1]["elapsed"])
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
async def _get_fans(self, web_stats: dict = None) -> List[Fan]:
|
||||
if web_stats is None:
|
||||
try:
|
||||
web_stats = await self.web.stats()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
fans = [Fan() for _ in range(self.expected_fans)]
|
||||
if web_stats is not None:
|
||||
for fan_n in range(self.expected_fans):
|
||||
try:
|
||||
fans[fan_n].speed = int(web_stats["STATS"][0]["fan"][fan_n])
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
return fans
|
||||
|
||||
async def _get_pools(self, web_pools: list = None) -> List[PoolMetrics]:
|
||||
if web_pools is None:
|
||||
try:
|
||||
web_pools = await self.web.pools()
|
||||
except APIError:
|
||||
return []
|
||||
|
||||
active_pool_index = None
|
||||
highest_priority = float("inf")
|
||||
|
||||
for pool_info in web_pools["POOLS"]:
|
||||
if (
|
||||
pool_info.get("status") == "Alive"
|
||||
and pool_info.get("priority", float("inf")) < highest_priority
|
||||
):
|
||||
highest_priority = pool_info["priority"]
|
||||
active_pool_index = pool_info["index"]
|
||||
|
||||
pools_data = []
|
||||
if web_pools is not None:
|
||||
try:
|
||||
for pool_info in web_pools["POOLS"]:
|
||||
url = pool_info.get("url")
|
||||
pool_url = PoolUrl.from_str(url) if url else None
|
||||
pool_data = PoolMetrics(
|
||||
accepted=pool_info.get("accepted"),
|
||||
rejected=pool_info.get("rejected"),
|
||||
get_failures=pool_info.get("stale"),
|
||||
remote_failures=pool_info.get("discarded"),
|
||||
active=pool_info.get("index") == active_pool_index,
|
||||
alive=pool_info.get("status") == "Alive",
|
||||
url=pool_url,
|
||||
user=pool_info.get("user"),
|
||||
index=pool_info.get("index"),
|
||||
)
|
||||
pools_data.append(pool_data)
|
||||
except LookupError:
|
||||
pass
|
||||
return pools_data
|
||||
@@ -1,235 +0,0 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pyasic import APIError, MinerConfig
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.device.firmware import MinerFirmware
|
||||
from pyasic.miners.base import BaseMiner
|
||||
from pyasic.miners.data import DataFunction, DataLocations, DataOptions, WebAPICommand
|
||||
from pyasic.web.espminer import ESPMinerWebAPI
|
||||
|
||||
ESPMINER_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.HOSTNAME): DataFunction(
|
||||
"_get_hostname",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans",
|
||||
[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")],
|
||||
),
|
||||
str(DataOptions.MAC): DataFunction(
|
||||
"_get_mac",
|
||||
[WebAPICommand("web_system_info", "system/info")],
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class ESPMiner(BaseMiner):
|
||||
"""Handler for ESPMiner"""
|
||||
|
||||
web: ESPMinerWebAPI
|
||||
_web_cls = ESPMinerWebAPI
|
||||
|
||||
firmware = MinerFirmware.STOCK
|
||||
|
||||
data_locations = ESPMINER_DATA_LOC
|
||||
|
||||
async def reboot(self) -> bool:
|
||||
await self.web.restart()
|
||||
return True
|
||||
|
||||
async def get_config(self) -> MinerConfig:
|
||||
web_system_info = await self.web.system_info()
|
||||
return MinerConfig.from_espminer(web_system_info)
|
||||
|
||||
async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None:
|
||||
await self.web.update_settings(**config.as_espminer())
|
||||
|
||||
async def _get_wattage(self, web_system_info: dict = None) -> Optional[int]:
|
||||
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 round(web_system_info["power"])
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
async def _get_hashrate(
|
||||
self, web_system_info: dict = None
|
||||
) -> Optional[AlgoHashRate]:
|
||||
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 self.algo.hashrate(
|
||||
rate=float(web_system_info["hashRate"]), unit=self.algo.unit.GH
|
||||
).into(self.algo.unit.default)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
async def _get_expected_hashrate(
|
||||
self, web_system_info: dict = None
|
||||
) -> Optional[AlgoHashRate]:
|
||||
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:
|
||||
expected_hashrate = (
|
||||
web_system_info.get("smallCoreCount")
|
||||
* web_system_info.get("asicCount")
|
||||
* web_system_info.get("frequency")
|
||||
)
|
||||
|
||||
return self.algo.hashrate(
|
||||
rate=float(expected_hashrate), unit=self.algo.unit.MH
|
||||
).into(self.algo.unit.default)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
async def _get_uptime(self, web_system_info: dict = None) -> Optional[int]:
|
||||
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["uptimeSeconds"]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
async def _get_hashboards(self, web_system_info: dict = None) -> List[HashBoard]:
|
||||
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 [
|
||||
HashBoard(
|
||||
hashrate=self.algo.hashrate(
|
||||
rate=float(web_system_info["hashRate"]),
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default),
|
||||
chip_temp=web_system_info.get("temp"),
|
||||
temp=web_system_info.get("vrTemp"),
|
||||
chips=web_system_info.get("asicCount", 1),
|
||||
expected_chips=self.expected_chips,
|
||||
missing=False,
|
||||
active=True,
|
||||
voltage=web_system_info.get("voltage"),
|
||||
)
|
||||
]
|
||||
except KeyError:
|
||||
pass
|
||||
return []
|
||||
|
||||
async def _get_fans(self, web_system_info: dict = None) -> List[Fan]:
|
||||
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 [Fan(speed=web_system_info["fanrpm"])]
|
||||
except KeyError:
|
||||
pass
|
||||
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
|
||||
|
||||
async def _get_mac(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["macAddr"].upper()
|
||||
except KeyError:
|
||||
pass
|
||||
@@ -1,7 +0,0 @@
|
||||
from pyasic.miners.backends.espminer import ESPMiner
|
||||
|
||||
|
||||
class LuckyMiner(ESPMiner):
|
||||
"""Handler for LuckyMiner"""
|
||||
|
||||
pass
|
||||
@@ -152,7 +152,7 @@ class LUXMiner(LuxOSFirmware):
|
||||
rpc_profiles=data.get("profiles", [{}])[0],
|
||||
)
|
||||
|
||||
async def upgrade_firmware(self, *args, **kwargs) -> bool:
|
||||
async def upgrade_firmware(self) -> bool:
|
||||
"""
|
||||
Upgrade the firmware on a LuxOS miner by calling the 'updaterun' API command.
|
||||
Returns:
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
from typing import Optional
|
||||
|
||||
from pyasic import APIError
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.miners.backends import BMMiner
|
||||
from pyasic.miners.data import (
|
||||
DataFunction,
|
||||
DataLocations,
|
||||
DataOptions,
|
||||
RPCAPICommand,
|
||||
WebAPICommand,
|
||||
)
|
||||
from pyasic.web.mskminer import MSKMinerWebAPI
|
||||
|
||||
MSKMINER_DATA_LOC = DataLocations(
|
||||
**{
|
||||
str(DataOptions.API_VERSION): DataFunction(
|
||||
"_get_api_ver",
|
||||
[RPCAPICommand("rpc_version", "version")],
|
||||
),
|
||||
str(DataOptions.FW_VERSION): DataFunction(
|
||||
"_get_fw_ver",
|
||||
[RPCAPICommand("rpc_version", "version")],
|
||||
),
|
||||
str(DataOptions.MAC): DataFunction(
|
||||
"_get_mac",
|
||||
[WebAPICommand("web_info_v1", "info_v1")],
|
||||
),
|
||||
str(DataOptions.HASHRATE): DataFunction(
|
||||
"_get_hashrate",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.EXPECTED_HASHRATE): DataFunction(
|
||||
"_get_expected_hashrate",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.HASHBOARDS): DataFunction(
|
||||
"_get_hashboards",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.WATTAGE): DataFunction(
|
||||
"_get_wattage",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.FANS): DataFunction(
|
||||
"_get_fans",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("rpc_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.POOLS): DataFunction(
|
||||
"_get_pools",
|
||||
[RPCAPICommand("rpc_pools", "pools")],
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class MSKMiner(BMMiner):
|
||||
"""Handler for MSKMiner"""
|
||||
|
||||
data_locations = MSKMINER_DATA_LOC
|
||||
|
||||
web: MSKMinerWebAPI
|
||||
_web_cls = MSKMinerWebAPI
|
||||
|
||||
async def _get_hashrate(self, rpc_stats: dict = None) -> Optional[AlgoHashRate]:
|
||||
# get hr from API
|
||||
if rpc_stats is None:
|
||||
try:
|
||||
rpc_stats = await self.rpc.stats()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if rpc_stats is not None:
|
||||
try:
|
||||
return self.algo.hashrate(
|
||||
rate=float(rpc_stats["STATS"][0]["total_rate"]),
|
||||
unit=self.algo.unit.GH,
|
||||
).into(self.algo.unit.default)
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
|
||||
async def _get_wattage(self, rpc_stats: dict = None) -> Optional[int]:
|
||||
if rpc_stats is None:
|
||||
try:
|
||||
rpc_stats = await self.rpc.stats()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if rpc_stats is not None:
|
||||
try:
|
||||
return rpc_stats["STATS"][0]["total_power"]
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
|
||||
async def _get_mac(self, web_info_v1: dict = None) -> Optional[str]:
|
||||
if web_info_v1 is None:
|
||||
try:
|
||||
web_info_v1 = await self.web.info_v1()
|
||||
except APIError:
|
||||
pass
|
||||
|
||||
if web_info_v1 is not None:
|
||||
try:
|
||||
return web_info_v1["network_info"]["result"]["macaddr"].upper()
|
||||
except (LookupError, ValueError, TypeError):
|
||||
pass
|
||||
@@ -15,10 +15,9 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
import logging
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
from pyasic import MinerConfig
|
||||
from pyasic.data.error_codes import MinerErrorData, VnishError
|
||||
from pyasic.device.algorithm import AlgoHashRate
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.miners.backends.bmminer import BMMiner
|
||||
@@ -86,10 +85,6 @@ VNISH_DATA_LOC = DataLocations(
|
||||
"_get_pools",
|
||||
[RPCAPICommand("rpc_pools", "pools")],
|
||||
),
|
||||
str(DataOptions.ERRORS): DataFunction(
|
||||
"_get_errors",
|
||||
[WebAPICommand("web_summary", "summary")],
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -271,24 +266,6 @@ class VNish(VNishFirmware, BMMiner):
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
async def _get_errors(self, web_summary: dict = None) -> List[MinerErrorData]:
|
||||
errors = []
|
||||
if web_summary is None:
|
||||
try:
|
||||
web_summary = await self.web.summary()
|
||||
except APIError:
|
||||
return errors
|
||||
|
||||
if web_summary is not None:
|
||||
chains = web_summary.get("miner", {}).get("chains", [])
|
||||
for chain in chains:
|
||||
state = chain.get("status", {}).get("state")
|
||||
description = chain.get("status", {}).get("description", "")
|
||||
if state == "failure":
|
||||
errors.append(VnishError(error_message=description))
|
||||
|
||||
return errors
|
||||
|
||||
async def get_config(self) -> MinerConfig:
|
||||
try:
|
||||
web_settings = await self.web.settings()
|
||||
|
||||
@@ -50,10 +50,6 @@ class BitAxeMake(BaseMiner):
|
||||
make = MinerMake.BITAXE
|
||||
|
||||
|
||||
class LuckyMinerMake(BaseMiner):
|
||||
make = MinerMake.LUCKYMINER
|
||||
|
||||
|
||||
class IceRiverMake(BaseMiner):
|
||||
make = MinerMake.ICERIVER
|
||||
|
||||
@@ -68,7 +64,3 @@ class VolcMinerMake(BaseMiner):
|
||||
|
||||
class BraiinsMake(BaseMiner):
|
||||
make = MinerMake.BRAIINS
|
||||
|
||||
|
||||
class ElphapexMake(BaseMiner):
|
||||
make = MinerMake.ELPHAPEX
|
||||
|
||||
@@ -18,7 +18,6 @@ from .antminer import *
|
||||
from .auradine import *
|
||||
from .avalonminer import *
|
||||
from .braiins import *
|
||||
from .elphapex import *
|
||||
from .epic import *
|
||||
from .goldshell import *
|
||||
from .hammer import *
|
||||
|
||||
@@ -34,12 +34,3 @@ class S21Pro(AntMinerMake):
|
||||
expected_fans = 4
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
|
||||
class S21Hydro(AntMinerMake):
|
||||
raw_model = MinerModel.ANTMINER.S21Hydro
|
||||
|
||||
expected_chips = 216
|
||||
expected_hashboards = 3
|
||||
expected_fans = 0
|
||||
algo = MinerAlgo.SHA256
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
# limitations under the License. -
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
from .S21 import S21, S21Hydro, S21Pro
|
||||
from .S21 import S21, S21Pro
|
||||
from .T21 import T21
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import AvalonMinerMake
|
||||
|
||||
|
||||
class Avalon1566(AvalonMinerMake):
|
||||
raw_model = MinerModel.AVALONMINER.Avalon1566
|
||||
|
||||
expected_chips = 160
|
||||
expected_fans = 2
|
||||
expected_hashboards = 3
|
||||
algo = MinerAlgo.SHA256
|
||||
@@ -1,17 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 .A1566 import Avalon1566
|
||||
@@ -20,5 +20,4 @@ from .A9X import *
|
||||
from .A10X import *
|
||||
from .A11X import *
|
||||
from .A12X import *
|
||||
from .A15X import *
|
||||
from .nano import *
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright 2024 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.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import ElphapexMake
|
||||
|
||||
|
||||
class DG1Plus(ElphapexMake):
|
||||
raw_model = MinerModel.ELPHAPEX.DG1Plus
|
||||
|
||||
expected_chips = 204
|
||||
expected_hashboards = 4
|
||||
expected_fans = 4
|
||||
algo = MinerAlgo.SCRYPT
|
||||
@@ -1 +0,0 @@
|
||||
from .DG1 import DG1Plus
|
||||
@@ -1 +0,0 @@
|
||||
from .DGX import *
|
||||
@@ -1,12 +0,0 @@
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import LuckyMinerMake
|
||||
|
||||
|
||||
class LV07(LuckyMinerMake):
|
||||
raw_model = MinerModel.LUCKYMINER.LV07
|
||||
|
||||
expected_hashboards = 1
|
||||
expected_chips = 1
|
||||
expected_fans = 1
|
||||
algo = MinerAlgo.SHA256
|
||||
@@ -1,12 +0,0 @@
|
||||
from pyasic.device.algorithm import MinerAlgo
|
||||
from pyasic.device.models import MinerModel
|
||||
from pyasic.miners.device.makes import LuckyMinerMake
|
||||
|
||||
|
||||
class LV08(LuckyMinerMake):
|
||||
raw_model = MinerModel.LUCKYMINER.LV08
|
||||
|
||||
expected_hashboards = 1
|
||||
expected_chips = 1
|
||||
expected_fans = 1
|
||||
algo = MinerAlgo.SHA256
|
||||
@@ -1,2 +0,0 @@
|
||||
from .LV07 import LV07
|
||||
from .LV08 import LV08
|
||||
@@ -1 +0,0 @@
|
||||
from .LV import *
|
||||
@@ -1 +0,0 @@
|
||||
from .daoge import *
|
||||
@@ -1,6 +0,0 @@
|
||||
from pyasic.miners.backends.elphapex import ElphapexMiner
|
||||
from pyasic.miners.device.models import DG1Plus
|
||||
|
||||
|
||||
class ElphapexDG1Plus(ElphapexMiner, DG1Plus):
|
||||
pass
|
||||
@@ -1 +0,0 @@
|
||||
from .DG1 import ElphapexDG1Plus
|
||||
@@ -1 +0,0 @@
|
||||
from .DGX import *
|
||||
@@ -37,12 +37,10 @@ from pyasic.miners.bitaxe import *
|
||||
from pyasic.miners.blockminer import *
|
||||
from pyasic.miners.braiins import *
|
||||
from pyasic.miners.device.makes import *
|
||||
from pyasic.miners.elphapex import *
|
||||
from pyasic.miners.goldshell import *
|
||||
from pyasic.miners.hammer import *
|
||||
from pyasic.miners.iceriver import *
|
||||
from pyasic.miners.innosilicon import *
|
||||
from pyasic.miners.luckyminer import *
|
||||
from pyasic.miners.volcminer import *
|
||||
from pyasic.miners.whatsminer import *
|
||||
|
||||
@@ -64,9 +62,6 @@ class MinerTypes(enum.Enum):
|
||||
ICERIVER = 13
|
||||
HAMMER = 14
|
||||
VOLCMINER = 15
|
||||
LUCKYMINER = 16
|
||||
ELPHAPEX = 17
|
||||
MSKMINER = 18
|
||||
|
||||
|
||||
MINER_CLASSES = {
|
||||
@@ -122,7 +117,6 @@ MINER_CLASSES = {
|
||||
"ANTMINER BHB68606": BMMinerS21, # ???
|
||||
"ANTMINER S21 PRO": BMMinerS21Pro,
|
||||
"ANTMINER T21": BMMinerT21,
|
||||
"ANTMINER S21 HYD.": BMMinerS21Hydro,
|
||||
},
|
||||
MinerTypes.WHATSMINER: {
|
||||
None: type("WhatsminerUnknown", (BTMiner, WhatsMinerMake), {}),
|
||||
@@ -505,7 +499,6 @@ MINER_CLASSES = {
|
||||
"AVALONMINER 1166PRO": CGMinerAvalon1166Pro,
|
||||
"AVALONMINER 1246": CGMinerAvalon1246,
|
||||
"AVALONMINER NANO3": CGMinerAvalonNano3,
|
||||
"AVALONMINER 15-194": CGMinerAvalon1566,
|
||||
},
|
||||
MinerTypes.INNOSILICON: {
|
||||
None: type("InnosiliconUnknown", (Innosilicon, InnosiliconMake), {}),
|
||||
@@ -551,7 +544,6 @@ MINER_CLASSES = {
|
||||
"ANTMINER S19 PRO+ HYD.": BOSMinerS19ProPlusHydro,
|
||||
"ANTMINER T19": BOSMinerT19,
|
||||
"ANTMINER S21": BOSMinerS21,
|
||||
"ANTMINER S21 PRO": BOSMinerS21Pro,
|
||||
"ANTMINER T21": BOSMinerT21,
|
||||
"BRAIINS MINI MINER BMM 100": BraiinsBMM100,
|
||||
"BRAIINS MINI MINER BMM 101": BraiinsBMM101,
|
||||
@@ -567,7 +559,7 @@ MINER_CLASSES = {
|
||||
"ANTMINER S19NOPIC": VNishS19NoPIC,
|
||||
"ANTMINER S19 PRO": VNishS19Pro,
|
||||
"ANTMINER S19J": VNishS19j,
|
||||
"ANTMINER S19I": VNishS19i,
|
||||
"ANTMINER S19I": VNishS19j,
|
||||
"ANTMINER S19J PRO": VNishS19jPro,
|
||||
"ANTMINER S19J PRO A": VNishS19jPro,
|
||||
"ANTMINER S19J PRO BB": VNishS19jPro,
|
||||
@@ -600,12 +592,6 @@ MINER_CLASSES = {
|
||||
"ANTMINER T9": HiveonT9,
|
||||
"ANTMINER S19JPRO": HiveonS19jPro,
|
||||
"ANTMINER S19": HiveonS19,
|
||||
"ANTMINER S19K PRO": HiveonS19kPro,
|
||||
"ANTMINER S19X88": HiveonS19NoPIC,
|
||||
},
|
||||
MinerTypes.MSKMINER: {
|
||||
None: MSKMiner,
|
||||
"S19-88": MSKMinerS19NoPIC,
|
||||
},
|
||||
MinerTypes.LUX_OS: {
|
||||
None: LUXMiner,
|
||||
@@ -648,11 +634,6 @@ MINER_CLASSES = {
|
||||
"BM1397": BitAxeMax,
|
||||
"BM1370": BitAxeGamma,
|
||||
},
|
||||
MinerTypes.LUCKYMINER: {
|
||||
None: LuckyMiner,
|
||||
"LV08": LuckyMinerLV08,
|
||||
"LV07": LuckyMinerLV07,
|
||||
},
|
||||
MinerTypes.ICERIVER: {
|
||||
None: type("IceRiverUnknown", (IceRiver, IceRiverMake), {}),
|
||||
"KS0": IceRiverKS0,
|
||||
@@ -673,10 +654,6 @@ MINER_CLASSES = {
|
||||
None: type("VolcMinerUnknown", (BlackMiner, VolcMinerMake), {}),
|
||||
"VOLCMINER D1": VolcMinerD1,
|
||||
},
|
||||
MinerTypes.ELPHAPEX: {
|
||||
None: type("ElphapexUnknown", (ElphapexMiner, ElphapexMake), {}),
|
||||
"DG1+": ElphapexDG1Plus,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -754,11 +731,9 @@ class MinerFactory:
|
||||
MinerTypes.AURADINE: self.get_miner_model_auradine,
|
||||
MinerTypes.MARATHON: self.get_miner_model_marathon,
|
||||
MinerTypes.BITAXE: self.get_miner_model_bitaxe,
|
||||
MinerTypes.LUCKYMINER: self.get_miner_model_luckyminer,
|
||||
MinerTypes.ICERIVER: self.get_miner_model_iceriver,
|
||||
MinerTypes.HAMMER: self.get_miner_model_hammer,
|
||||
MinerTypes.VOLCMINER: self.get_miner_model_volcminer,
|
||||
MinerTypes.ELPHAPEX: self.get_miner_model_elphapex,
|
||||
}
|
||||
fn = miner_model_fns.get(miner_type)
|
||||
|
||||
@@ -842,10 +817,6 @@ class MinerFactory:
|
||||
"www-authenticate", ""
|
||||
):
|
||||
return MinerTypes.HAMMER
|
||||
if web_resp.status_code == 401 and 'realm="Daoge' in web_resp.headers.get(
|
||||
"www-authenticate", ""
|
||||
):
|
||||
return MinerTypes.ELPHAPEX
|
||||
if len(web_resp.history) > 0:
|
||||
history_resp = web_resp.history[0]
|
||||
if (
|
||||
@@ -862,8 +833,6 @@ class MinerFactory:
|
||||
return MinerTypes.ICERIVER
|
||||
if "AxeOS" in web_text:
|
||||
return MinerTypes.BITAXE
|
||||
if "Lucky miner" in web_text:
|
||||
return MinerTypes.LUCKYMINER
|
||||
if "cloud-box" in web_text:
|
||||
return MinerTypes.GOLDSHELL
|
||||
if "AnthillOS" in web_text:
|
||||
@@ -876,8 +845,6 @@ class MinerFactory:
|
||||
return MinerTypes.INNOSILICON
|
||||
if "Miner UI" in web_text:
|
||||
return MinerTypes.AURADINE
|
||||
if "<title>Antminer</title>" in web_text:
|
||||
return MinerTypes.MSKMINER
|
||||
|
||||
async def _get_miner_socket(self, ip: str) -> MinerTypes | None:
|
||||
commands = ["version", "devdetails"]
|
||||
@@ -910,7 +877,6 @@ class MinerFactory:
|
||||
await writer.drain()
|
||||
|
||||
# loop to receive all the data
|
||||
timeouts_remaining = max(1, int(settings.get("factory_get_timeout", 3)))
|
||||
while True:
|
||||
try:
|
||||
d = await asyncio.wait_for(reader.read(4096), timeout=1)
|
||||
@@ -918,10 +884,7 @@ class MinerFactory:
|
||||
break
|
||||
data += d
|
||||
except asyncio.TimeoutError:
|
||||
timeouts_remaining -= 1
|
||||
if not timeouts_remaining:
|
||||
logger.warning(f"{ip}: Socket ping timeout.")
|
||||
break
|
||||
pass
|
||||
except ConnectionResetError:
|
||||
return
|
||||
except asyncio.CancelledError:
|
||||
@@ -954,8 +917,6 @@ class MinerFactory:
|
||||
return MinerTypes.HIVEON
|
||||
if "KAONSU" in upper_data:
|
||||
return MinerTypes.MARATHON
|
||||
if "RWGLR" in upper_data:
|
||||
return MinerTypes.MSKMINER
|
||||
if "ANTMINER" in upper_data and "DEVDETAILS" not in upper_data:
|
||||
return MinerTypes.ANTMINER
|
||||
if (
|
||||
@@ -1171,9 +1132,9 @@ class MinerFactory:
|
||||
miner_model = sock_json_data["VERSION"][0]["PROD"].upper()
|
||||
if "-" in miner_model:
|
||||
miner_model = miner_model.split("-")[0]
|
||||
if miner_model in ["AVALONNANO", "AVALON0O", "AVALONMINER 15"]:
|
||||
subtype = sock_json_data["VERSION"][0]["MODEL"].upper()
|
||||
miner_model = f"AVALONMINER {subtype}"
|
||||
if miner_model in ["AVALONNANO", "AVALON0O"]:
|
||||
nano_subtype = sock_json_data["VERSION"][0]["MODEL"].upper()
|
||||
miner_model = f"AVALONMINER {nano_subtype}"
|
||||
return miner_model
|
||||
except (TypeError, LookupError):
|
||||
pass
|
||||
@@ -1331,18 +1292,6 @@ class MinerFactory:
|
||||
except (TypeError, LookupError):
|
||||
pass
|
||||
|
||||
async def get_miner_model_luckyminer(self, ip: str) -> str | None:
|
||||
web_json_data = await self.send_web_command(ip, "/api/system/info")
|
||||
|
||||
try:
|
||||
miner_model = web_json_data["minerModel"]
|
||||
if miner_model == "":
|
||||
return None
|
||||
|
||||
return miner_model
|
||||
except (TypeError, LookupError):
|
||||
pass
|
||||
|
||||
async def get_miner_model_iceriver(self, ip: str) -> str | None:
|
||||
async with httpx.AsyncClient(transport=settings.transport()) as client:
|
||||
try:
|
||||
@@ -1406,28 +1355,6 @@ class MinerFactory:
|
||||
except (TypeError, LookupError):
|
||||
pass
|
||||
|
||||
async def get_miner_model_elphapex(self, ip: str) -> str | None:
|
||||
auth = httpx.DigestAuth(
|
||||
"root", settings.get("default_elphapex_web_password", "root")
|
||||
)
|
||||
web_json_data = await self.send_web_command(
|
||||
ip, "/cgi-bin/get_system_info.cgi", auth=auth
|
||||
)
|
||||
|
||||
try:
|
||||
miner_model = web_json_data["minertype"]
|
||||
|
||||
return miner_model
|
||||
except (TypeError, LookupError):
|
||||
pass
|
||||
|
||||
async def get_miner_model_mskminer(self, ip: str) -> str | None:
|
||||
sock_json_data = await self.send_api_command(ip, "version")
|
||||
try:
|
||||
return sock_json_data["VERSION"][0]["Type"].split(" ")[0]
|
||||
except LookupError:
|
||||
pass
|
||||
|
||||
|
||||
miner_factory = MinerFactory()
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from .espminer import *
|
||||
@@ -1,6 +0,0 @@
|
||||
from pyasic.miners.backends.luckyminer import LuckyMiner
|
||||
from pyasic.miners.device.models.luckyminer import LV07
|
||||
|
||||
|
||||
class LuckyMinerLV07(LuckyMiner, LV07):
|
||||
pass
|
||||
@@ -1,6 +0,0 @@
|
||||
from pyasic.miners.backends.luckyminer import LuckyMiner
|
||||
from pyasic.miners.device.models.luckyminer import LV08
|
||||
|
||||
|
||||
class LuckyMinerLV08(LuckyMiner, LV08):
|
||||
pass
|
||||
@@ -1,2 +0,0 @@
|
||||
from .LV07 import LuckyMinerLV07
|
||||
from .LV08 import LuckyMinerLV08
|
||||
@@ -1 +0,0 @@
|
||||
from .LV import *
|
||||
@@ -31,7 +31,7 @@ _settings = { # defaults
|
||||
"default_whatsminer_rpc_password": "admin",
|
||||
"default_innosilicon_web_password": "admin",
|
||||
"default_antminer_web_password": "root",
|
||||
"default_hammer_web_password": "root",
|
||||
"default_hammer_web_password": "ltc@dog",
|
||||
"default_volcminer_web_password": "ltc@dog",
|
||||
"default_bosminer_web_password": "root",
|
||||
"default_vnish_web_password": "admin",
|
||||
@@ -40,8 +40,6 @@ _settings = { # defaults
|
||||
"default_epic_web_password": "letmein",
|
||||
"default_hive_web_password": "root",
|
||||
"default_iceriver_web_password": "12345678",
|
||||
"default_elphapex_web_password": "root",
|
||||
"default_mskminer_web_password": "root",
|
||||
"default_antminer_ssh_password": "miner",
|
||||
"default_bosminer_ssh_password": "root",
|
||||
}
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import hashlib
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
from pyasic import settings
|
||||
from pyasic.web.base import BaseWebAPI
|
||||
|
||||
|
||||
class AvalonMinerWebAPI(BaseWebAPI):
|
||||
def __init__(self, ip: str) -> None:
|
||||
"""Initialize the modern Avalonminer API client with a specific IP address.
|
||||
|
||||
Args:
|
||||
ip (str): IP address of the Avalonminer device.
|
||||
"""
|
||||
super().__init__(ip)
|
||||
self.username = "root"
|
||||
self.pwd = settings.get("default_avalonminer_web_password", "root")
|
||||
|
||||
async def send_command(
|
||||
self,
|
||||
command: str | bytes,
|
||||
ignore_errors: bool = False,
|
||||
allow_warning: bool = True,
|
||||
**parameters: Any,
|
||||
) -> dict:
|
||||
"""Send a command to the Avalonminer device using HTTP digest authentication.
|
||||
|
||||
Args:
|
||||
command (str | bytes): The CGI command to send.
|
||||
ignore_errors (bool): If True, ignore any HTTP errors.
|
||||
allow_warning (bool): If True, proceed with warnings.
|
||||
**parameters: Arbitrary keyword arguments to be sent as parameters in the request.
|
||||
|
||||
Returns:
|
||||
dict: The JSON response from the device or an empty dictionary if an error occurs.
|
||||
"""
|
||||
cookie_data = "ff0000ff" + hashlib.sha256(self.pwd.encode()).hexdigest()[:24]
|
||||
|
||||
url = f"http://{self.ip}:{self.port}/{command}.cgi"
|
||||
try:
|
||||
async with httpx.AsyncClient(transport=settings.transport()) as client:
|
||||
client.cookies.set("auth", cookie_data)
|
||||
resp = await client.get(url)
|
||||
raw_data = resp.text.replace("minerinfoCallback(", "").replace(");", "")
|
||||
return json.loads(raw_data)
|
||||
except (httpx.HTTPError, json.JSONDecodeError):
|
||||
pass
|
||||
return {}
|
||||
|
||||
async def multicommand(
|
||||
self, *commands: str, ignore_errors: bool = False, allow_warning: bool = True
|
||||
) -> dict:
|
||||
async with httpx.AsyncClient(transport=settings.transport()) as client:
|
||||
cookie_data = (
|
||||
"ff0000ff" + hashlib.sha256(self.pwd.encode()).hexdigest()[:24]
|
||||
)
|
||||
client.cookies.set("auth", cookie_data)
|
||||
tasks = [
|
||||
asyncio.create_task(self._handle_multicommand(client, command))
|
||||
for command in commands
|
||||
]
|
||||
all_data = await asyncio.gather(*tasks)
|
||||
|
||||
data = {}
|
||||
for item in all_data:
|
||||
data.update(item)
|
||||
|
||||
data["multicommand"] = True
|
||||
return data
|
||||
|
||||
async def _handle_multicommand(
|
||||
self, client: httpx.AsyncClient, command: str
|
||||
) -> dict:
|
||||
try:
|
||||
url = f"http://{self.ip}:{self.port}/{command}.cgi"
|
||||
resp = await client.get(url)
|
||||
raw_data = resp.text.replace("minerinfoCallback(", "").replace(");", "")
|
||||
return json.loads(raw_data)
|
||||
except httpx.HTTPError:
|
||||
pass
|
||||
return {}
|
||||
|
||||
async def minerinfo(self):
|
||||
return await self.send_command("get_minerinfo")
|
||||
|
||||
async def home(self):
|
||||
return await self.send_command("get_home")
|
||||
@@ -10,7 +10,7 @@ from pyasic import APIError, settings
|
||||
from pyasic.web.base import BaseWebAPI
|
||||
|
||||
|
||||
class ESPMinerWebAPI(BaseWebAPI):
|
||||
class BitAxeWebAPI(BaseWebAPI):
|
||||
async def send_command(
|
||||
self,
|
||||
command: str | bytes,
|
||||
@@ -89,7 +89,7 @@ class BOSerWebAPI(BaseWebAPI):
|
||||
for cmd in tasks:
|
||||
try:
|
||||
result[cmd] = await tasks[cmd]
|
||||
except (GRPCError, APIError, ConnectionError):
|
||||
except (GRPCError, APIError):
|
||||
pass
|
||||
|
||||
return result
|
||||
@@ -121,7 +121,7 @@ class BOSerWebAPI(BaseWebAPI):
|
||||
metadata = [("authorization", await self.auth())]
|
||||
return (await endpoint(message, metadata=metadata)).to_pydict()
|
||||
raise e
|
||||
except (GRPCError, ConnectionError) as e:
|
||||
except GRPCError as e:
|
||||
raise APIError(f"gRPC command failed - {endpoint}") from e
|
||||
|
||||
async def auth(self) -> str | None:
|
||||
|
||||
@@ -39,7 +39,7 @@ class ApiVersionServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "ApiVersion":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.ApiVersionService/GetApiVersion",
|
||||
|
||||
@@ -1706,7 +1706,7 @@ class ActionsServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "StartResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.ActionsService/Start",
|
||||
@@ -1723,7 +1723,7 @@ class ActionsServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "StopResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.ActionsService/Stop",
|
||||
@@ -1740,7 +1740,7 @@ class ActionsServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "PauseMiningResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.ActionsService/PauseMining",
|
||||
@@ -1757,7 +1757,7 @@ class ActionsServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "ResumeMiningResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.ActionsService/ResumeMining",
|
||||
@@ -1774,7 +1774,7 @@ class ActionsServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "RestartResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.ActionsService/Restart",
|
||||
@@ -1791,7 +1791,7 @@ class ActionsServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "RebootResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.ActionsService/Reboot",
|
||||
@@ -1808,7 +1808,7 @@ class ActionsServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "LocateDeviceStatusResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.ActionsService/SetLocateDeviceStatus",
|
||||
@@ -1825,7 +1825,7 @@ class ActionsServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "LocateDeviceStatusResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.ActionsService/GetLocateDeviceStatus",
|
||||
@@ -1844,7 +1844,7 @@ class AuthenticationServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "LoginResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.AuthenticationService/Login",
|
||||
@@ -1861,7 +1861,7 @@ class AuthenticationServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetPasswordResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.AuthenticationService/SetPassword",
|
||||
@@ -1880,7 +1880,7 @@ class CoolingServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetCoolingStateResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.CoolingService/GetCoolingState",
|
||||
@@ -1897,7 +1897,7 @@ class CoolingServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetImmersionModeResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.CoolingService/SetImmersionMode",
|
||||
@@ -1916,7 +1916,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetTunerStateResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/GetTunerState",
|
||||
@@ -1933,7 +1933,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "ListTargetProfilesResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/ListTargetProfiles",
|
||||
@@ -1950,7 +1950,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetPowerTargetResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/SetDefaultPowerTarget",
|
||||
@@ -1967,7 +1967,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetPowerTargetResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/SetPowerTarget",
|
||||
@@ -1984,7 +1984,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetPowerTargetResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/IncrementPowerTarget",
|
||||
@@ -2001,7 +2001,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetPowerTargetResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/DecrementPowerTarget",
|
||||
@@ -2018,7 +2018,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetHashrateTargetResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/SetDefaultHashrateTarget",
|
||||
@@ -2035,7 +2035,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetHashrateTargetResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/SetHashrateTarget",
|
||||
@@ -2052,7 +2052,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetHashrateTargetResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/IncrementHashrateTarget",
|
||||
@@ -2069,7 +2069,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetHashrateTargetResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/DecrementHashrateTarget",
|
||||
@@ -2086,7 +2086,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetDpsResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/SetDPS",
|
||||
@@ -2103,7 +2103,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "PerformanceMode":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/SetPerformanceMode",
|
||||
@@ -2120,7 +2120,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "PerformanceMode":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/GetActivePerformanceMode",
|
||||
@@ -2137,7 +2137,7 @@ class PerformanceServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "RemoveTunedProfilesResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PerformanceService/RemoveTunedProfiles",
|
||||
@@ -2156,7 +2156,7 @@ class PoolServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetPoolGroupsResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PoolService/GetPoolGroups",
|
||||
@@ -2173,7 +2173,7 @@ class PoolServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "CreatePoolGroupResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PoolService/CreatePoolGroup",
|
||||
@@ -2190,7 +2190,7 @@ class PoolServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "UpdatePoolGroupResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PoolService/UpdatePoolGroup",
|
||||
@@ -2207,7 +2207,7 @@ class PoolServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "RemovePoolGroupResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PoolService/RemovePoolGroup",
|
||||
@@ -2224,7 +2224,7 @@ class PoolServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetPoolGroupsResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.PoolService/SetPoolGroups",
|
||||
@@ -2243,7 +2243,7 @@ class ConfigurationServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetMinerConfigurationResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.ConfigurationService/GetMinerConfiguration",
|
||||
@@ -2260,7 +2260,7 @@ class ConfigurationServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetConstraintsResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.ConfigurationService/GetConstraints",
|
||||
@@ -2279,7 +2279,7 @@ class LicenseServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetLicenseStateResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.LicenseService/GetLicenseState",
|
||||
@@ -2298,7 +2298,7 @@ class MinerServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> AsyncIterator[GetMinerStatusResponse]:
|
||||
async for response in self._unary_stream(
|
||||
"/braiins.bos.v1.MinerService/GetMinerStatus",
|
||||
@@ -2316,7 +2316,7 @@ class MinerServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetMinerDetailsResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.MinerService/GetMinerDetails",
|
||||
@@ -2333,7 +2333,7 @@ class MinerServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetMinerStatsResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.MinerService/GetMinerStats",
|
||||
@@ -2350,7 +2350,7 @@ class MinerServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetErrorsResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.MinerService/GetErrors",
|
||||
@@ -2367,7 +2367,7 @@ class MinerServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetHashboardsResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.MinerService/GetHashboards",
|
||||
@@ -2384,7 +2384,7 @@ class MinerServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> AsyncIterator[GetSupportArchiveResponse]:
|
||||
async for response in self._unary_stream(
|
||||
"/braiins.bos.v1.MinerService/GetSupportArchive",
|
||||
@@ -2402,7 +2402,7 @@ class MinerServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "EnableHashboardsResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.MinerService/EnableHashboards",
|
||||
@@ -2419,7 +2419,7 @@ class MinerServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "DisableHashboardsResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.MinerService/DisableHashboards",
|
||||
@@ -2438,7 +2438,7 @@ class NetworkServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetNetworkConfigurationResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.NetworkService/GetNetworkConfiguration",
|
||||
@@ -2455,7 +2455,7 @@ class NetworkServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "SetNetworkConfigurationResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.NetworkService/SetNetworkConfiguration",
|
||||
@@ -2472,7 +2472,7 @@ class NetworkServiceStub(betterproto.ServiceStub):
|
||||
*,
|
||||
timeout: Optional[float] = None,
|
||||
deadline: Optional["Deadline"] = None,
|
||||
metadata: Optional["MetadataLike"] = None,
|
||||
metadata: Optional["MetadataLike"] = None
|
||||
) -> "GetNetworkInfoResponse":
|
||||
return await self._unary_unary(
|
||||
"/braiins.bos.v1.NetworkService/GetNetworkInfo",
|
||||
|
||||
@@ -1,224 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# 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 __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
from pyasic import settings
|
||||
from pyasic.web.base import BaseWebAPI
|
||||
|
||||
|
||||
class ElphapexWebAPI(BaseWebAPI):
|
||||
def __init__(self, ip: str) -> None:
|
||||
"""Initialize the modern Elphapex API client with a specific IP address.
|
||||
|
||||
Args:
|
||||
ip (str): IP address of the Elphapex device.
|
||||
"""
|
||||
super().__init__(ip)
|
||||
self.username = "root"
|
||||
self.pwd = settings.get("default_elphapex_web_password", "root")
|
||||
|
||||
async def send_command(
|
||||
self,
|
||||
command: str | bytes,
|
||||
ignore_errors: bool = False,
|
||||
allow_warning: bool = True,
|
||||
privileged: bool = False,
|
||||
**parameters: Any,
|
||||
) -> dict:
|
||||
"""Send a command to the Elphapex device using HTTP digest authentication.
|
||||
|
||||
Args:
|
||||
command (str | bytes): The CGI command to send.
|
||||
ignore_errors (bool): If True, ignore any HTTP errors.
|
||||
allow_warning (bool): If True, proceed with warnings.
|
||||
privileged (bool): If set to True, requires elevated privileges.
|
||||
**parameters: Arbitrary keyword arguments to be sent as parameters in the request.
|
||||
|
||||
Returns:
|
||||
dict: The JSON response from the device or an empty dictionary if an error occurs.
|
||||
"""
|
||||
url = f"http://{self.ip}:{self.port}/cgi-bin/{command}.cgi"
|
||||
auth = httpx.DigestAuth(self.username, self.pwd)
|
||||
try:
|
||||
async with httpx.AsyncClient(transport=settings.transport()) as client:
|
||||
|
||||
if parameters:
|
||||
data = await client.post(
|
||||
url,
|
||||
auth=auth,
|
||||
timeout=settings.get("api_function_timeout", 3),
|
||||
json=parameters,
|
||||
)
|
||||
else:
|
||||
data = await client.get(url, auth=auth)
|
||||
except httpx.HTTPError as e:
|
||||
return {"success": False, "message": f"HTTP error occurred: {str(e)}"}
|
||||
else:
|
||||
if data.status_code == 200:
|
||||
try:
|
||||
return data.json()
|
||||
except json.decoder.JSONDecodeError:
|
||||
return {"success": False, "message": "Failed to decode JSON"}
|
||||
return {"success": False, "message": "Unknown error occurred"}
|
||||
|
||||
async def multicommand(
|
||||
self, *commands: str, ignore_errors: bool = False, allow_warning: bool = True
|
||||
) -> dict:
|
||||
"""Execute multiple commands simultaneously.
|
||||
|
||||
Args:
|
||||
*commands (str): Multiple command strings to be executed.
|
||||
ignore_errors (bool): If True, ignore any HTTP errors.
|
||||
allow_warning (bool): If True, proceed with warnings.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing the results of all commands executed.
|
||||
"""
|
||||
async with httpx.AsyncClient(transport=settings.transport()) as client:
|
||||
tasks = [
|
||||
asyncio.create_task(self._handle_multicommand(client, command))
|
||||
for command in commands
|
||||
]
|
||||
all_data = await asyncio.gather(*tasks)
|
||||
|
||||
data = {}
|
||||
for item in all_data:
|
||||
data.update(item)
|
||||
|
||||
data["multicommand"] = True
|
||||
return data
|
||||
|
||||
async def _handle_multicommand(
|
||||
self, client: httpx.AsyncClient, command: str
|
||||
) -> dict:
|
||||
"""Helper function for handling individual commands in a multicommand execution.
|
||||
|
||||
Args:
|
||||
client (httpx.AsyncClient): The HTTP client to use for the request.
|
||||
command (str): The command to be executed.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing the response of the executed command.
|
||||
"""
|
||||
auth = httpx.DigestAuth(self.username, self.pwd)
|
||||
|
||||
try:
|
||||
url = f"http://{self.ip}/cgi-bin/{command}.cgi"
|
||||
ret = await client.get(url, auth=auth)
|
||||
except httpx.HTTPError:
|
||||
pass
|
||||
else:
|
||||
if ret.status_code == 200:
|
||||
try:
|
||||
json_data = ret.json()
|
||||
return {command: json_data}
|
||||
except json.decoder.JSONDecodeError:
|
||||
pass
|
||||
return {command: {}}
|
||||
|
||||
async def get_miner_conf(self) -> dict:
|
||||
"""Retrieve the miner configuration from the Elphapex device.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing the current configuration of the miner.
|
||||
"""
|
||||
return await self.send_command("get_miner_conf")
|
||||
|
||||
async def set_miner_conf(self, conf: dict) -> dict:
|
||||
"""Set the configuration for the miner.
|
||||
|
||||
Args:
|
||||
conf (dict): A dictionary of configuration settings to apply to the miner.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary response from the device after setting the configuration.
|
||||
"""
|
||||
return await self.send_command("set_miner_conf", **conf)
|
||||
|
||||
async def blink(self, blink: bool) -> dict:
|
||||
"""Control the blinking of the LED on the miner device.
|
||||
|
||||
Args:
|
||||
blink (bool): True to start blinking, False to stop.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary response from the device after the command execution.
|
||||
"""
|
||||
if blink:
|
||||
return await self.send_command("blink", blink="true")
|
||||
return await self.send_command("blink", blink="false")
|
||||
|
||||
async def reboot(self) -> dict:
|
||||
"""Reboot the miner device.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary response from the device confirming the reboot command.
|
||||
"""
|
||||
return await self.send_command("reboot")
|
||||
|
||||
async def get_system_info(self) -> dict:
|
||||
"""Retrieve system information from the miner.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing system information of the miner.
|
||||
"""
|
||||
return await self.send_command("get_system_info")
|
||||
|
||||
async def get_network_info(self) -> dict:
|
||||
"""Retrieve network configuration information from the miner.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing the network configuration of the miner.
|
||||
"""
|
||||
return await self.send_command("get_network_info")
|
||||
|
||||
async def summary(self) -> dict:
|
||||
"""Get a summary of the miner's status and performance.
|
||||
|
||||
Returns:
|
||||
dict: A summary of the miner's current operational status.
|
||||
"""
|
||||
return await self.send_command("summary")
|
||||
|
||||
async def stats(self) -> dict:
|
||||
"""Get miners stats.
|
||||
|
||||
Returns:
|
||||
dict: A summary of the miner's current operational status.
|
||||
"""
|
||||
return await self.send_command("stats")
|
||||
|
||||
async def get_blink_status(self) -> dict:
|
||||
"""Check the status of the LED blinking on the miner.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary indicating whether the LED is currently blinking.
|
||||
"""
|
||||
return await self.send_command("get_blink_status")
|
||||
|
||||
async def pools(self) -> dict:
|
||||
"""Check the status of the miner's pools.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing the pool status as information.
|
||||
"""
|
||||
return await self.send_command("pools")
|
||||
@@ -15,6 +15,7 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .bitaxe import ESPMinerWebAPI
|
||||
|
||||
|
||||
class LuckyMinerWebAPI(ESPMinerWebAPI):
|
||||
pass
|
||||
@@ -1,72 +0,0 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright 2024 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 __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import warnings
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
from pyasic import settings
|
||||
from pyasic.errors import APIError
|
||||
from pyasic.web.base import BaseWebAPI
|
||||
|
||||
|
||||
class MSKMinerWebAPI(BaseWebAPI):
|
||||
def __init__(self, ip: str) -> None:
|
||||
super().__init__(ip)
|
||||
self.username = "admin"
|
||||
self.pwd = settings.get("default_mskminer_web_password", "root")
|
||||
|
||||
async def multicommand(
|
||||
self, *commands: str, ignore_errors: bool = False, allow_warning: bool = True
|
||||
) -> dict:
|
||||
tasks = {c: asyncio.create_task(getattr(self, c)()) for c in commands}
|
||||
await asyncio.gather(*[t for t in tasks.values()])
|
||||
return {t: tasks[t].result() for t in tasks}
|
||||
|
||||
async def send_command(
|
||||
self,
|
||||
command: str | bytes,
|
||||
ignore_errors: bool = False,
|
||||
allow_warning: bool = True,
|
||||
privileged: bool = False,
|
||||
**parameters: Any,
|
||||
) -> dict:
|
||||
async with httpx.AsyncClient(transport=settings.transport()) as client:
|
||||
try:
|
||||
# auth
|
||||
await client.post(
|
||||
f"http://{self.ip}:{self.port}/admin/login",
|
||||
data={"username": self.username, "password": self.pwd},
|
||||
)
|
||||
except httpx.HTTPError:
|
||||
warnings.warn(f"Could not authenticate with miner web: {self}")
|
||||
try:
|
||||
resp = await client.post(
|
||||
f"http://{self.ip}:{self.port}/api/{command}", params=parameters
|
||||
)
|
||||
if not resp.status_code == 200:
|
||||
if not ignore_errors:
|
||||
raise APIError(f"Command failed: {command}")
|
||||
warnings.warn(f"Command failed: {command}")
|
||||
return resp.json()
|
||||
except httpx.HTTPError:
|
||||
raise APIError(f"Command failed: {command}")
|
||||
|
||||
async def info_v1(self):
|
||||
return await self.send_command("info_v1")
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "pyasic"
|
||||
version = "0.72.0"
|
||||
version = "0.70.0"
|
||||
|
||||
description = "A simplified and standardized interface for Bitcoin ASICs."
|
||||
authors = [{name = "UpstreamData", email = "brett@upstreamdata.ca"}]
|
||||
@@ -40,11 +40,10 @@ classifiers = [
|
||||
"Programming Language :: Python :: 3.13",
|
||||
]
|
||||
|
||||
requires-python = ">3.9, <4.0"
|
||||
requires-python = "^3.9"
|
||||
dependencies = [
|
||||
"httpx>=0.26.0",
|
||||
"asyncssh>=2.17.0",
|
||||
"cryptography>=39.0",
|
||||
"passlib>=1.7.4",
|
||||
"pyaml>=23.12.0",
|
||||
"tomli (>=2.2.1,<3.0.0) ; python_version < '3.11'",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
from tests.config_tests import TestConfig
|
||||
from tests.miners_tests import *
|
||||
from tests.miners_tests import MinersTest, TestHammerMiners
|
||||
from tests.network_tests import NetworkTest
|
||||
from tests.rpc_tests import *
|
||||
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
from .avalonminer_tests import *
|
||||
from .elphapex_tests import *
|
||||
from .hammer_tests import *
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from .version_24102401_25462b2_9ddf522 import TestAvalonMiners
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
from .version_1_0_2 import TestElphapexMiners
|
||||
@@ -1,339 +0,0 @@
|
||||
"""Tests for hammer miners with firmware dating 2023-05-28 17-20-35 CST"""
|
||||
|
||||
import unittest
|
||||
from dataclasses import fields
|
||||
from unittest.mock import patch
|
||||
|
||||
from pyasic import APIError, MinerData
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.device.algorithm.hashrate.unit.scrypt import ScryptUnit
|
||||
from pyasic.miners.elphapex import ElphapexDG1Plus
|
||||
|
||||
POOLS = [
|
||||
{
|
||||
"url": "stratum+tcp://stratum.pool.io:3333",
|
||||
"user": "pool_username.real_worker",
|
||||
"pwd": "123",
|
||||
},
|
||||
{
|
||||
"url": "stratum+tcp://stratum.pool.io:3334",
|
||||
"user": "pool_username.real_worker",
|
||||
"pwd": "123",
|
||||
},
|
||||
{
|
||||
"url": "stratum+tcp://stratum.pool.io:3335",
|
||||
"user": "pool_username.real_worker",
|
||||
"pwd": "123",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
data = {
|
||||
ElphapexDG1Plus: {
|
||||
"web_get_system_info": {
|
||||
"ipaddress": "172.19.203.183",
|
||||
"system_mode": "GNU/Linux",
|
||||
"netmask": "255.255.255.0",
|
||||
"gateway": "",
|
||||
"Algorithm": "Scrypt",
|
||||
"system_kernel_version": "4.4.194 #1 SMP Sat Sep 7 16:59:20 CST 2024",
|
||||
"system_filesystem_version": "DG1+_SW_V1.0.2",
|
||||
"nettype": "DHCP",
|
||||
"dnsservers": "",
|
||||
"netdevice": "eth0",
|
||||
"minertype": "DG1+",
|
||||
"macaddr": "12:34:56:78:90:12",
|
||||
"firmware_type": "Release",
|
||||
"hostname": "DG1+",
|
||||
},
|
||||
"web_summary": {
|
||||
"STATUS": {
|
||||
"STATUS": "S",
|
||||
"when": 2557706,
|
||||
"timestamp": 1731569527,
|
||||
"api_version": "1.0.0",
|
||||
"Msg": "summary",
|
||||
},
|
||||
"SUMMARY": [
|
||||
{
|
||||
"rate_unit": "MH/s",
|
||||
"elapsed": 357357,
|
||||
"rate_30m": 0,
|
||||
"rate_5s": 14920.940000000001,
|
||||
"bestshare": 0,
|
||||
"rate_ideal": 14229,
|
||||
"status": [
|
||||
{"status": "s", "type": "rate", "msg": "", "code": 0},
|
||||
{"status": "s", "type": "network", "msg": "", "code": 0},
|
||||
{"status": "s", "type": "fans", "msg": "", "code": 0},
|
||||
{"status": "s", "type": "temp", "msg": "", "code": 0},
|
||||
],
|
||||
"hw_all": 14199.040000000001,
|
||||
"rate_avg": 14199.040000000001,
|
||||
"rate_15m": 14415,
|
||||
}
|
||||
],
|
||||
"INFO": {
|
||||
"miner_version": "DG1+_SW_V1.0.2",
|
||||
"CompileTime": "",
|
||||
"dev_sn": "28HY245192N000245C23B",
|
||||
"type": "DG1+",
|
||||
"hw_version": "DG1+_HW_V1.0",
|
||||
},
|
||||
},
|
||||
"web_stats": {
|
||||
"STATUS": {
|
||||
"STATUS": "S",
|
||||
"when": 2557700,
|
||||
"timestamp": 1731569521,
|
||||
"api_version": "1.0.0",
|
||||
"Msg": "stats",
|
||||
},
|
||||
"INFO": {
|
||||
"miner_version": "DG1+_SW_V1.0.2",
|
||||
"CompileTime": "",
|
||||
"dev_sn": "28HY245192N000245C23B",
|
||||
"type": "DG1+",
|
||||
"hw_version": "DG1+_HW_V1.0",
|
||||
},
|
||||
"STATS": [
|
||||
{
|
||||
"rate_unit": "MH/s",
|
||||
"elapsed": 357352,
|
||||
"rate_30m": 0,
|
||||
"rate_5s": 11531.879999999999,
|
||||
"hwp_total": 0.11550000000000001,
|
||||
"rate_ideal": 14229,
|
||||
"chain": [
|
||||
{
|
||||
"freq_avg": 62000,
|
||||
"index": 0,
|
||||
"sn": "13HY245156N000581H11JB52",
|
||||
"temp_chip": ["47125", "50500", "", ""],
|
||||
"eeprom_loaded": True,
|
||||
"rate_15m": 3507,
|
||||
"hw": 204,
|
||||
"temp_pcb": [47, 46, 67, 66],
|
||||
"failrate": 0.029999999999999999,
|
||||
"asic": "ooooooooo oooooooo oooooooo oooooooo oooo",
|
||||
"rate_real": 3553.5,
|
||||
"asic_num": 204,
|
||||
"temp_pic": [47, 46, 67, 66],
|
||||
"rate_ideal": 3557.25,
|
||||
"hashrate": 3278.5999999999999,
|
||||
},
|
||||
{
|
||||
"freq_avg": 62000,
|
||||
"index": 1,
|
||||
"sn": "13HY245156N000579H11JB52",
|
||||
"temp_chip": ["52812", "56937", "", ""],
|
||||
"eeprom_loaded": True,
|
||||
"rate_15m": 3736,
|
||||
"hw": 204,
|
||||
"temp_pcb": [47, 46, 67, 66],
|
||||
"failrate": 0.02,
|
||||
"asic": "ooooooooo oooooooo oooooooo oooooooo oooo",
|
||||
"rate_real": 3550.1100000000001,
|
||||
"asic_num": 204,
|
||||
"temp_pic": [47, 46, 67, 66],
|
||||
"rate_ideal": 3557.25,
|
||||
"hashrate": 3491.8400000000001,
|
||||
},
|
||||
{
|
||||
"freq_avg": 62000,
|
||||
"index": 2,
|
||||
"sn": "13HY245156N000810H11JB52",
|
||||
"temp_chip": ["48312", "51687", "", ""],
|
||||
"eeprom_loaded": True,
|
||||
"rate_15m": 3531,
|
||||
"hw": 204,
|
||||
"temp_pcb": [47, 46, 67, 66],
|
||||
"failrate": 0.51000000000000001,
|
||||
"asic": "ooooooooo oooooooo oooooooo oooooooo oooo",
|
||||
"rate_real": 3551.8000000000002,
|
||||
"asic_num": 204,
|
||||
"temp_pic": [47, 46, 67, 66],
|
||||
"rate_ideal": 3557.25,
|
||||
"hashrate": 3408.6999999999998,
|
||||
},
|
||||
{
|
||||
"freq_avg": 62000,
|
||||
"index": 3,
|
||||
"sn": "13HY245156N000587H11JB52",
|
||||
"temp_chip": ["46500", "49062", "", ""],
|
||||
"eeprom_loaded": True,
|
||||
"rate_15m": 3641,
|
||||
"hw": 204,
|
||||
"temp_pcb": [47, 46, 67, 66],
|
||||
"failrate": 0.029999999999999999,
|
||||
"asic": "ooooooooo oooooooo oooooooo oooooooo oooo",
|
||||
"rate_real": 3543.6300000000001,
|
||||
"asic_num": 204,
|
||||
"temp_pic": [47, 46, 67, 66],
|
||||
"rate_ideal": 3557.25,
|
||||
"hashrate": 3463.6799999999998,
|
||||
},
|
||||
],
|
||||
"rate_15m": 14415,
|
||||
"chain_num": 4,
|
||||
"fan": ["5340", "5400", "5400", "5400"],
|
||||
"rate_avg": 14199.040000000001,
|
||||
"fan_num": 4,
|
||||
}
|
||||
],
|
||||
},
|
||||
"web_get_blink_status": {"blink": False},
|
||||
"web_get_miner_conf": {
|
||||
"pools": [
|
||||
{
|
||||
"url": "stratum+tcp://ltc.trustpool.ru:3333",
|
||||
"pass": "123",
|
||||
"user": "Nikita9231.fworker",
|
||||
},
|
||||
{
|
||||
"url": "stratum+tcp://ltc.trustpool.ru:443",
|
||||
"pass": "123",
|
||||
"user": "Nikita9231.fworker",
|
||||
},
|
||||
{
|
||||
"url": "stratum+tcp://ltc.trustpool.ru:25",
|
||||
"pass": "123",
|
||||
"user": "Nikita9231.fworker",
|
||||
},
|
||||
],
|
||||
"fc-voltage": "1470",
|
||||
"fc-fan-ctrl": False,
|
||||
"fc-freq-level": "100",
|
||||
"fc-fan-pwm": "80",
|
||||
"algo": "ltc",
|
||||
"fc-work-mode": 0,
|
||||
"fc-freq": "1850",
|
||||
},
|
||||
"web_pools": {
|
||||
"STATUS": {
|
||||
"STATUS": "S",
|
||||
"when": 5411762,
|
||||
"timestamp": 1738768594,
|
||||
"api_version": "1.0.0",
|
||||
"Msg": "pools",
|
||||
},
|
||||
"Device Total Rejected": 8888,
|
||||
"POOLS": [
|
||||
{
|
||||
"diffs": 0,
|
||||
"diffr": 524288,
|
||||
"index": 0,
|
||||
"user": "pool_username.real_worker",
|
||||
"lsdiff": 524288,
|
||||
"lstime": "00:00:18",
|
||||
"diffa": 524288,
|
||||
"accepted": 798704,
|
||||
"diff1": 0,
|
||||
"stale": 0,
|
||||
"diff": "",
|
||||
"rejected": 3320,
|
||||
"status": "Unreachable",
|
||||
"getworks": 802024,
|
||||
"priority": 0,
|
||||
"url": "stratum+tcp://stratum.pool.io:3333",
|
||||
},
|
||||
{
|
||||
"diffs": 0,
|
||||
"diffr": 524288,
|
||||
"index": 1,
|
||||
"user": "pool_username.real_worker",
|
||||
"lsdiff": 524288,
|
||||
"lstime": "00:00:00",
|
||||
"diffa": 524288,
|
||||
"accepted": 604803,
|
||||
"diff1": 0,
|
||||
"stale": 0,
|
||||
"diff": "",
|
||||
"rejected": 2492,
|
||||
"status": "Alive",
|
||||
"getworks": 607295,
|
||||
"priority": 1,
|
||||
"url": "stratum+tcp://stratum.pool.io:3334",
|
||||
},
|
||||
{
|
||||
"diffs": 0,
|
||||
"diffr": 524288,
|
||||
"index": 2,
|
||||
"user": "pool_username.real_worker",
|
||||
"lsdiff": 524288,
|
||||
"lstime": "00:00:05",
|
||||
"diffa": 524288,
|
||||
"accepted": 691522,
|
||||
"diff1": 0,
|
||||
"stale": 0,
|
||||
"diff": "",
|
||||
"rejected": 3076,
|
||||
"status": "Unreachable",
|
||||
"getworks": 694598,
|
||||
"priority": 2,
|
||||
"url": "stratum+tcp://stratum.pool.io:3335",
|
||||
},
|
||||
],
|
||||
"Device Rejected%": 0.41999999999999998,
|
||||
"Device Total Work": 2103917,
|
||||
"INFO": {
|
||||
"miner_version": "DG1+_SW_V1.0.2",
|
||||
"CompileTime": "",
|
||||
"dev_sn": "28HY245192N000245C23B",
|
||||
"type": "DG1+",
|
||||
"hw_version": "DG1+_HW_V1.0",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class TestElphapexMiners(unittest.IsolatedAsyncioTestCase):
|
||||
@patch("pyasic.rpc.base.BaseMinerRPCAPI._send_bytes")
|
||||
async def test_all_data_gathering(self, mock_send_bytes):
|
||||
mock_send_bytes.raises = APIError()
|
||||
for m_type in data:
|
||||
gathered_data = {}
|
||||
miner = m_type("127.0.0.1")
|
||||
for data_name in fields(miner.data_locations):
|
||||
if data_name.name == "config":
|
||||
# skip
|
||||
continue
|
||||
data_func = getattr(miner.data_locations, data_name.name)
|
||||
fn_args = data_func.kwargs
|
||||
args_to_send = {k.name: data[m_type][k.name] for k in fn_args}
|
||||
function = getattr(miner, data_func.cmd)
|
||||
gathered_data[data_name.name] = await function(**args_to_send)
|
||||
|
||||
result = MinerData(
|
||||
ip=str(miner.ip),
|
||||
device_info=miner.device_info,
|
||||
expected_chips=(
|
||||
miner.expected_chips * miner.expected_hashboards
|
||||
if miner.expected_chips is not None
|
||||
else 0
|
||||
),
|
||||
expected_hashboards=miner.expected_hashboards,
|
||||
expected_fans=miner.expected_fans,
|
||||
hashboards=[
|
||||
HashBoard(slot=i, expected_chips=miner.expected_chips)
|
||||
for i in range(miner.expected_hashboards)
|
||||
],
|
||||
)
|
||||
for item in gathered_data:
|
||||
if gathered_data[item] is not None:
|
||||
setattr(result, item, gathered_data[item])
|
||||
|
||||
self.assertEqual(result.mac, "12:34:56:78:90:12")
|
||||
self.assertEqual(result.api_ver, "1.0.0")
|
||||
self.assertEqual(result.fw_ver, "1.0.2")
|
||||
self.assertEqual(result.hostname, "DG1+")
|
||||
self.assertEqual(round(result.hashrate.into(ScryptUnit.MH)), 14199)
|
||||
self.assertEqual(
|
||||
result.fans,
|
||||
[Fan(speed=5340), Fan(speed=5400), Fan(speed=5400), Fan(speed=5400)],
|
||||
)
|
||||
self.assertEqual(result.total_chips, result.expected_chips)
|
||||
self.assertEqual(
|
||||
set([str(p.url) for p in result.pools]), set(p["url"] for p in POOLS)
|
||||
)
|
||||
@@ -16,12 +16,12 @@ POOLS = [
|
||||
"pwd": "123",
|
||||
},
|
||||
{
|
||||
"url": "stratum+tcp://stratum.pool.io:3334",
|
||||
"url": "stratum+tcp://stratum.pool.io:3333",
|
||||
"user": "pool_username.real_worker",
|
||||
"pwd": "123",
|
||||
},
|
||||
{
|
||||
"url": "stratum+tcp://stratum.pool.io:3335",
|
||||
"url": "stratum+tcp://stratum.pool.io:3333",
|
||||
"user": "pool_username.real_worker",
|
||||
"pwd": "123",
|
||||
},
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from .version_2_6_0_39 import TestMSKMiners
|
||||
@@ -1,500 +0,0 @@
|
||||
"""Tests for MSK miner firmware version 2.6.0.39"""
|
||||
|
||||
import unittest
|
||||
from dataclasses import fields
|
||||
from unittest.mock import patch
|
||||
|
||||
from pyasic import APIError, MinerData
|
||||
from pyasic.data import Fan, HashBoard
|
||||
from pyasic.device.algorithm import SHA256Unit
|
||||
from pyasic.miners.antminer import MSKMinerS19NoPIC
|
||||
|
||||
POOLS = [
|
||||
{
|
||||
"url": "stratum+tcp://stratum.pool.io:3333",
|
||||
"user": "pool_username.real_worker",
|
||||
"pwd": "123",
|
||||
},
|
||||
{
|
||||
"url": "stratum+tcp://stratum.pool.io:3334",
|
||||
"user": "pool_username.real_worker",
|
||||
"pwd": "123",
|
||||
},
|
||||
{
|
||||
"url": "stratum+tcp://stratum.pool.io:3335",
|
||||
"user": "pool_username.real_worker",
|
||||
"pwd": "123",
|
||||
},
|
||||
]
|
||||
|
||||
data = {
|
||||
MSKMinerS19NoPIC: {
|
||||
"web_info_v1": {
|
||||
# needs updates with real data
|
||||
"network_info": {
|
||||
"result": {
|
||||
"address": "192.168.1.10",
|
||||
"macaddr": "12:34:56:78:90:12",
|
||||
"netmask": "255.255.255.0",
|
||||
}
|
||||
}
|
||||
},
|
||||
"rpc_version": {
|
||||
"STATUS": [
|
||||
{
|
||||
"STATUS": "S",
|
||||
"When": 1738856891,
|
||||
"Code": 22,
|
||||
"Msg": "BMMiner versions",
|
||||
"Description": "bmminer 1.0.0",
|
||||
}
|
||||
],
|
||||
"VERSION": [
|
||||
{
|
||||
"BMMiner": "4.11.1 rwglr",
|
||||
"API": "3.1",
|
||||
"Miner": "0.0.1.3",
|
||||
"CompileTime": "10 Dec 2024 14:34:31 GMT",
|
||||
"Type": "S19-88 v.2.6.0.39 ",
|
||||
}
|
||||
],
|
||||
"id": 1,
|
||||
},
|
||||
"rpc_stats": {
|
||||
"STATUS": [
|
||||
{
|
||||
"STATUS": "S",
|
||||
"When": 1738856891,
|
||||
"Code": 70,
|
||||
"Msg": "BMMiner stats",
|
||||
"Description": "bmminer 1.0.0",
|
||||
}
|
||||
],
|
||||
"STATS": [
|
||||
{
|
||||
"BMMiner": "4.11.1 rwglr",
|
||||
"Miner": "0.0.1.3",
|
||||
"CompileTime": "10 Dec 2024 14:34:31 GMT",
|
||||
"Type": "S19-88 v.2.6.0.39 ",
|
||||
},
|
||||
{
|
||||
"STATS": 0,
|
||||
"ID": "BC50",
|
||||
"Elapsed": 1926,
|
||||
"Calls": 0,
|
||||
"Wait": 0.000000,
|
||||
"Max": 0.000000,
|
||||
"Min": 99999999.000000,
|
||||
"GHS 5s": 99989.59,
|
||||
"GHS av": 99761.40,
|
||||
"miner_count": 3,
|
||||
"frequency": "",
|
||||
"fan_num": 4,
|
||||
"fan1": 5010,
|
||||
"fan2": 5160,
|
||||
"fan3": 5070,
|
||||
"fan4": 5040,
|
||||
"fan5": 0,
|
||||
"fan6": 0,
|
||||
"fan7": 0,
|
||||
"fan8": 0,
|
||||
"temp_num": 3,
|
||||
"temp1": 45,
|
||||
"temp2": 45,
|
||||
"temp3": 47,
|
||||
"temp4": 0,
|
||||
"temp5": 0,
|
||||
"temp6": 0,
|
||||
"temp7": 0,
|
||||
"temp8": 0,
|
||||
"temp9": 0,
|
||||
"temp10": 0,
|
||||
"temp11": 0,
|
||||
"temp12": 0,
|
||||
"temp13": 0,
|
||||
"temp14": 0,
|
||||
"temp15": 0,
|
||||
"temp16": 0,
|
||||
"temp2_1": 59,
|
||||
"temp2_2": 57,
|
||||
"temp2_3": 58,
|
||||
"temp2_4": 0,
|
||||
"temp2_5": 0,
|
||||
"temp2_6": 0,
|
||||
"temp2_7": 0,
|
||||
"temp2_8": 0,
|
||||
"temp2_9": 0,
|
||||
"temp2_10": 0,
|
||||
"temp2_11": 0,
|
||||
"temp2_12": 0,
|
||||
"temp2_13": 0,
|
||||
"temp2_14": 0,
|
||||
"temp2_15": 0,
|
||||
"temp2_16": 0,
|
||||
"temp3_1": 59,
|
||||
"temp3_2": 56,
|
||||
"temp3_3": 57,
|
||||
"temp3_4": 0,
|
||||
"temp3_5": 0,
|
||||
"temp3_6": 0,
|
||||
"temp3_7": 0,
|
||||
"temp3_8": 0,
|
||||
"temp3_9": 0,
|
||||
"temp3_10": 0,
|
||||
"temp3_11": 0,
|
||||
"temp3_12": 0,
|
||||
"temp3_13": 0,
|
||||
"temp3_14": 0,
|
||||
"temp3_15": 0,
|
||||
"temp3_16": 0,
|
||||
"temp_pcb1": "45-42-45-42",
|
||||
"temp_pcb2": "45-42-45-42",
|
||||
"temp_pcb3": "47-43-47-43",
|
||||
"temp_pcb4": "0-0-0-0",
|
||||
"temp_pcb5": "0-0-0-0",
|
||||
"temp_pcb6": "0-0-0-0",
|
||||
"temp_pcb7": "0-0-0-0",
|
||||
"temp_pcb8": "0-0-0-0",
|
||||
"temp_pcb9": "0-0-0-0",
|
||||
"temp_pcb10": "0-0-0-0",
|
||||
"temp_pcb11": "0-0-0-0",
|
||||
"temp_pcb12": "0-0-0-0",
|
||||
"temp_pcb13": "0-0-0-0",
|
||||
"temp_pcb14": "0-0-0-0",
|
||||
"temp_pcb15": "0-0-0-0",
|
||||
"temp_pcb16": "0-0-0-0",
|
||||
"temp_chip1": "59-59-59-59",
|
||||
"temp_chip2": "57-56-57-56",
|
||||
"temp_chip3": "58-57-58-57",
|
||||
"temp_chip4": "0-0-0-0",
|
||||
"temp_chip5": "0-0-0-0",
|
||||
"temp_chip6": "0-0-0-0",
|
||||
"temp_chip7": "0-0-0-0",
|
||||
"temp_chip8": "0-0-0-0",
|
||||
"temp_chip9": "0-0-0-0",
|
||||
"temp_chip10": "0-0-0-0",
|
||||
"temp_chip11": "0-0-0-0",
|
||||
"temp_chip12": "0-0-0-0",
|
||||
"temp_chip13": "0-0-0-0",
|
||||
"temp_chip14": "0-0-0-0",
|
||||
"temp_chip15": "0-0-0-0",
|
||||
"temp_chip16": "0-0-0-0",
|
||||
"total_rateideal": 99674.88,
|
||||
"total_freqavg": 0.00,
|
||||
"total_acn": 264,
|
||||
"total_rate": 99989.59,
|
||||
"chain_rateideal1": 33677.28,
|
||||
"chain_rateideal2": 32788.06,
|
||||
"chain_rateideal3": 33209.54,
|
||||
"chain_rateideal4": 31436.24,
|
||||
"chain_rateideal5": 31436.24,
|
||||
"chain_rateideal6": 31436.24,
|
||||
"chain_rateideal7": 31436.24,
|
||||
"chain_rateideal8": 31436.24,
|
||||
"chain_rateideal9": 31436.24,
|
||||
"chain_rateideal10": 31436.24,
|
||||
"chain_rateideal11": 31436.24,
|
||||
"chain_rateideal12": 31436.24,
|
||||
"chain_rateideal13": 31436.24,
|
||||
"chain_rateideal14": 31436.24,
|
||||
"chain_rateideal15": 31436.24,
|
||||
"chain_rateideal16": 31436.24,
|
||||
"temp_max": 47,
|
||||
"no_matching_work": 0,
|
||||
"chain_acn1": 88,
|
||||
"chain_acn2": 88,
|
||||
"chain_acn3": 88,
|
||||
"chain_acn4": 0,
|
||||
"chain_acn5": 0,
|
||||
"chain_acn6": 0,
|
||||
"chain_acn7": 0,
|
||||
"chain_acn8": 0,
|
||||
"chain_acn9": 0,
|
||||
"chain_acn10": 0,
|
||||
"chain_acn11": 0,
|
||||
"chain_acn12": 0,
|
||||
"chain_acn13": 0,
|
||||
"chain_acn14": 0,
|
||||
"chain_acn15": 0,
|
||||
"chain_acn16": 0,
|
||||
"chain_acs1": " oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo",
|
||||
"chain_acs2": " oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo",
|
||||
"chain_acs3": " oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo oo",
|
||||
"chain_acs4": "",
|
||||
"chain_acs5": "",
|
||||
"chain_acs6": "",
|
||||
"chain_acs7": "",
|
||||
"chain_acs8": "",
|
||||
"chain_acs9": "",
|
||||
"chain_acs10": "",
|
||||
"chain_acs11": "",
|
||||
"chain_acs12": "",
|
||||
"chain_acs13": "",
|
||||
"chain_acs14": "",
|
||||
"chain_acs15": "",
|
||||
"chain_acs16": "",
|
||||
"chain_hw1": 0,
|
||||
"chain_hw2": 0,
|
||||
"chain_hw3": 0,
|
||||
"chain_hw4": 0,
|
||||
"chain_hw5": 0,
|
||||
"chain_hw6": 0,
|
||||
"chain_hw7": 0,
|
||||
"chain_hw8": 0,
|
||||
"chain_hw9": 0,
|
||||
"chain_hw10": 0,
|
||||
"chain_hw11": 0,
|
||||
"chain_hw12": 0,
|
||||
"chain_hw13": 0,
|
||||
"chain_hw14": 0,
|
||||
"chain_hw15": 0,
|
||||
"chain_hw16": 0,
|
||||
"chain_rate1": 34084.86,
|
||||
"chain_rate2": 32303.65,
|
||||
"chain_rate3": 33601.08,
|
||||
"chain_rate4": 0.00,
|
||||
"chain_rate5": 0.00,
|
||||
"chain_rate6": 0.00,
|
||||
"chain_rate7": 0.00,
|
||||
"chain_rate8": 0.00,
|
||||
"chain_rate9": 0.00,
|
||||
"chain_rate10": 0.00,
|
||||
"chain_rate11": 0.00,
|
||||
"chain_rate12": 0.00,
|
||||
"chain_rate13": 0.00,
|
||||
"chain_rate14": 0.00,
|
||||
"chain_rate15": 0.00,
|
||||
"chain_rate16": 0.00,
|
||||
"chain_xtime1": "{}",
|
||||
"chain_xtime2": "{}",
|
||||
"chain_xtime3": "{}",
|
||||
"chain_offside_1": "",
|
||||
"chain_offside_2": "",
|
||||
"chain_offside_3": "",
|
||||
"chain_opencore_0": "1",
|
||||
"chain_opencore_1": "1",
|
||||
"chain_opencore_2": "1",
|
||||
"freq1": 744,
|
||||
"freq2": 724,
|
||||
"freq3": 734,
|
||||
"freq4": 0,
|
||||
"freq5": 0,
|
||||
"freq6": 0,
|
||||
"freq7": 0,
|
||||
"freq8": 0,
|
||||
"freq9": 0,
|
||||
"freq10": 0,
|
||||
"freq11": 0,
|
||||
"freq12": 0,
|
||||
"freq13": 0,
|
||||
"freq14": 0,
|
||||
"freq15": 0,
|
||||
"freq16": 0,
|
||||
"chain_avgrate1": 33585.34,
|
||||
"chain_avgrate2": 32788.97,
|
||||
"chain_avgrate3": 33336.44,
|
||||
"chain_avgrate4": 0.00,
|
||||
"chain_avgrate5": 0.00,
|
||||
"chain_avgrate6": 0.00,
|
||||
"chain_avgrate7": 0.00,
|
||||
"chain_avgrate8": 0.00,
|
||||
"chain_avgrate9": 0.00,
|
||||
"chain_avgrate10": 0.00,
|
||||
"chain_avgrate11": 0.00,
|
||||
"chain_avgrate12": 0.00,
|
||||
"chain_avgrate13": 0.00,
|
||||
"chain_avgrate14": 0.00,
|
||||
"chain_avgrate15": 0.00,
|
||||
"chain_avgrate16": 0.00,
|
||||
"miner_version": "0.0.1.3",
|
||||
"miner_id": "",
|
||||
"chain_power1": 1135,
|
||||
"chain_power2": 1103,
|
||||
"chain_power3": 1118,
|
||||
"total_power": 3358,
|
||||
"chain_voltage1": 15.70,
|
||||
"chain_voltage2": 15.70,
|
||||
"chain_voltage3": 15.70,
|
||||
"chain_voltage4": 15.70,
|
||||
"chain_voltage5": 15.70,
|
||||
"chain_voltage6": 15.70,
|
||||
"chain_voltage7": 15.70,
|
||||
"chain_voltage8": 15.70,
|
||||
"chain_voltage9": 15.70,
|
||||
"chain_voltage10": 15.70,
|
||||
"chain_voltage11": 15.70,
|
||||
"chain_voltage12": 15.70,
|
||||
"chain_voltage13": 15.70,
|
||||
"chain_voltage14": 15.70,
|
||||
"chain_voltage15": 15.70,
|
||||
"chain_voltage16": 15.70,
|
||||
"fan_pwm": 82,
|
||||
"bringup_temp": 16,
|
||||
"has_pic": "1",
|
||||
"tune_running": "0",
|
||||
"psu_status": "PSU OK",
|
||||
"downscale_mode": "0",
|
||||
"has_hotel_fee": "0",
|
||||
},
|
||||
],
|
||||
"id": 1,
|
||||
},
|
||||
"rpc_pools": {
|
||||
"STATUS": [
|
||||
{
|
||||
"Code": 7,
|
||||
"Description": "cgminer 1.0.0",
|
||||
"Msg": "3 Pool(s)",
|
||||
"STATUS": "S",
|
||||
"When": 1732121693,
|
||||
}
|
||||
],
|
||||
"POOLS": [
|
||||
{
|
||||
"Accepted": 10000,
|
||||
"Best Share": 1000000000.0,
|
||||
"Diff": "100K",
|
||||
"Diff1 Shares": 0,
|
||||
"Difficulty Accepted": 1000000000.0,
|
||||
"Difficulty Rejected": 1000000.0,
|
||||
"Difficulty Stale": 0.0,
|
||||
"Discarded": 100000,
|
||||
"Get Failures": 3,
|
||||
"Getworks": 9000,
|
||||
"Has GBT": False,
|
||||
"Has Stratum": True,
|
||||
"Last Share Difficulty": 100000.0,
|
||||
"Last Share Time": "0:00:02",
|
||||
"Long Poll": "N",
|
||||
"POOL": 0,
|
||||
"Pool Rejected%": 0.0,
|
||||
"Pool Stale%%": 0.0,
|
||||
"Priority": 0,
|
||||
"Proxy": "",
|
||||
"Proxy Type": "",
|
||||
"Quota": 1,
|
||||
"Rejected": 100,
|
||||
"Remote Failures": 0,
|
||||
"Stale": 0,
|
||||
"Status": "Alive",
|
||||
"Stratum Active": True,
|
||||
"Stratum URL": "stratum.pool.io",
|
||||
"URL": "stratum+tcp://stratum.pool.io:3333",
|
||||
"User": "pool_username.real_worker",
|
||||
},
|
||||
{
|
||||
"Accepted": 10000,
|
||||
"Best Share": 1000000000.0,
|
||||
"Diff": "100K",
|
||||
"Diff1 Shares": 0,
|
||||
"Difficulty Accepted": 1000000000.0,
|
||||
"Difficulty Rejected": 1000000.0,
|
||||
"Difficulty Stale": 0.0,
|
||||
"Discarded": 100000,
|
||||
"Get Failures": 3,
|
||||
"Getworks": 9000,
|
||||
"Has GBT": False,
|
||||
"Has Stratum": True,
|
||||
"Last Share Difficulty": 100000.0,
|
||||
"Last Share Time": "0:00:02",
|
||||
"Long Poll": "N",
|
||||
"POOL": 1,
|
||||
"Pool Rejected%": 0.0,
|
||||
"Pool Stale%%": 0.0,
|
||||
"Priority": 0,
|
||||
"Proxy": "",
|
||||
"Proxy Type": "",
|
||||
"Quota": 1,
|
||||
"Rejected": 100,
|
||||
"Remote Failures": 0,
|
||||
"Stale": 0,
|
||||
"Status": "Alive",
|
||||
"Stratum Active": True,
|
||||
"Stratum URL": "stratum.pool.io",
|
||||
"URL": "stratum+tcp://stratum.pool.io:3333",
|
||||
"User": "pool_username.real_worker",
|
||||
},
|
||||
{
|
||||
"Accepted": 10000,
|
||||
"Best Share": 1000000000.0,
|
||||
"Diff": "100K",
|
||||
"Diff1 Shares": 0,
|
||||
"Difficulty Accepted": 1000000000.0,
|
||||
"Difficulty Rejected": 1000000.0,
|
||||
"Difficulty Stale": 0.0,
|
||||
"Discarded": 100000,
|
||||
"Get Failures": 3,
|
||||
"Getworks": 9000,
|
||||
"Has GBT": False,
|
||||
"Has Stratum": True,
|
||||
"Last Share Difficulty": 100000.0,
|
||||
"Last Share Time": "0:00:02",
|
||||
"Long Poll": "N",
|
||||
"POOL": 2,
|
||||
"Pool Rejected%": 0.0,
|
||||
"Pool Stale%%": 0.0,
|
||||
"Priority": 0,
|
||||
"Proxy": "",
|
||||
"Proxy Type": "",
|
||||
"Quota": 1,
|
||||
"Rejected": 100,
|
||||
"Remote Failures": 0,
|
||||
"Stale": 0,
|
||||
"Status": "Alive",
|
||||
"Stratum Active": True,
|
||||
"Stratum URL": "stratum.pool.io",
|
||||
"URL": "stratum+tcp://stratum.pool.io:3333",
|
||||
"User": "pool_username.real_worker",
|
||||
},
|
||||
],
|
||||
"id": 1,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class TestMSKMiners(unittest.IsolatedAsyncioTestCase):
|
||||
@patch("pyasic.rpc.base.BaseMinerRPCAPI._send_bytes")
|
||||
async def test_all_data_gathering(self, mock_send_bytes):
|
||||
mock_send_bytes.raises = APIError()
|
||||
for m_type in data:
|
||||
gathered_data = {}
|
||||
miner = m_type("127.0.0.1")
|
||||
for data_name in fields(miner.data_locations):
|
||||
if data_name.name == "config":
|
||||
# skip
|
||||
continue
|
||||
data_func = getattr(miner.data_locations, data_name.name)
|
||||
fn_args = data_func.kwargs
|
||||
args_to_send = {k.name: data[m_type][k.name] for k in fn_args}
|
||||
function = getattr(miner, data_func.cmd)
|
||||
gathered_data[data_name.name] = await function(**args_to_send)
|
||||
|
||||
result = MinerData(
|
||||
ip=str(miner.ip),
|
||||
device_info=miner.device_info,
|
||||
expected_chips=(
|
||||
miner.expected_chips * miner.expected_hashboards
|
||||
if miner.expected_chips is not None
|
||||
else 0
|
||||
),
|
||||
expected_hashboards=miner.expected_hashboards,
|
||||
expected_fans=miner.expected_fans,
|
||||
hashboards=[
|
||||
HashBoard(slot=i, expected_chips=miner.expected_chips)
|
||||
for i in range(miner.expected_hashboards)
|
||||
],
|
||||
)
|
||||
for item in gathered_data:
|
||||
if gathered_data[item] is not None:
|
||||
setattr(result, item, gathered_data[item])
|
||||
|
||||
self.assertEqual(result.mac, "12:34:56:78:90:12")
|
||||
self.assertEqual(result.api_ver, "3.1")
|
||||
self.assertEqual(result.fw_ver, "10 Dec 2024 14:34:31 GMT")
|
||||
self.assertEqual(round(result.hashrate.into(SHA256Unit.TH)), 100)
|
||||
self.assertEqual(
|
||||
result.fans,
|
||||
[Fan(speed=5010), Fan(speed=5160), Fan(speed=5070), Fan(speed=5040)],
|
||||
)
|
||||
self.assertEqual(result.total_chips, result.expected_chips)
|
||||
Reference in New Issue
Block a user