Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd52d3aeaf | ||
|
|
66c9b3663e | ||
|
|
5f0e1da938 |
@@ -5,13 +5,13 @@ ci:
|
|||||||
- generate-docs
|
- generate-docs
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/python-poetry/poetry
|
- repo: https://github.com/python-poetry/poetry
|
||||||
rev: 2.1.2
|
rev: 2.2.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: poetry-check
|
- id: poetry-check
|
||||||
- id: poetry-lock
|
- id: poetry-lock
|
||||||
- id: poetry-install
|
- id: poetry-install
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v5.0.0
|
rev: v6.0.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
@@ -23,7 +23,7 @@ repos:
|
|||||||
exclude: ^mkdocs\.yml$
|
exclude: ^mkdocs\.yml$
|
||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 25.1.0
|
rev: 25.9.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
- repo: https://github.com/pycqa/isort
|
- repo: https://github.com/pycqa/isort
|
||||||
|
|||||||
968
poetry.lock
generated
968
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -83,6 +83,7 @@ class MinerData(BaseModel):
|
|||||||
|
|
||||||
# about
|
# about
|
||||||
device_info: DeviceInfo | None = None
|
device_info: DeviceInfo | None = None
|
||||||
|
serial_number: str | None = None
|
||||||
mac: str | None = None
|
mac: str | None = None
|
||||||
api_ver: str | None = None
|
api_ver: str | None = None
|
||||||
fw_ver: str | None = None
|
fw_ver: str | None = None
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ from pyasic.web.antminer import AntminerModernWebAPI, AntminerOldWebAPI
|
|||||||
|
|
||||||
ANTMINER_MODERN_DATA_LOC = DataLocations(
|
ANTMINER_MODERN_DATA_LOC = DataLocations(
|
||||||
**{
|
**{
|
||||||
|
str(DataOptions.SERIAL_NUMBER): DataFunction(
|
||||||
|
"_get_serial_number",
|
||||||
|
[WebAPICommand("web_get_system_info", "get_system_info")],
|
||||||
|
),
|
||||||
str(DataOptions.MAC): DataFunction(
|
str(DataOptions.MAC): DataFunction(
|
||||||
"_get_mac",
|
"_get_mac",
|
||||||
[WebAPICommand("web_get_system_info", "get_system_info")],
|
[WebAPICommand("web_get_system_info", "get_system_info")],
|
||||||
@@ -360,6 +364,21 @@ class AntminerModern(BMMiner):
|
|||||||
except LookupError:
|
except LookupError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
async def _get_serial_number(
|
||||||
|
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["serinum"]
|
||||||
|
except LookupError:
|
||||||
|
pass
|
||||||
|
|
||||||
async def set_static_ip(
|
async def set_static_ip(
|
||||||
self,
|
self,
|
||||||
ip: str,
|
ip: str,
|
||||||
|
|||||||
@@ -209,6 +209,14 @@ class MinerProtocol(Protocol):
|
|||||||
### DATA GATHERING FUNCTIONS (get_{some_data}) ###
|
### DATA GATHERING FUNCTIONS (get_{some_data}) ###
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
|
async def get_serial_number(self) -> Optional[str]:
|
||||||
|
"""Get the serial number of the miner and return it as a string.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A string representing the serial number of the miner.
|
||||||
|
"""
|
||||||
|
return await self._get_serial_number()
|
||||||
|
|
||||||
async def get_mac(self) -> Optional[str]:
|
async def get_mac(self) -> Optional[str]:
|
||||||
"""Get the MAC address of the miner and return it as a string.
|
"""Get the MAC address of the miner and return it as a string.
|
||||||
|
|
||||||
@@ -379,6 +387,9 @@ class MinerProtocol(Protocol):
|
|||||||
"""
|
"""
|
||||||
return await self._get_pools()
|
return await self._get_pools()
|
||||||
|
|
||||||
|
async def _get_serial_number(self) -> Optional[str]:
|
||||||
|
pass
|
||||||
|
|
||||||
async def _get_mac(self) -> Optional[str]:
|
async def _get_mac(self) -> Optional[str]:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ from typing import List, Union
|
|||||||
|
|
||||||
|
|
||||||
class DataOptions(Enum):
|
class DataOptions(Enum):
|
||||||
|
SERIAL_NUMBER = "serial_number"
|
||||||
MAC = "mac"
|
MAC = "mac"
|
||||||
API_VERSION = "api_ver"
|
API_VERSION = "api_ver"
|
||||||
FW_VERSION = "fw_ver"
|
FW_VERSION = "fw_ver"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "pyasic"
|
name = "pyasic"
|
||||||
version = "0.76.9"
|
version = "0.77.0"
|
||||||
|
|
||||||
description = "A simplified and standardized interface for Bitcoin ASICs."
|
description = "A simplified and standardized interface for Bitcoin ASICs."
|
||||||
authors = [{name = "UpstreamData", email = "brett@upstreamdata.ca"}]
|
authors = [{name = "UpstreamData", email = "brett@upstreamdata.ca"}]
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ class MinersTest(unittest.TestCase):
|
|||||||
"hashrate",
|
"hashrate",
|
||||||
"hostname",
|
"hostname",
|
||||||
"is_mining",
|
"is_mining",
|
||||||
|
"serial_number",
|
||||||
"mac",
|
"mac",
|
||||||
"expected_hashrate",
|
"expected_hashrate",
|
||||||
"uptime",
|
"uptime",
|
||||||
|
|||||||
Reference in New Issue
Block a user