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

@@ -6,11 +6,21 @@ from API import APIError
class BTMiner(BaseMiner):
def __init__(self, ip: str) -> None:
api = BTMinerAPI(ip)
self.model = None
super().__init__(ip, api)
def __repr__(self) -> str:
return f"BTMiner: {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"].split("V")[0]
return self.model
return None
async def get_hostname(self) -> str:
try:
host_data = await self.api.get_miner_info()