finished updating the miner type handlers to create subclasses of the backend and type to create a miner, each of which handles its own data to simplify creation of new miner types

This commit is contained in:
UpstreamData
2022-05-13 11:27:56 -06:00
parent 06540efc98
commit 44012c50d6
115 changed files with 644 additions and 735 deletions

View File

@@ -112,7 +112,7 @@ Or generate a miner directly without the factory:
```python
import asyncio
from miners.bosminer import BOSMiner
from miners._backends.bosminer import BOSMiner
from tools.cfg_util_old.func.parse_data import safe_parse_api_data

View File

@@ -1,29 +1,22 @@
from API.bmminer import BMMinerAPI
from API.bosminer import BOSMinerAPI
from API.cgminer import CGMinerAPI
from API.btminer import BTMinerAPI
from API.unknown import UnknownAPI
import ipaddress
import asyncssh
import logging
class BaseMiner:
def __init__(
self,
ip: str,
api: BMMinerAPI or BOSMinerAPI or CGMinerAPI or BTMinerAPI or UnknownAPI,
) -> None:
self.ip = ipaddress.ip_address(ip)
def __init__(self, *args) -> None:
self.ip = None
self.uname = "root"
self.pwd = "admin"
self.api = api
self.api = None
self.api_type = None
self.model = None
self.light = None
self.hostname = None
self.nominal_chips = 1
def __repr__(self):
return f"{'' if not self.api_type else self.api_type} {'' if not self.model else self.model}: {str(self.ip)}"
async def _get_ssh_connection(self) -> asyncssh.connect:
"""Create a new asyncssh connection"""
try:

View File

@@ -0,0 +1,5 @@
from .bmminer import BMMiner
from .bosminer import BOSMiner
from .btminer import BTMiner
from .cgminer import CGMiner
from .hiveon import Hiveon

View File

@@ -6,16 +6,12 @@ from settings import MINER_FACTORY_GET_VERSION_RETRIES as DATA_RETRIES
class BMMiner(BaseMiner):
def __init__(self, ip: str) -> None:
api = BMMinerAPI(ip)
super().__init__(ip, api)
self.model = None
self.config = None
super().__init__(ip)
self.api = BMMinerAPI(ip)
self.api_type = "BMMiner"
self.uname = "root"
self.pwd = "admin"
def __repr__(self) -> str:
return f"BMMiner: {str(self.ip)}"
async def get_model(self) -> str or None:
"""Get miner model.

View File

@@ -8,17 +8,11 @@ from settings import MINER_FACTORY_GET_VERSION_RETRIES as DATA_RETRIES
class BOSMiner(BaseMiner):
def __init__(self, ip: str) -> None:
api = BOSMinerAPI(ip)
super().__init__(ip, api)
self.model = None
self.config = None
self.version = None
super().__init__(ip)
self.api = BOSMinerAPI(ip)
self.api_type = "BOSMiner"
self.uname = "root"
self.pwd = "admin"
self.nominal_chips = 63
def __repr__(self) -> str:
return f"BOSminer: {str(self.ip)}"
async def send_ssh_command(self, cmd: str) -> str or None:
"""Send a command to the miner over ssh.

View File

@@ -7,13 +7,9 @@ from settings import MINER_FACTORY_GET_VERSION_RETRIES as DATA_RETRIES
class BTMiner(BaseMiner):
def __init__(self, ip: str) -> None:
api = BTMinerAPI(ip)
self.model = None
super().__init__(ip, api)
self.nominal_chips = 66
def __repr__(self) -> str:
return f"BTMiner: {str(self.ip)}"
super().__init__(ip)
self.api = BTMinerAPI(ip)
self.api_type = "BTMiner"
async def get_model(self):
if self.model:

View File

@@ -7,16 +7,12 @@ import logging
class CGMiner(BaseMiner):
def __init__(self, ip: str) -> None:
api = CGMinerAPI(ip)
super().__init__(ip, api)
self.model = None
self.config = None
super().__init__(ip)
self.api = CGMinerAPI(ip)
self.api_type = "CGMiner"
self.uname = "root"
self.pwd = "admin"
def __repr__(self) -> str:
return f"CGMiner: {str(self.ip)}"
async def get_model(self):
if self.model:
return self.model

View File

@@ -0,0 +1,46 @@
from miners._backends import BMMiner
class Hiveon(BMMiner):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "Hiveon"
self.uname = "root"
self.pwd = "admin"
async def get_board_info(self) -> dict:
"""Gets data on each board and chain in the miner."""
board_stats = await self.api.stats()
stats = board_stats["STATS"][1]
boards = {}
board_chains = {0: [2, 9, 10], 1: [3, 11, 12], 2: [4, 13, 14]}
for idx, board in enumerate(board_chains):
boards[board] = []
for chain in board_chains[board]:
count = stats[f"chain_acn{chain}"]
chips = stats[f"chain_acs{chain}"].replace(" ", "")
if not count == 18 or "x" in chips:
nominal = False
else:
nominal = True
boards[board].append(
{
"chain": chain,
"chip_count": count,
"chip_status": chips,
"nominal": nominal,
}
)
return boards
async def get_bad_boards(self) -> dict:
"""Checks for and provides list of non working boards."""
boards = await self.get_board_info()
bad_boards = {}
for board in boards.keys():
for chain in boards[board]:
if not chain["chip_count"] == 18 or "x" in chain["chip_status"]:
if board not in bad_boards.keys():
bad_boards[board] = []
bad_boards[board].append(chain)
return bad_boards

View File

@@ -0,0 +1,3 @@
from .antminer import *
from .avalonminer import *
from .whatsminer import *

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class S17(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "S17"
self.nominal_chips = 65

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class S17Plus(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "S17+"
self.nominal_chips = 65

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class S17Pro(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "S17 Pro"
self.nominal_chips = 65

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class S17e(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "S17e"
self.nominal_chips = 65

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class T17(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "T17"
self.nominal_chips = 65

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class T17Plus(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "T17+"
self.nominal_chips = 65

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class T17e(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "T17e"
self.nominal_chips = 65

View File

@@ -0,0 +1,8 @@
from .S17 import S17
from .S17_Plus import S17Plus
from .S17_Pro import S17Pro
from .S17e import S17e
from .T17 import T17
from .T17_Plus import T17Plus
from .T17e import T17e

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class S19(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "S19"
self.nominal_chips = 114

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class S19Pro(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "S19 Pro"
self.nominal_chips = 114

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class S19j(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "S19j"
self.nominal_chips = 114

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class S19jPro(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "S19j Pro"
self.nominal_chips = 114

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class T19(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "T19"
self.nominal_chips = 114

View File

@@ -0,0 +1,7 @@
from .S19 import S19
from .S19_Pro import S19Pro
from .S19j import S19j
from .S19j_Pro import S19jPro
from .T19 import T19

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class S9(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "S9"
self.nominal_chips = 63

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class T9(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "T9"
self.nominal_chips = 1

View File

@@ -0,0 +1,2 @@
from .S9 import S9
from .T9 import T9

View File

@@ -0,0 +1,3 @@
from .X9 import *
from .X17 import *
from .X19 import *

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class Avalon1047(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "Avalon 1047"
self.nominal_chips = 114

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class Avalon1066(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "Avalon 1066"
self.nominal_chips = 114

View File

@@ -0,0 +1,2 @@
from .A1047 import Avalon1047
from .A1066 import Avalon1066

View File

@@ -0,0 +1,8 @@
from miners import BaseMiner
class Avalon821(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "Avalon 821"

View File

@@ -0,0 +1,8 @@
from miners import BaseMiner
class Avalon841(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "Avalon 841"

View File

@@ -0,0 +1,2 @@
from .A821 import Avalon821
from .A841 import Avalon841

View File

@@ -0,0 +1,2 @@
from .A8X import *
from .A10X import *

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class M20S(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M20S"
self.nominal_chips = 66

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class M20SPlus(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M20S+"
self.nominal_chips = 66

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class M21(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M21"
self.nominal_chips = 105

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class M21S(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M21S"
self.nominal_chips = 105

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class M21SPlus(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M21S+"
self.nominal_chips = 105

View File

@@ -0,0 +1,6 @@
from .M20S import M20S
from .M20S_Plus import M20SPlus
from .M21 import M21
from .M21S import M21S
from .M21S_Plus import M21SPlus

View File

@@ -0,0 +1,8 @@
from miners import BaseMiner
class M30S(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M30S"

View File

@@ -0,0 +1,8 @@
from miners import BaseMiner
class M30SPlus(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M30S+"

View File

@@ -0,0 +1,8 @@
from miners import BaseMiner
class M30SPlusPlus(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M30S++"

View File

@@ -0,0 +1,8 @@
from miners import BaseMiner
class M31S(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M31S"

View File

@@ -0,0 +1,8 @@
from miners import BaseMiner
class M31SPlus(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M31S+"

View File

@@ -0,0 +1,9 @@
from miners import BaseMiner
class M32S(BaseMiner):
def __init__(self, ip: str):
super().__init__()
self.ip = ip
self.model = "M32S"
self.nominal_chips = 78

View File

@@ -0,0 +1,8 @@
from .M30S import M30S
from .M30S_Plus import M30SPlus
from .M30S_Plus_Plus import M30SPlusPlus
from .M31S import M31S
from .M31S_Plus import M31SPlus
from .M32S import M32S

View File

@@ -0,0 +1,2 @@
from .M2X import *
from .M3X import *

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import S17
class BMMinerS17(BMMiner):
class BMMinerS17(BMMiner, S17):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "S17"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BMMinerS17: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import S17Plus
class BMMinerS17Plus(BMMiner):
class BMMinerS17Plus(BMMiner, S17Plus):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "S17+"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BMMinerS17+: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import S17Pro
class BMMinerS17Pro(BMMiner):
class BMMinerS17Pro(BMMiner, S17Pro):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "S17 Pro"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BMMinerS17Pro: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import S17e
class BMMinerS17e(BMMiner):
class BMMinerS17e(BMMiner, S17e):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "S17e"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BMMinerS17e: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import T17
class BMMinerT17(BMMiner):
class BMMinerT17(BMMiner, T17):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "T17"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BMMinerT17: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import T17Plus
class BMMinerT17Plus(BMMiner):
class BMMinerT17Plus(BMMiner, T17Plus):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "T17+"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BMMinerT17+: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import T17e
class BMMinerT17e(BMMiner):
class BMMinerT17e(BMMiner, T17e):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "T17e"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BMMinerT17e: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import S19
class BMMinerS19(BMMiner):
class BMMinerS19(BMMiner, S19):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "S19"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"BMMinerS19: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import S19Pro
class BMMinerS19Pro(BMMiner):
class BMMinerS19Pro(BMMiner, S19Pro):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "S19 Pro"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"BMMinerS19Pro: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import S19j
class BMMinerS19j(BMMiner):
class BMMinerS19j(BMMiner, S19j):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "S19j"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"BMMinerS19j: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import S19jPro
class BMMinerS19jPro(BMMiner):
class BMMinerS19jPro(BMMiner, S19jPro):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "S19j Pro"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"BMMinerS19jPro: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import T19
class BMMinerT19(BMMiner):
class BMMinerT19(BMMiner, T19):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BMMiner"
self.model = "T19"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"BMMinerT19: {str(self.ip)}"
self.ip = ip

View File

@@ -1,11 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import S9
class BMMinerS9(BMMiner):
class BMMinerS9(BMMiner, S9):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.model = "S9"
self.api_type = "BMMiner"
def __repr__(self) -> str:
return f"BMMinerS9: {str(self.ip)}"
self.ip = ip

View File

@@ -1,11 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import BMMiner
from miners._types import T9
class BMMinerT9(BMMiner):
class BMMinerT9(BMMiner, T9):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.model = "T9"
self.api_type = "BMMiner"
def __repr__(self) -> str:
return f"BMMinerT9: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import S17
class BOSMinerS17(BOSMiner):
class BOSMinerS17(BOSMiner, S17):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "S17"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BOSMinerS17: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import S17Plus
class BOSMinerS17Plus(BOSMiner):
class BOSMinerS17Plus(BOSMiner, S17Plus):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "S17+"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BOSMinerS17+: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import S17Pro
class BOSMinerS17Pro(BOSMiner):
class BOSMinerS17Pro(BOSMiner, S17Pro):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "S17 Pro"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BOSMinerS17Pro: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import S17e
class BOSMinerS17e(BOSMiner):
class BOSMinerS17e(BOSMiner, S17e):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "S17e"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BOSMinerS17e: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import T17
class BOSMinerT17(BOSMiner):
class BOSMinerT17(BOSMiner, T17):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "T17"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BOSMinerT17: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import T17Plus
class BOSMinerT17Plus(BOSMiner):
class BOSMinerT17Plus(BOSMiner, T17Plus):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "T17+"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BOSMinerT17+: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import T17e
class BOSMinerT17e(BOSMiner):
class BOSMinerT17e(BOSMiner, T17e):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "T17e"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"BOSMinerT17e: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import S19
class BOSMinerS19(BOSMiner):
class BOSMinerS19(BOSMiner, S19):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "S19"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"BOSMinerS19: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import S19Pro
class BOSMinerS19Pro(BOSMiner):
class BOSMinerS19Pro(BOSMiner, S19Pro):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "S19 Pro"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"BOSMinerS19Pro: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import S19j
class BOSMinerS19j(BOSMiner):
class BOSMinerS19j(BOSMiner, S19j):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "S19j"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"BOSMinerS19j: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import S19jPro
class BOSMinerS19jPro(BOSMiner):
class BOSMinerS19jPro(BOSMiner, S19jPro):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "S19j Pro"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"BOSMinerS19jPro: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import T19
class BOSMinerT19(BOSMiner):
class BOSMinerT19(BOSMiner, T19):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "BOSMiner"
self.model = "T19"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"BOSMinerT19: {str(self.ip)}"
self.ip = ip

View File

@@ -1,11 +1,8 @@
from miners.bosminer import BOSMiner
from miners._backends import BOSMiner
from miners._types import S9
class BOSMinerS9(BOSMiner):
class BOSMinerS9(BOSMiner, S9):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.model = "S9"
self.api_type = "BOSMiner"
def __repr__(self) -> str:
return f"BOSMinerS9: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import S17
class CGMinerS17(CGMiner):
class CGMinerS17(CGMiner, S17):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "S17"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"CGMinerS17: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import S17Plus
class CGMinerS17Plus(CGMiner):
class CGMinerS17Plus(CGMiner, S17Plus):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "S17+"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"CGMinerS17+: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import S17Pro
class CGMinerS17Pro(CGMiner):
class CGMinerS17Pro(CGMiner, S17Pro):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "S17 Pro"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"CGMinerS17Pro: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import S17e
class CGMinerS17e(CGMiner):
class CGMinerS17e(CGMiner, S17e):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "S17e"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"CGMinerS17e: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import T17
class CGMinerT17(CGMiner):
class CGMinerT17(CGMiner, T17):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "T17"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"CGMinerT17: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import T17Plus
class CGMinerT17Plus(CGMiner):
class CGMinerT17Plus(CGMiner, T17Plus):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "T17+"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"CGMinerT17+: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import T17e
class CGMinerT17e(CGMiner):
class CGMinerT17e(CGMiner, T17e):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "T17e"
self.nominal_chips = 65
def __repr__(self) -> str:
return f"CGMinerT17e: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import S19
class CGMinerS19(CGMiner):
class CGMinerS19(CGMiner, S19):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "S19"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"CGMinerS19: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import S19Pro
class CGMinerS19Pro(CGMiner):
class CGMinerS19Pro(CGMiner, S19Pro):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "S19 Pro"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"CGMinerS19Pro: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import S19j
class CGMinerS19j(CGMiner):
class CGMinerS19j(CGMiner, S19j):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "S19j"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"CGMinerS19j: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import S19jPro
class CGMinerS19jPro(CGMiner):
class CGMinerS19jPro(CGMiner, S19jPro):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "S19j Pro"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"CGMinerS19jPro: {str(self.ip)}"
self.ip = ip

View File

@@ -1,12 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import T19
class CGMinerT19(CGMiner):
class CGMinerT19(CGMiner, T19):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.api_type = "CGMiner"
self.model = "T19"
self.nominal_chips = 114
def __repr__(self) -> str:
return f"CGMinerT19: {str(self.ip)}"
self.ip = ip

View File

@@ -1,11 +1,8 @@
from miners.cgminer import CGMiner
from miners._backends import CGMiner
from miners._types import S9
class CGMinerS9(CGMiner):
class CGMinerS9(CGMiner, S9):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.model = "S9"
self.api_type = "CGMiner"
def __repr__(self) -> str:
return f"CGMinerS9: {str(self.ip)}"
self.ip = ip

View File

@@ -1,4 +1,4 @@
from miners.cgminer import CGMiner
from miners._backends.cgminer import CGMiner
class CGMinerT9(CGMiner):

View File

@@ -1,2 +1 @@
from .S9 import CGMinerS9
from .T9 import CGMinerT9

View File

@@ -1,49 +1,8 @@
from miners.bmminer import BMMiner
from miners._backends import Hiveon
from miners._types import T9
class HiveonT9(BMMiner):
class HiveonT9(Hiveon, T9):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.model = "T9"
self.api_type = "Hiveon"
self.nominal_chips = 54
def __repr__(self) -> str:
return f"HiveonT9: {str(self.ip)}"
async def get_board_info(self) -> dict:
"""Gets data on each board and chain in the miner."""
board_stats = await self.api.stats()
stats = board_stats["STATS"][1]
boards = {}
board_chains = {0: [2, 9, 10], 1: [3, 11, 12], 2: [4, 13, 14]}
for idx, board in enumerate(board_chains):
boards[board] = []
for chain in board_chains[board]:
count = stats[f"chain_acn{chain}"]
chips = stats[f"chain_acs{chain}"].replace(" ", "")
if not count == 18 or "x" in chips:
nominal = False
else:
nominal = True
boards[board].append(
{
"chain": chain,
"chip_count": count,
"chip_status": chips,
"nominal": nominal,
}
)
return boards
async def get_bad_boards(self) -> dict:
"""Checks for and provides list of non working boards."""
boards = await self.get_board_info()
bad_boards = {}
for board in boards.keys():
for chain in boards[board]:
if not chain["chip_count"] == 18 or "x" in chain["chip_status"]:
if board not in bad_boards.keys():
bad_boards[board] = []
bad_boards[board].append(chain)
return bad_boards
self.ip = ip

View File

@@ -1,61 +0,0 @@
from miners.cgminer import CGMiner
import logging
class CGMinerAvalon10(CGMiner):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.model = "Avalon 10"
self.api_type = "CGMiner"
self.nominal_chips = 114
async def get_hostname(self):
try:
devdetails = await self.api.devdetails()
if devdetails:
if len(devdetails.get("DEVDETAILS")) > 0:
if "Name" in devdetails["DEVDETAILS"][0]:
host = devdetails["DEVDETAILS"][0]["Name"]
logging.debug(f"Found hostname for {self.ip}: {host}")
return host
except Exception as e:
logging.warning(f"Failed to get hostname for miner: {self}")
return "?"
logging.warning(f"Failed to get hostname for miner: {self}")
return "?"
async def get_board_info(self):
boards_chips = 0
logging.debug(f"{self}: Getting board info.")
stats = await self.api.stats()
if not stats.get("STATS") and not stats.get("STATS") == []:
print("stats error", stats)
return {0: [], 1: [], 2: []}
stats = stats["STATS"][0]
for key in stats.keys():
if key.startswith("MM") and not stats[key] == 1:
data = stats[key]
for line in data.split("]"):
if "TA[" in line:
total_chips = line.replace("TA[", "")
boards_chips = round(int(total_chips)/3)
boards = {}
for board in [0, 1, 2]:
if not boards_chips == self.nominal_chips:
nominal = False
else:
nominal = True
boards[board] = []
boards[board].append({
"chain": board,
"chip_count": boards_chips,
"chip_status": "o" * boards_chips,
"nominal": nominal,
})
return boards

View File

@@ -1,177 +0,0 @@
from miners.cgminer import CGMiner
import re
class CGMinerAvalon8(CGMiner):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.model = "Avalon 8"
self.api_type = "CGMiner"
self.pattern = re.compile(
r"Ver\[(?P<Ver>[-0-9A-Fa-f+]+)\]\s"
"DNA\[(?P<DNA>[0-9A-Fa-f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_V3_21>[-0-9\s]+)\]\s"
"PVT_V3_22\[(?P<PVT_V3_22>[-0-9\s]+)\]\s"
"PVT_V3_23\[(?P<PVT_V3_23>[-0-9\s]+)\]\s"
"PVT_V3_24\[(?P<PVT_V3_24>[-0-9\s]+)\]\s"
"PVT_V3_25\[(?P<PVT_V3_25>[-0-9\s]+)\]\s"
"FM\[(?P<FM>[0-9]+)\]\s"
"CRC\[(?P<CRC>[0-9\s]+)\]",
re.X,
)
def __repr__(self) -> str:
return f"CGMinerAvalon8: {str(self.ip)}"
def parse_estats(self, estats):
for estat in estats:
for key in estat:
if key[:5] == "MM ID":
self._parse_estat(estat, key)
def _parse_estat(self, estat, key):
module = estat[key]
module_info = re.match(self.pattern, module)
if not module_info:
return None
module_info = module_info.groupdict()
print(module_info)

View File

@@ -1,11 +1 @@
from miners.cgminer import CGMiner
class CGMinerAvalon(CGMiner):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.model = "Avalon"
self.api_type = "CGMiner"
def __repr__(self) -> str:
return f"CGMinerAvalon: {str(self.ip)}"
from .cgminer import *

View File

@@ -0,0 +1,8 @@
from miners._backends import CGMiner
from miners._types import Avalon1047
class CGMinerAvalon1047(CGMiner, Avalon1047):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.ip = ip

View File

@@ -0,0 +1,8 @@
from miners._backends import CGMiner
from miners._types import Avalon1066
class CGMinerAvalon1066(CGMiner, Avalon1066):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.ip = ip

View File

@@ -0,0 +1,2 @@
from .A1047 import CGMinerAvalon1047
from .A1066 import CGMinerAvalon1066

View File

@@ -0,0 +1,8 @@
from miners._backends import CGMiner
from miners._types import Avalon821
class CGMinerAvalon821(CGMiner, Avalon821):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.ip = ip

View File

@@ -0,0 +1,8 @@
from miners._backends import CGMiner
from miners._types import Avalon841
class CGMinerAvalon841(CGMiner, Avalon841):
def __init__(self, ip: str) -> None:
super().__init__(ip)
self.ip = ip

View File

@@ -0,0 +1,2 @@
from .A821 import CGMinerAvalon821
from .A841 import CGMinerAvalon841

Some files were not shown because too many files have changed in this diff Show More