updated the gui to get the model

This commit is contained in:
UpstreamData
2022-01-07 10:35:25 -07:00
parent 770b17c86b
commit c93d99b27c
5 changed files with 17 additions and 14 deletions

View File

@@ -172,13 +172,13 @@ async def scan_and_get_data(network):
if data_point["IP"] in ordered_all_ips: if data_point["IP"] in ordered_all_ips:
ip_table_index = ordered_all_ips.index(data_point["IP"]) ip_table_index = ordered_all_ips.index(data_point["IP"])
ip_table_data[ip_table_index] = [ ip_table_data[ip_table_index] = [
data_point["IP"], data_point["host"], str(data_point['TH/s']) + " TH/s", data_point["temp"], data_point["IP"], data_point["model"], data_point["host"], str(data_point['TH/s']) + " TH/s", data_point["temp"],
data_point['user'], str(data_point['wattage']) + " W" data_point['user'], str(data_point['wattage']) + " W"
] ]
window["ip_table"].update(ip_table_data) window["ip_table"].update(ip_table_data)
progress_bar_len += 1 progress_bar_len += 1
asyncio.create_task(update_prog_bar(progress_bar_len)) asyncio.create_task(update_prog_bar(progress_bar_len))
hashrate_list = [float(item[2].replace(" TH/s", "")) for item in window["ip_table"].Values if not item[2] == ''] hashrate_list = [float(item[3].replace(" TH/s", "")) for item in window["ip_table"].Values if not item[3] == '']
total_hr = round(sum(hashrate_list), 2) total_hr = round(sum(hashrate_list), 2)
await update_ui_with_data("hr_total", f"{total_hr} TH/s") await update_ui_with_data("hr_total", f"{total_hr} TH/s")
await update_ui_with_data("status", "") await update_ui_with_data("status", "")
@@ -191,6 +191,7 @@ async def get_formatted_data(ip: ipaddress.ip_address):
except APIError: except APIError:
return {'TH/s': "Unknown", 'IP': str(miner.ip), 'host': "Unknown", 'user': "Unknown", 'wattage': 0} return {'TH/s': "Unknown", 'IP': str(miner.ip), 'host': "Unknown", 'user': "Unknown", 'wattage': 0}
host = await miner.get_hostname() host = await miner.get_hostname()
model = await miner.get_model()
temps = 0 temps = 0
if "summary" in miner_data.keys(): if "summary" in miner_data.keys():
if "Temperature" in miner_data['summary'][0]['SUMMARY'][0].keys(): if "Temperature" in miner_data['summary'][0]['SUMMARY'][0].keys():
@@ -239,7 +240,9 @@ async def get_formatted_data(ip: ipaddress.ip_address):
wattage = await safe_parse_api_data(miner_data, "summary", 0, 'SUMMARY', 0, "Power") wattage = await safe_parse_api_data(miner_data, "summary", 0, 'SUMMARY', 0, "Power")
else: else:
wattage = 0 wattage = 0
return {'TH/s': th5s, 'IP': str(miner.ip), 'temp': round(temps), 'host': host, 'user': user, 'wattage': wattage} return {'TH/s': th5s, 'IP': str(miner.ip), 'model': model,
'temp': round(temps), 'host': host, 'user': user,
'wattage': wattage}
async def generate_config(username, workername, v2_allowed): async def generate_config(username, workername, v2_allowed):

File diff suppressed because one or more lines are too long

View File

@@ -12,6 +12,3 @@ class BaseMiner:
self.api = api self.api = api
self.api_type = None self.api_type = None
self.model = None self.model = None
def _init(self):
pass

View File

@@ -27,7 +27,7 @@ class BTMiner(BaseMiner):
if host_data: if host_data:
return host_data["Msg"]["hostname"] return host_data["Msg"]["hostname"]
except APIError: except APIError:
return "BTMiner ?" return "?"
async def send_config(self, _): async def send_config(self, _):
return None # ignore for now return None # ignore for now

View File

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