added support for avalon10xx miners
This commit is contained in:
24
miners/avalonminer/Avalon10/__init__.py
Normal file
24
miners/avalonminer/Avalon10/__init__.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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"
|
||||
|
||||
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 "?"
|
||||
@@ -2,10 +2,10 @@ from miners.cgminer import CGMiner
|
||||
import re
|
||||
|
||||
|
||||
class CGMinerAvalon(CGMiner):
|
||||
class CGMinerAvalon8(CGMiner):
|
||||
def __init__(self, ip: str) -> None:
|
||||
super().__init__(ip)
|
||||
self.model = "Avalon"
|
||||
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]+)\]\s'
|
||||
@@ -158,7 +158,7 @@ class CGMinerAvalon(CGMiner):
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"CGMinerAvalon: {str(self.ip)}"
|
||||
return f"CGMinerAvalon8: {str(self.ip)}"
|
||||
|
||||
def parse_estats(self, estats):
|
||||
for estat in estats:
|
||||
|
||||
@@ -19,7 +19,8 @@ from miners.whatsminer.M30 import BTMinerM30
|
||||
from miners.whatsminer.M31 import BTMinerM31
|
||||
from miners.whatsminer.M32 import BTMinerM32
|
||||
|
||||
from miners.avalonminer import CGMinerAvalon
|
||||
from miners.avalonminer.Avalon8 import CGMinerAvalon8
|
||||
from miners.avalonminer.Avalon10 import CGMinerAvalon10
|
||||
|
||||
from miners.cgminer import CGMiner
|
||||
from miners.bmminer import BMMiner
|
||||
@@ -147,9 +148,12 @@ class MinerFactory:
|
||||
elif "BMMiner" in api:
|
||||
miner = BMMinerX19(str(ip))
|
||||
|
||||
# Avalonminer V8
|
||||
# Avalonminers
|
||||
elif "avalon" in model:
|
||||
miner = CGMinerAvalon(str(ip))
|
||||
if model == "avalon10":
|
||||
miner = CGMinerAvalon10(str(ip))
|
||||
else:
|
||||
miner = CGMinerAvalon8(str(ip))
|
||||
|
||||
# Whatsminers
|
||||
elif "M20" in model:
|
||||
|
||||
Reference in New Issue
Block a user