added btminer get_model and improved return on the rest of the get_models

This commit is contained in:
UpstreamData
2022-01-07 10:20:55 -07:00
parent 8ec8c57e31
commit 4e8ff9ea74
9 changed files with 52 additions and 102 deletions

View File

@@ -7,6 +7,7 @@ class CGMiner(BaseMiner):
def __init__(self, ip: str) -> None:
api = CGMinerAPI(ip)
super().__init__(ip, api)
self.model = None
self.config = None
self.uname = 'root'
self.pwd = 'admin'
@@ -14,6 +15,15 @@ class CGMiner(BaseMiner):
def __repr__(self) -> str:
return f"CGMiner: {str(self.ip)}"
async def get_model(self):
if self.model:
return self.model
version_data = await self.api.devdetails()
if version_data:
self.model = version_data["DEVDETAILS"][0]["Model"].replace("Antminer ", "")
return self.model
return None
async def get_hostname(self) -> str:
try:
async with (await self._get_ssh_connection()) as conn: