fixe a bug with older versions of braiins sometimes being buggy with versioning

This commit is contained in:
UpstreamData
2022-01-07 15:25:11 -07:00
parent fa88bea376
commit d9ecdfc9d7
3 changed files with 10 additions and 7 deletions

View File

@@ -129,7 +129,7 @@ async def get_data(ip_list: list):
progress_bar_len += 1
asyncio.create_task(update_prog_bar(progress_bar_len))
hashrate_list = [float(item[3].replace(" TH/s", "")) for item in window["ip_table"].Values if not item[3] == '']
hashrate_list = [float(item[3].replace(" TH/s", "")) if not item[3] == '' else 0 for item in window["ip_table"].Values]
total_hr = round(sum(hashrate_list), 2)
window["hr_total"].update(f"{total_hr} TH/s")
@@ -194,7 +194,10 @@ async def get_formatted_data(ip: ipaddress.ip_address):
except APIError:
return {'TH/s': "Unknown", 'IP': str(miner.ip), 'host': "Unknown", 'user': "Unknown", 'wattage': 0}
host = await miner.get_hostname()
try:
model = await miner.get_model()
except TypeError:
print(miner)
temps = 0
if "summary" in miner_data.keys():
if "Temperature" in miner_data['summary'][0]['SUMMARY'][0].keys():

View File

@@ -66,7 +66,7 @@ class MinerFactory:
break
if model:
if "Antminer" in model:
if model == "Antminer S9":
if "Antminer S9" in model:
if "BOSMiner" in api:
miner = BOSMinerS9(str(ip))
elif "CGMiner" in api:
@@ -197,11 +197,11 @@ class MinerFactory:
data = await self._send_api_command(str(ip), "version")
if data.get("STATUS") and not data.get("STATUS") == "E":
if data["STATUS"][0].get("STATUS") in ["I", "S"]:
if "BMMiner" in data["VERSION"][0].keys():
if any("BMMiner" in string for string in data["VERSION"][0].keys()):
api = "BMMiner"
elif "CGMiner" in data["VERSION"][0].keys():
elif any("CGMiner" in string for string in data["VERSION"][0].keys()):
api = "CGMiner"
elif "BOSminer" in data["VERSION"][0].keys() or "BOSminer+" in data["VERSION"][0].keys():
elif any("BOSminer" in string for string in data["VERSION"][0].keys()):
api = "BOSMiner"
elif data.get("Description") and "whatsminer" in data.get("Description"):
api = "BTMiner"

View File

@@ -10,7 +10,7 @@ class UnknownMiner(BaseMiner):
def __repr__(self) -> str:
return f"Unknown: {str(self.ip)}"
def get_model(self):
async def get_model(self):
return "Unknown"
async def send_config(self, _):